I want to create and upload an AUR package. For context, I did that years ago for specific releases, but now I want to create a new package that focuses on upstream Git without specific releases.

What do I write to the pkgver= value? Do I just take the latest version there? Because it is downloading with git clone the version number will not change and the PKGBUILD script will compare pkgver() instead. So what is the purpose of pkgver= for when downloading and building from Git directly? Looking at examples from other existing packages, they all have a number there. But its mostly outdated, so I don’t get it.

pkgname=thename-git
_pkgname="$(pkgname%-git}"
pkgver=???

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

I am reading and researching, but need some assistance for this question. Currently reading the Archwiki:

  • SavvyBeardedFish@reddthat.com
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    Initially just set it to anything, then the first time you run makepkg it will update to the correct/latest version according to your pkgver() function.

    Something else I see a lot of people get wrong: you only need to manually push the latest pkgver string when you make changes to the PKGBUILD, otherwise just leave it as-is, since it will auto-update locally when people run makepkg

    • thingsiplay@lemmy.mlOP
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      For now I just put the current version string and uploaded it. Man I forgot how to do all of that stuff, that was stressful with all of the other issues I had.

      you only need to manually push the latest pkgver string when you make changes to the PKGBUILD

      Not really. If the version of the program does not change, but you make changes to the PKGBUILD, then you have to change pkgrel instead. pkgver change only if the application or library you try to build and install changes its version, pkgrel if the PKGBUILD is changed. https://wiki.archlinux.org/title/PKGBUILD#Version

      • SavvyBeardedFish@reddthat.com
        link
        fedilink
        arrow-up
        2
        ·
        3 days ago

        If the version of the program does not change, but you make changes to the PKGBUILD, then you have to change pkgrel instead.

        Sure, that’s true! However, typically (but not always!) in git packages there’s usually a new commit whenever you need to bump the pkgver so your pkgrel wouldn’t need a bump then. pkgrel bump is only when it’s the same (exact) version :)