update-package.md

We need to update an AUR package (or multiple).

Code style:

  • Language(s): PKGBUILD is bash; .install is POSIX-sh–compatible functions
  • Indent 2 spaces; UTF-8; LF endings; no trailing whitespace
  • Quote variables: use double quotes around "$pkgdir" "$srcdir" and paths
  • Strings: single quotes for literals; double quotes when expanding vars
  • Arrays: arch, license, provides, conflicts use ( ... ) syntax
  • Functions: prepare(), build(), check(), package(); only define needed ones
  • No sudo, networking, or user config in build/package functions
  • Use install -Dm755 for binaries; set exact modes explicitly
  • Checksums: keep hashes in sync with sources
  • Keep .SRCINFO in lockstep with PKGBUILD; don’t commit build artifacts

During update, follow this strict workflow. If a planning or todo tool is available, fill it out in detail with these steps; you might get interrupted and have to pick up where you left off based on that todo/planning tool's output.

  1. List the contents of your current working directory to see what I've already done.
    • If you see text files, read them.
    • If you see directories, list their contents.
      • If by its contents, it seems like the repository of the project we're packaging, ignore it for now.
    • If there are sub-directories of your current working directory with suffixes like -bin or -git, we're actually going to be updating multiple AUR packages for the same piece of software.
      • -git packages clone the primary branch (main, master, trunk, etc.) and build and install the software from that source. We do not specify versions for these packages; updpkgsums determines the version and edits the PKGBUILD.
      • -bin packages download the project-built and project-distributed binary and install that.
      • Packages without a suffix download the nearest thing to a release archive we can find and build/install that source.
    • There are no sub-directories of your current working directory, we're only updating one package. Look to your current working directory to determine whether we're creating a suffix-less package, or one with -git or -bin.
  2. We're upgrading to version $VERSION. Read the PKGBUILD(s), and then edit the version number for non-git packages.
  3. Update checksums and/or versions with updpkgsums.
  4. Consider the diagnostics and present all issues to me, whether you think they're relevant or not. Include reasoning why those issues are relevant, or why they're not. We'll work on any genuine issues until they're resolved before proceeding.
  5. Install dependencies and build/install the package(s) by giving me a code block of makepkg -Ccsi commands I can copy/paste. If there are multiple packages, include cd prior to makepkg. We'll work on any issues that arise during this step until they're resolved.
  6. After I build the packages, run namcap on ./package-name-*.pkg.tar.zst to lint them. Again, report all the issues to me and we'll work on them before continuing.
  7. Generate each package's .SRCINFO by, again, giving me a series makepkg --printsrcinfo > .SRCINFO. If just one package, no cd is necessary. Just makepkg.
  8. Clean all artifacts with git clean -fdx
  9. If PKGBUILD and .SRCINFO are the only two files you've modified during this session, git add and git commit them. If there are other files you've modified that are tracked by git, please show me the diff and ask which you should commit.

If anything other than pkgver is edited during the course of this flow, make sure to re-run shellcheck and namcap if appropriate.