[[TOC]] This page contains notes about Debian and Ubuntu packaging. == Debian == * [https://buildd.debian.org/status/package.php?p=grass Debian Package Auto-Building] * [https://tracker.debian.org/pkg/grass Debian Package Tracker] * [https://salsa.debian.org/debian-gis-team/grass Debian Git Repository] * [https://pkg-grass.alioth.debian.org/policy/ Debian GIS Policy] == Ubuntu == * [https://wiki.ubuntu.com/UbuntuGIS UbuntuGIS] * [https://wiki.ubuntu.com/DevelopmentCodeNames Ubuntu Code Names] === Launchpad === * https://launchpad.net/~grass * [https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-experimental/+packages?field.name_filter=grass UbuntuGIS Experimental] * [https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/+packages?field.name_filter=grass UbuntuGIS Unstable] Requirement to upload packages: * update OpenGPG to http://keyserver.ubuntu.com and then register OpenGPG in your Launchpad account === Git workflow using the GRASS specific branches === ==== Set up building environment ==== Install requirements: {{{ sudo apt-get install git-buildpackage dh-python pkg-kde-tools python3-dev # on Debian also sudo apt-get install ubuntu-archive-keyring }}} ===== Set sudo access ===== Run {{{ sudo visudo }}} and add lines bellow: {{{ # Cmnd alias specification Cmnd_Alias PBUILDERS=/usr/sbin/pbuilder, /usr/sbin/cowbuilder # User privilege specification ALL=(root) NOPASSWD:SETENV:PBUILDERS }}} ===== Configuration file ===== Configuration file for pbuilder (`$HOME/.pbuilderrc`): {{{ # Optionally set the architecture to the host architecture if none set. Note # that you can set your own default (i.e. ${ARCH:="i386"}). ###: ${ARCH:="$(dpkg --print-architecture)"} NAME="$DIST" if [ -n "${ARCH}" ]; then NAME="$NAME-$ARCH" DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") fi BASETGZ="/var/cache/pbuilder/$NAME-base.tgz" DISTRIBUTION="$DIST" BUILDRESULT="/var/cache/pbuilder/$NAME/result/" BUILDPLACE="/var/cache/pbuilder/build/" DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg") MIRRORSITE="http://cz.archive.ubuntu.com/ubuntu/" # OTHERMIRROR="deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu $DIST main" COMPONENTS="main restricted universe multiverse" BUILDRESULT=${HOME}/tmp/pbuilder-results HOOKDIR=${HOME}/pbuilder-hooks EXTRAPACKAGES="${EXTRAPACKAGES} devscripts gnupg patchutils vim-tiny openssh-client lintian" ALLOWUNTRUSTED=yes }}} Define pbuilder hook: {{{ mkdir $HOME/pbuilder-hooks echo "#!/bin/bash set -e apt -y install gnupg apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B827C12C2D425E227EDCA75089EBE08314DF160" > $HOME/pbuilder-hooks/G10extra-apt-keys sudo chmod +x $HOME/pbuilder-hooks/G10extra-apt-keys }}} It's a good idea to configure also lintian pbuilder hook: {{{ cp /usr/share/doc/pbuilder/examples/B90lintian $HOME/pbuilder-hooks/ sed -i 's/lintian -I --show-overrides/& --pedantic -E/; s/^su /##&/; s/^#su /su /' $HOME/pbuilder-hooks/B90lintian sudo chmod +x $HOME/pbuilder-hooks/B90lintian }}} ===== Create chroot environment ===== Create specific chroot environment by (example for Ubuntu Bionic - 18.04): {{{ export DIST=bionic sudo -E cowbuilder --create --distribution=$DIST --basepath=/var/cache/pbuilder/base-${DIST}-ubuntugis-unstable.cow --save-after-login }}} ==== Build new package ==== Clone Git repository {{{ mkdir pkg && cd pkg # debcheckout --user --git-track '*' grass git clone https://salsa.debian.org/debian-gis-team/grass.git cd grass git remote set-url origin --push git@salsa.debian.org:debian-gis-team/grass.git }}} and checkout selected branch (example for Ubuntu Bionic - 18.04): {{{ export BRANCH=ubuntugis export PKGNAME=grass export PATCH=1 export DIST=jammy export VERSION=7.0.3~rc2 export EXP=~exp1 export NUM=1 }}} Update tarball: {{{ git checkout pristine-tar && git pull git checkout ${BRANCH}/${DIST} && git pull --rebase }}} Merge changes related to given tag: {{{ git merge debian/`echo $VERSION | sed 's/~/_/g'`-${PATCH}`echo $EXP | sed 's/~/_/g'` # solve changelog conflict issues git checkout ORIG_HEAD -- debian/gbp.conf }}} Solve conflict in `debian/control` file. Update changelog: {{{ # dch -v ${VERSION}-${PATCH}~exp1~${DIST}${NUM} dch -b -v $(dpkg-parsechangelog | grep Version: | awk -F': ' '{print $2}')~${DIST}${NUM} -D ${DIST} -m "Rebuild for ${DIST}." }}} and compare the debian tag to your branch and inspect the diff in the future, it the only changes you should see are the versions for the dependencies and the git branches. {{{ git add debian/changelog debian/control git diff --cached debian/changelog debian/control }}} Commit changes to Git repository: {{{ git commit -am"Rebuild $VERSION for $DIST" }}} Build package: {{{ gbp buildpackage --git-pbuilder-options=--source-only-changes -sa --git-pbuilder --git-dist=${DIST}-ubuntugis-unstable >../log.packager-$DIST 2>&1 }}} Note1: use `-sa` only when build/uploading first package for GRASS version Note2: replace `--git-pbuilder-options=--source-only-changes` by `-S` when using older versions of `gbp` Note3: all lintian issues of severity info (I:) and higher need to be reviewed and fixed before the upload {{{ cat ../log.packager-$DIST | awk '/+++ lintian output +++/,/+++ end of lintian output +++/' | grep -v ^+++ }}} Tag release version in Git repository: {{{ git tag $BRANCH/`echo $VERSION | sed 's/~/_/g'`-${PATCH}`echo $EXP | sed 's/~/_/g'`.${DIST}${NUM} }}} Push changes: {{{ git push origin --set-upstream ; git push origin --tags }}} ==== Upload to Launchpad ==== Configuration file `~/.dput.cf`: {{{ [ubuntugis-experimental] fqdn = ppa.launchpad.net method = ftp incoming = ~ubuntugis/ubuntugis-experimental/ubuntu/ login = allow_unsigned_uploads = 0 }}} Remove buildinfo lines: {{{ sed -i '/buildinfo/d' ../${PKGNAME}_${VERSION}-${PATCH}${EXP}~${DIST}${NUM}_source.changes }}} Sign created package {{{ debsign ../${PKGNAME}_${VERSION}-${PATCH}${EXP}~${DIST}${NUM}_source.changes }}} and upload to Launchpad: {{{ dput ubuntugis-experimental ../${PKGNAME}_${VERSION}-${PATCH}${EXP}~${DIST}${NUM}_source.changes }}} At the end local files can be removed: {{{ rm -v ../${PKGNAME}_${VERSION}-${PATCH}${EXP}~${DIST}${NUM}* }}} ==== Notes ==== ===== Create new branch for Ubuntu version ===== Create a new branch if not exists: {{{ git checkout -b ${BRANCH}/${DIST} debian/`echo $VERSION | sed 's/~/_/g'`-${PATCH} git push origin ${BRANCH}/${DIST} }}} Update branch in gbp.conf & Vcs-Git URL, see [https://salsa.debian.org/debian-gis-team/grass/-/commit/f92184206d63561bd2e3e85dd566ec25dafcaa1e example]. ===== Copy packages from Expr to Unstable PPA ===== * https://launchpad.net/%7Eubuntugis/+archive/ubuntu/ubuntugis-experimental/+copy-packages === Build package from tarball === '''Warning:''' this part is out-dated, use ''Git workflow using the GRASS specific branches'' instead. {{{ ### Based on notes by Ivan Mincik ### http://lists.osgeo.org/pipermail/grass-dev/2015-January/073444.html export BASE=7 export MVER=70 export CUR=7.0.1RC1-1 export NEW=7.0.1RC2 export PATCH=1 # 1. Download latest existing version of package from Launchpad dget https://launchpad.net/~grass/+archive/ubuntu/grass-stable/+files/grass${BASE}_${CUR}~ubuntu14.04.1.dsc # 2. Prepare working directory with git enabled mkdir pkg-grass cd pkg-grass git init # 3. Import downloaded version of package from Launchpad git-import-dsc ../grass${BASE}_${CUR}~ubuntu14.04.1.dsc # 4. Import new tarball we want to build (cd .. ; wget http://grass.osgeo.org/grass${MVER}/source/grass-${NEW}.tar.gz) git-import-orig ../grass-${NEW}.tar.gz # 5. Optionally, merge Debian packaging bzr branch lp:~grass/grass/grass70_release_debian debian ### RUN IN LOOP # Update Debian changelog dch -i # enter lines like: # grass${BASE} (${NEW}-${PATCH}~ubuntu15.10.1) wily; urgency=medium # ... # grass${BASE} (${NEW}-${PATCH}~ubuntu15.04.1) vivid; urgency=medium # ... # grass${BASE} (${NEW}-${PATCH}~ubuntu14.04.1) trusty; urgency=medium # ... # grass${BASE} (${NEW}-${PATCH}~ubuntu12.04.1) precise; urgency=medium # Update local Git git add debian/changelog git commit -m "Debian changelog update" # Prepare source upload git-buildpackage --git-debian-branch=master --git-builder="debuild -S -sa" --git-ignore-new ### LOOP ENDS HERE # Upload source package for build to Launchpad dput ppa:grass/grass-stable ../grass${BASE}_${NEW}-${PATCH}~ubuntu15.10.1_source.changes dput ppa:grass/grass-stable ../grass${BASE}_${NEW}-${PATCH}~ubuntu15.04.1_source.changes dput ppa:grass/grass-stable ../grass${BASE}_${NEW}-${PATCH}~ubuntu14.04.1_source.changes dput ppa:grass/grass-stable ../grass${BASE}_${NEW}-${PATCH}~ubuntu12.04.1_source.changes }}} === Notes on GDAL-GRASS extension === * [https://salsa.debian.org/debian-gis-team/gdal-grass Debian Git Repository] Clone repository: {{{ git clone https://salsa.debian.org/debian-gis-team/gdal-grass.git cd gdal-grass git remote set-url origin --push git@salsa.debian.org:debian-gis-team/gdal-grass.git }}} Define variables for packaging: {{{ export BRANCH=ubuntu export PKGNAME=libgdal-grass export EXP= export NUM=1 export DIST=jammy export VERSION=1.0.2 export PATCH=1 }}} Update cowbuilder: {{{ sudo -E cowbuilder --update --distribution=$DIST --basepath=/var/cache/pbuilder/base-${DIST}-ubuntugis-experimental.cow --save-after-login }}} Update `debian/control` file (GRASS minimum version: `Build-Depends`). === Notes on QGIS packaging === * [http://anonscm.debian.org/cgit/pkg-grass/qgis.git Alioth.debian.org Git Repository] Clone repository: {{{ git clone https://salsa.debian.org/debian-gis-team/qgis.git cd qgis git remote set-url origin --push git@salsa.debian.org:debian-gis-team/qgis.git }}} Note also dependency outside chroot: pkg-kde-tools Define variables for packaging: {{{ export BRANCH=ubuntu export PKGNAME=qgis export EXP= export NUM=1 export DIST=jammy export VERSION=3.28.10+dfsg export PATCH=1 }}}