cross-posted from: https://lemmy.ml/post/53225512

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:

  • Azzu@leminal.space
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    17 days ago

    Huh, but it does say in VCS package guidelines?

    If the resulting package is different after changing e.g. the dependencies, URL or sources — update pkgver to the latest version.

    It is recommended to have following version format: RELEASE.rREVISION

    And regarding the function:

    The pkgver autobump is now achieved via a dedicated pkgver() function. This allows for better control over the pkgver, and maintainers should favor a pkgver that makes sense. To use pkgver(), you still need to declare the pkgver variable with the most recent value. makepkg will invoke function pkgver(), and update variable pkgver accordingly.

    So yeah, you just put the output of pkgver() into the pkgver variable initially, and then each repo update automatically updates the pkgver variable, as far as I understand it.

    • thingsiplay@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      17 days ago

      pkgver= is the variable to manually update and use that matches the version of the program you want to install. However, if you are downloading and building from source, then instead the variable pkgver= the function pkgver() is used to determine the version at build time with the AUR.

      I understand that part. But my question is, what do I do with pkgver= variable then? It sounds like it is completely ignored when building from -git. But looking at all the other -git based AUR package build scripts, they have a version number in the variable. I don’t know why and what I’m supposed to write there at an initial upload.

      • Azzu@leminal.space
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        17 days ago

        Because it shows when doing a diff. Don’t need to rebuild if pkver variable (i.e. the last version that was built) is equal to the output of the pkgver() function (i.e. the new version that would now be built).

        • thingsiplay@lemmy.mlOP
          link
          fedilink
          arrow-up
          1
          ·
          17 days ago

          With -git, its practically always different. But besides that, when pkgver() function is used, then it compares to the version in my system, not the variable to determine if its newer. But what I’m supposed to write into the variable pkgver= into?