How to fix upgrade bug of my AUR that I developed

I do not know if removing pkgver is bad idea.

-git packagces should not have a fixed version as they should build from source, hence the requirement for a pkgver() function.

You should fix the pkgver() function instead of removing it.

1 Like

What about

pkgver() {
  cd ${_gitname}
  git describe --long | sed 's/^foo-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

?

Because this command will find the file name as v20.3.0 due to v. But the problem is pkgrel.

I ran the command git describe --long --tags, I saw the file name is v20.3.0-9-g666bed93

Do I have to change from 3 to 9 in the pkgrel?

I also ran the printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" and saw that it is r297.666bed93%.

Give me a minute to fix this

Adjust the sed command to replace “v” too, e.g. add s/v//g .

Git version:

pkgname=suru-plus-git
pkgver=20.3.0.r8.g833431bd
pkgrel=1
pkgdesc=“Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!”
arch=(any)
url=“https://github.com/gusbemacbe/suru-plus
license=(GPL3)
changelog=CHANGELOG
makedepends=(git)
options=(!strip)
provides=(suru-plus)
conflicts=(suru-plus)
source=("$pkgname::git+${url}.git")
sha256sums=(‘SKIP’)

pkgver()
{
cd “$pkgname”
git describe --long --tags | sed ‘s/^v//;s/([^-]*-g)/r\1/;s/-/./g’
}

and

cp -r "${srcdir}/$pkgname" "${pkgdir}"/usr/share/icons/Suru++\ 20

The you update running makepkg, you don’t touch manually pkgver= for git packages


for a stable version use source

source=("pkgname-pkgver.tar.gz::https://github.com/gusbemacbe/suru-plus/archive/v${pkgver}.tar.gz")

This is also covered in the Archwiki link, is the third use case out of four

If tag contains a prefix, like v or project name then it should be cut off:
pkgver() {
cd “$pkgname”
# cutting off ‘foo-’ prefix that presents in the git tag
git describe --long | sed ‘s/^foo-//;s/([^-]*-g)/r\1/;s/-/./g’
}
6.1.r3.gd77e105

2 Likes

Smart quotes or simple quotes? Using both them, it gave me error:

sed: -e expression #1, char 24: invalid reference \1 ons’ command’s RHS`

I observe that when you connect and try to download https://github.com/gusbemacbe/suru-plus/archive/v20.3.0.r8.g833431bd.tar.gz, it is not found. But the file https://github.com/gusbemacbe/suru-plus/archive/v20.3.0.tar.gz is found.

Maybe what about replacing pkgver=20.3.0.r8.g833431bd for pkgver=20.3.0, so the file link will be found?

Maybe about:

# Contributor: Daniel Miranda (dmiranda)
# Contributor: Fabio ‘Lolix’ Loli <lolix at disroot dot org>
# Maintainer: Gustavo Costa (gusbemacbe)

pkgname=suru-plus-git
pkgver=20.3.0
pkgrel=1
pkgdesc=“Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!”
arch=(any)
url=“https://github.com/gusbemacbe/suru-plus”
license=(GPL3)
changelog=CHANGELOG
makedepends=(git)
options=(!strip)
provides=(suru-plus)
conflicts=(suru-plus)
source=("pkgname-pkgver.tar.gz::https://github.com/gusbemacbe/suru-plus/archive/v${pkgver}.tar.gz")
sha256sums=(‘SKIP’)

pkgver()
{
    cd “$pkgname”
    git describe --long --tags | sed 's/v//g'
}

package() 
{
    # Installing the icons theme
    install -d ${pkgdir}/usr/share/icons

    # Copying to the /usr/share/icons/ and changing name to "Suru++ 20"
    cp -r "${srcdir}/$pkgname" "${pkgdir}"/usr/share/icons/Suru++\ 20

    find ${pkgdir}/usr -type f -exec chmod 644 {} \;
    find ${pkgdir}/usr -type d -exec chmod 755 {} \;

    # Removing unncessary .directory files
    find ${pkgdir}/usr -type f -name '.directory' -delete

    # Deleting unneeded files
    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/.git
    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/.gitignore
    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/*.md
    rm -R "$pkgdir"/usr/share/icons/Suru++\ 20/images
    rm -R "$pkgdir"/usr/share/icons/Suru++\ 20/templates
}

Quick question: are you wanting to fix this yourself, or do you want someone to fix it for you?

Someone. I have just tested this PKGBUILD I modified and it gave error. :-/

Give me a moment.

Edit. OK, here your go:

# Contributor: Daniel Miranda (dmiranda)
# Maintainer: Gustavo Costa (gusbemacbe)

pkgname=suru-plus-git
pkgver=20.3.0
pkgrel=4
pkgdesc="Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!"
arch=('any')
url="https://github.com/gusbemacbe/${pkgname/-git/}"
license=('GPL3')
changelog=CHANGELOG
makedepends=('git')
conflicts=(${pkgname/-git/})
provides=(${pkgname/-git/})
source=("git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd ${pkgname/-git/}
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

package() {
    install -d $pkgdir/usr/share/icons/Suru\ ++
    cp -r ${pkgname/-git/}/* $pkgdir/usr/share/icons/Suru\ ++/
}

and the full thing as a diff:

diff --git a/.SRCINFO b/.SRCINFO
index d8396f7..773420d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,14 @@
 pkgbase = suru-plus-git
 	pkgdesc = Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!
 	pkgver = 20.3.0
-	pkgrel = 3
+	pkgrel = 4
 	url = https://github.com/gusbemacbe/suru-plus
 	changelog = CHANGELOG
 	arch = any
 	license = GPL3
 	makedepends = git
+	provides = suru-plus
 	conflicts = suru-plus
-	options = !strip
 	source = git+https://github.com/gusbemacbe/suru-plus.git
 	sha256sums = SKIP
 
diff --git a/PKGBUILD b/PKGBUILD
index 40c1c83..b2136c6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,45 +1,26 @@
 # Contributor: Daniel Miranda (dmiranda)
 # Maintainer: Gustavo Costa (gusbemacbe)
 
-_gitname=suru-plus
 pkgname=suru-plus-git
 pkgver=20.3.0
-pkgrel=3
+pkgrel=4
 pkgdesc="Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!"
 arch=('any')
-url="https://github.com/gusbemacbe/${_gitname}"
+url="https://github.com/gusbemacbe/${pkgname/-git/}"
 license=('GPL3')
 changelog=CHANGELOG
 makedepends=('git')
-options=('!strip')
-conflicts=(${_gitname})
+conflicts=(${pkgname/-git/})
+provides=(${pkgname/-git/})
 source=("git+${url}.git")
 sha256sums=('SKIP')
 
-# pkgver() 
-# {
-#     cd ${_gitname}
-#     # printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-# }
-
-package() 
-{
-    # Installing the icons theme
-    install -d ${pkgdir}/usr/share/icons
-
-    # Copying to the /usr/share/icons/ and changing name to "Suru++ 20"
-    cp -r "${srcdir}"/suru-plus "${pkgdir}"/usr/share/icons/Suru++\ 20
-
-    find ${pkgdir}/usr -type f -exec chmod 644 {} \;
-    find ${pkgdir}/usr -type d -exec chmod 755 {} \;
-
-    # Removing unncessary .directory files
-    find ${pkgdir}/usr -type f -name '.directory' -delete
+pkgver() {
+    cd ${pkgname/-git/}
+    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
+}
 
-    # Deleting unneeded files
-    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/.git
-    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/.gitignore
-    rm -r "$pkgdir"/usr/share/icons/Suru++\ 20/*.md
-    rm -R "$pkgdir"/usr/share/icons/Suru++\ 20/images
-    rm -R "$pkgdir"/usr/share/icons/Suru++\ 20/templates
+package() {
+    install -d $pkgdir/usr/share/icons/Suru\ ++
+    cp -r ${pkgname/-git/}/* $pkgdir/usr/share/icons/Suru\ ++/
 }
2 Likes

The files .md and the folders images and templates are unnecessary and need to be removed. Can I use the original commands but modified? See

rm $pkgdir/usr/share/icons/Suru\ ++/*.md
rm -r $pkgdir/usr/share/icons/Suru\ ++/images
rm -r $pkgdir/usr/share/icons/Suru\ ++/templates

Might as well do this properly. I’ve opened a PR to add a Makefile to make it possible to run

make PREFIX=$pkgdir install

instead of faffing about in the PKGBUILD. It also makes it easier for other distros to package.

2 Likes

Inside the package()?

I created the new version tag: https://github.com/gusbemacbe/suru-plus/releases/tag/v20.3.1.

OK, now that’s been merged give me a moment to fix up the PKGBUILD.

# Contributor: Daniel Miranda (dmiranda)
# Contributor: Fabio ‘Lolix’ Loli <lolix at disroot dot org>
# Maintainer: Gustavo Costa (gusbemacbe)

pkgname=suru-plus-git
pkgver=20.3.1             
pkgrel=1
pkgdesc="Suru++ 20 — A cyberpunk, elegant, futuristic and modern third-party icons theme!"
arch=('any')
url="https://github.com/gusbemacbe/${pkgname/-git/}"
license=('GPL3')
changelog=CHANGELOG
makedepends=('git')
conflicts=(${pkgname/-git/})
provides=(${pkgname/-git/})
source=("git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    git -C ${pkgname/-git/} describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

package() {
    make -C ${pkgname/-git/} PREFIX="$pkgdir"/usr install
}
2 Likes

Thank you a lot. It worked everything without unnecessary folders. I have credited you.

Don’t remove !strip option from icon and theme pkgbuilds, it saves build time

you can watch it packaging obsidian-icon-theme with and without that option on a low powered machine

Hi @Lolix, if Jonathan agrees and you think it is necessary, please advice me that I will update the PKGBUILD.

Are you certain strip doesn’t provide any benefit for a theme?

Build time shouldn’t be a concern for packaging. For example, running tests takes a lot of time but is still a good thing to do.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.