Hacking:Common packaging mistakes

From ParabolaWiki
Jump to: navigation, search

Here's a list of common packaging mistakes.

  • It's become convention to indent with two spaces. Not doing that isn't a mistake per se, but consistency is nice.
  • Make sure you have a line beginning with "# Maintainer: ". Also having things like "# Maintainer (AUR): " is fine, but "# Maintainer (Parabola): " isn't a substitute for the plain version. A few packages do that; it's a mistake (popularized by lukeshu).
  • Every instance of srcdir and pkgdir should be double-quoted.
  • Network access cannot be used during build() or package(). (This is enforced by libremakepkg).
  • If a package is named in depends, then it does not need to be mentioned in makedepends.
  • Packages in 'base' (as well as 'base' itself) should not mentioned in the depends array of any package. 'base' is expected to be installed, as a requisite of any supported Parabola system. 'base' is in fact, the only mandatory requirement of "The Standard Parabola System". However, to accommodate bootstrapping new arches, the individual 'base' packages may need to be required in the makedepends array of packages, which themselves will be part of base. Other packages should not require them explicictly.
  • Similarly, packages in 'base-devel' (as well as 'base-devel' itself) should not mentioned in the makedepends array of any package, unless the package itself will be part of base-devel. However, other packages may need to require them in the depends array; because base-devel is not a mandatory part of the standard system.
  • The files in install= and changelog= should not be mentioned in source=()
  • When creating a replacement for a package in a group, don't have the replacement be in the same group. Groups cannot contain conflicting members.
  • The best practices for VCS packages have changed quite a bit.
    • In order for Parabola packages to be reproducible, we prefer to avoid volatile VCS sources, such as those the Arch naming convention: foo-git. Versioned, release source-balls are always preferred. If the upstream only publishes via VCS, and does not add version tags, ask the upstream to add them, so that the work-arounds below can be removed from the PKGBUILD eventually.
    • The no-no's:
      • Don't use _gitroot and similar "underscore" variables (even though they are recommended in /usr/share/pacman/). They are deprecated in Arch as of pacman 4.1.
      • Don't have 'SKIP' entries in md5sums, except for *.sig and *.asc files.
        • That means don't use makepkg 4.1 VCS URLs directly in source=(). Put them in mksource() or a SRCBUILD instead. (TODO: Both mksource() and SRCBUILD may be obsoleted soon, in favor of a fully integrated mechanism, which simply creates the source-ball after prepare() runs, rather than before.)
      • Don't track an unversioned VCS "branch". Instead reference a specific commit or tag, preferring versioned tags.
      • Don't require network during build().
      • Don't do other over-complicated things, generally.
    • Luke's current recommendation:
      • Make sure you have libretools installed (If you are a packager, you should have done this anyway.)
      • set source=("https://repo.parabolagnulinux.org/other/$pkgname/$pkgname-$pkgver.tar.gz") (use other/~username/ for personal repos) librefetch will know to automatically generate the file for you if it doesn't exist.
      • set mksource=("$pkgname-$pkgver::VCS-URL")
      • set mkmd5sums=('SKIP')
      • set md5sums with makepkg -g like any other package.
      • librestage/librerelease will also upload the generated source file for you.