You are not logged in.

#1 2025-09-14 16:41:03

osalbahr
Member
Registered: 2025-06-23
Posts: 3

PKGBUILD Review: mirafetch

Hi, I would like to request a review of the following `PKGBUILD`:

# Maintainer: Osama Albahrani <osalbahr@gmail.com>

pkgname=mirafetch
pkgver=0.1.0
pkgrel=1
pkgdesc='A Rust reimplementation of Hyfetch wih a focus on speed'
url='https://github.com/ArgentumCation/mirafetch'
arch=('x86_64')
makedepends=('cargo')
license=('EUPL-1.2')
source=("v$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('7b18e17093321e2801bc15bb913fafc8e4afc824357c909423952eb200c4fe79')
provides=('mirafetch')

build() {
	cd "$pkgname-$pkgver"
	cargo build --release
}

package() {
	cd "$pkgname-$pkgver"
	install -Dm755 "target/release/$pkgname" -t "$pkgdir/usr/bin"
	install -Dm644 'LICENSE.md' -t "$pkgdir/usr/share/licenses/$pkgname"
	install -Dm644 'README.md' -t "$pkgdir/usr/share/doc/$pkgname"
}

I confirmed it works with `makepkg -si`. But with `pkgctl build` I got the following error:

==> Running checkpkg
error: target not found: mirafetch
==> WARNING: Skipped checkpkg due to missing repo packages

And I'm not sure what that means. From this post[1] I'm guessing it's expected behavior.

[1]: https://bbs.archlinux.org/viewtopic.php?id=250646

Last edited by osalbahr (2025-09-14 16:42:39)

Offline

#2 2025-09-14 18:39:40

killertofus
Member
Registered: 2025-02-10
Posts: 26

Re: PKGBUILD Review: mirafetch

pkgname=mirafetch
pkgver=0.1.0
pkgrel=1
pkgdesc="A Rust reimplementation of Hyfetch with a focus on speed"
url="https://github.com/ArgentumCation/mirafetch"
makedepends=('cargo')
depends=('glibc' 'gcc-libs')
arch=('any')
license=('MIT')
source=("$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/$pkgname/$pkgver/download")
sha256sums=('')

prepare() {
  cd "$pkgname-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"

}



build() {
  cd "$pkgname-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --all-features
}

package() {
  cd "$pkgname-$pkgver"
   install -Dm755 target/release/mirafetch "$pkgdir/usr/bin/$pkgname"

 }

Do not add $pkgname to provides, as it is always implicitly provided by the package.

The rust dependency manager cargo is able to download all the libraries required to build a project ahead of time. Running fetch in the prepare() stage enables the later build() and other stages to be run entirely offline.

build() taking from here https://wiki.archlinux.org/title/Rust_p … ines#Build
Rust builds binaries in target/release and can simply be installed to /usr/bin

Last edited by killertofus (2025-09-14 18:45:12)

Online

#3 2025-09-15 07:33:13

loqs
Member
Registered: 2014-03-06
Posts: 18,605

Re: PKGBUILD Review: mirafetch

@osalbahr

source=("v$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")

Renaming the source to the same name is redundant, The name is still not unique. You can use either of:

source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")

depends, provides and prepare already covered by killertofus.

Please consider adding a check function if there are tests.

==> WARNING: Skipped checkpkg due to missing repo packages

As the package is not in the official repositories it can not downloaded from them to compare this build with the last one from the repositories,

@killertofus

arch=('any')
mirafetch E: ELF file ('usr/bin/mirafetch') found in an 'any' package.
license=('MIT')
mirafetch E: Uncommon license identifiers such as 'MIT' require license files below /usr/share/licenses/mirafetch/ or switching to common license identifiers. Found 0/1 required license files.

Also it is not the correct license.

source=("$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/$pkgname/$pkgver/download")

Why use crates.io?

sha256sums=('')

This breaks the build:

==> ERROR: sha256sums does not allow empty values.
==> ERROR: Could not download sources.
killertofus wrote:

Rust builds binaries in target/release and can simply be installed to /usr/bin

Are you objecting osalbahr's use of `install -t`?

Offline

#4 2025-09-15 18:09:39

killertofus
Member
Registered: 2025-02-10
Posts: 26

Re: PKGBUILD Review: mirafetch

@loqs
the mit license and any was a copy/paste mistake
the wiki says most Rust projects are published on crates.io which provides a stable download URL scheme for use with cargo. Which is why I picked it

the sha256sums was blank on purpose so that @osalbahr will add the sha256sums themself

the wiki also said that Rust builds binaries in target/release and can simply be installed to /usr/bin

Online

#5 2025-09-15 18:25:37

loqs
Member
Registered: 2014-03-06
Posts: 18,605

Re: PKGBUILD Review: mirafetch

killertofus wrote:

the wiki says most Rust projects are published on crates.io which provides a stable download URL scheme for use with cargo. Which is why I picked it

I was wondering because I have not seen it used by any Rust package in the official repositories.

killertofus wrote:

the sha256sums was blank on purpose so that @osalbahr will add the sha256sums themself

Perhaps osalbahr added them in an edit between your post and mine as they were present when I looked at both of your package builds.

killertofus wrote:

the wiki also said that Rust builds binaries in target/release and can simply be installed to /usr/bin

Which is what osalbahr's package build does with:

	install -Dm755 "target/release/$pkgname" -t "$pkgdir/usr/bin"

Offline

#6 2025-09-16 20:00:12

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,260

Re: PKGBUILD Review: mirafetch

killertofus wrote:

the wiki says most Rust projects are published on crates.io which provides a stable download URL scheme for use with cargo. Which is why I picked it

wiki wrote:

Most Rust projects may be built from tarballs, source archives (e.g. source links on GitHub releases), or any other published source.

When other sources are not available, most Rust projects are published on crates.io

To me that indicates crates.io should only be used as a last resort.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB