Package Details: swayosd-git 0.1.0.r0.gdbb8b72-1

Git Clone URL: https://aur.archlinux.org/swayosd-git.git (read-only, click to copy)
Package Base: swayosd-git
Description: A GTK based on screen display for keyboard shortcuts like caps-lock and volume
Upstream URL: https://github.com/ErikReider/SwayOSD
Licenses: GPL3
Conflicts: swayosd
Provides: swayosd
Submitter: jgmdev
Maintainer: jgmdev
Last Packager: jgmdev
Votes: 7
Popularity: 1.42
First Submitted: 2023-01-19 19:23 (UTC)
Last Updated: 2024-10-04 04:33 (UTC)

Latest Comments

« First ‹ Previous 1 2 3

jgmdev commented on 2023-01-25 01:12 (UTC) (edited on 2023-01-25 01:19 (UTC) by jgmdev)

@Antiz your advice is surely helpful and beneficial, I just took some other AUR package that built for rust and replaced where necessary xD, thanks for sharing the knowledge and changes. Pushed the changes and I'm taking the liberty to add you as co-maintainer of this package. Thanks Again!

Antiz commented on 2023-01-24 23:16 (UTC)

Hi,

This PKGBUILD could benefit from various improvements and corrections:
- Since there's not git tag in the upstream project, the pkgver variable and the pkgver () function should include the "revision" number because, for now, the current default pkgver value/format (gd0d70720) is seen as an higher version than the latest commit (gb7b4e3d) by pacman. That causes an update loop for AUR helper users for instance (I know AUR helper are not officially supported but since the correction is trivial and it goes by the VCS packaging guidelines, I think it should be considered). See [1]
- The license is not GPL but GPL3. See [2]
- The makedepends array misses git. Also, there's no need listing both rust and cargo since cargo depend on rust and, by definition (as it's the rust package manager), cannot ever stop pulling it in as a dependency. See [3]
- This package should provides and conflicts the swayosd package (even though it does not exists yet). See [4] and [5]
- This package does not respects the Rust packaging guidelines. See [6]
- It is common to install the README.md file of the upstream repo to ${pkgdir}/usr/share/doc/${pkgname} when it contains useful information/documentation (which is the case here). See [7]

[1] https://wiki.archlinux.org/title/VCS_package_guidelines#Git
[2] https://github.com/ErikReider/SwayOSD/blob/main/LICENSE
[3] https://wiki.archlinux.org/title/PKGBUILD#depends
[4] https://wiki.archlinux.org/title/PKGBUILD#provides
[5] https://wiki.archlinux.org/title/PKGBUILD#conflicts
[6] https://wiki.archlinux.org/title/Rust_package_guidelines
[7] https://pkgbuild.vdwaa.nl/?q=README.md&i=nope&literal=nope&files=&excludeFiles=&repos=

Here is the diff output between the current PKGBUILD and a PKGBUILD that includes all the improvements/corrections listed above:

diff --git a/PKGBUILD b/PKGBUILD
index b9b0e7f..f141174 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,27 +1,38 @@
 # Maintainer: Jefferson Gonzalez <jgmdev@gmail.com>

 pkgname=swayosd-git
-pkgver=gd0d70720
+pkgver=r9.b7b4e3d
 pkgrel=1
 pkgdesc="A GTK based on screen display for keyboard shortcuts like caps-lock and volume"
-url="https://github.com/ErikReider/SwayOSD"
-license=('GPL')
 arch=('i686' 'x86_64' 'aarch64')
+url="https://github.com/ErikReider/SwayOSD"
+license=('GPL3')
 depends=('gtk3' 'gtk-layer-shell' 'pulseaudio')
-makedepends=('rust' 'cargo')
-source=('git+https://github.com/ErikReider/SwayOSD')
+makedepends=('git' 'cargo')
+provides=('swayosd')
+conflicts=('swayosd')
+source=("git+${url}.git")
 md5sums=('SKIP')

 pkgver() {
-  cd "$srcdir/SwayOSD"
-  echo g$(git rev-parse HEAD | cut -c 1-8)
+  cd "SwayOSD"
+  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+  cd "SwayOSD"
+  cargo fetch --target "$CARCH-unknown-linux-gnu"
 }

 build() {
-  cd "$srcdir/SwayOSD"
-  cargo build --release
+  cd "SwayOSD"
+  export RUSTUP_TOOLCHAIN=stable
+  export CARGO_TARGET_DIR=target
+  cargo build --frozen --release --all-features
 }

 package() {
-  install -Dm 755 "$srcdir/SwayOSD/target/release/swayosd" "$pkgdir/usr/bin/swayosd"
+  cd "SwayOSD"
+  install -Dm 755 "target/release/swayosd" "${pkgdir}/usr/bin/swayosd"
+  install -Dm 644 README.md "${pkgdir}/usr/share/doc/swayosd/README.md"
 }

Here is the "improved/corrected" PKGBUILD itself:

# Maintainer: Jefferson Gonzalez <jgmdev@gmail.com>

pkgname=swayosd-git
pkgver=r9.b7b4e3d
pkgrel=1
pkgdesc="A GTK based on screen display for keyboard shortcuts like caps-lock and volume"
arch=('i686' 'x86_64' 'aarch64')
url="https://github.com/ErikReider/SwayOSD"
license=('GPL3')
depends=('gtk3' 'gtk-layer-shell' 'pulseaudio')
makedepends=('git' 'cargo')
provides=('swayosd')
conflicts=('swayosd')
source=("git+${url}.git")
md5sums=('SKIP')

pkgver() {
  cd "SwayOSD"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "SwayOSD"
  cargo fetch --target "$CARCH-unknown-linux-gnu"
}

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

package() {
  cd "SwayOSD"
  install -Dm 755 "target/release/swayosd" "${pkgdir}/usr/bin/swayosd"
  install -Dm 644 README.md "${pkgdir}/usr/share/doc/swayosd/README.md"
}

I hope this helps :)