VCS PKGBUILD guidelines
From ArchWiki
Article summary |
---|
Creating PKGBUILDs for software managed with version control systems. |
Available in languages |
English |
Related articles |
Arch Build System |
Building Packages in Arch Linux |
Arch Linux User-Community Repository (AUR) |
makepkg |
pacman |
PKGBUILD Tricks |
PKGBUILD Variables |
Guidelines for creating PKGBUILDs for software managed with version control systems.
Prototypes
The abs package provides prototypes for cvs, svn, git and darcs PKGBUILDs. When abs is installed, you can find them in /usr/share/pacman/. A Mercurial prototype can be found below.
Guidelines
- Suffix pkgname with -cvs, -svn or -git where applicable -- this prevents confusion with non-development versions of packages (e.g. fluxbox-svn or fvwm-cvs compared to fluxbox or fvwm).
- When makepkg is run, by default it will check for newer revisions and then update the pkgver in the PKGBUILD. Look at --holdver in man makepkg if you want otherwise. --holdver only works for cvs and svn, which allow checkout of older revisions.
- Check for package conflicts. For example fluxbox-svn will conflict with fluxbox. In this case, you need to use conflicts=('fluxbox').
- Use the provides field so that packages that require the non-VCS package can be installed (provides=('fluxbox')).
- You should AVOID using replaces=... as it generally causes unnecessary problems.
- When using/defining the cvsroot, use anonymous:@ rather than anonymous@ to avoid a password prompt and having to enter a blank password OR use anonymous:password@ if a password is required.
- Though it is often unnecessary to use the pkgrel field when building CVS/SVN/GIT packages (changes to the package are usually often and will be reflected in the pkgver), makepkg will require it.
- Don't forget to include the appropriate VCS tool (cvs, subversion, git, ...) in makedepends=....
- To preserve the integrity of the checked-out code consider copying the original build directory if you have to make edits. For example, having checked out source code to src/$_cvsmod from $startdir you can use:
mkdir src/$_cvsmod-build cd src/$_cvsmod-build ../$_cvsmod/configure
or:
cp -r src/$_cvsmod src/$_cvsmod-build cd src/$_cvsmod-build
- With the introduction of the AUR, it is most important to avoid using backtick execution to create package variables. makepkg will automatically bump the pkgver anyway when building the package (unless --holdver is used).
Mercurial Prototype
# Contributor: Name <youremail@domain.com> pkgname=NAME-hg ... source=() md5sums=() _hgroot="HGURL" _hgrepo="MODENAME" build() { cd $srcdir msg "Connecting to Mercurial server..." if [ -d $_hgrepo ]; then cd $_hgrepo hg pull -u || return 1 msg2 "The local files have been updated" else hg clone $_hgroot $_hgrepo || return 1 msg2 "Mercurial checkout done" fi ...