wiki:DebianUbuntuPackaging

Version 128 (modified by martinl, 8 years ago) ( diff )

--

This page contains notes about Debian and Ubuntu packaging.

Debian

Ubuntu

Launchpad

Requirement to upload packages:

Git workflow using the GRASS specific branches

Set up building environment

Install requirements:

sudo apt-get install git-buildpackage
# 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
<username>     ALL=(root)     NOPASSWD:PBUILDERS
Configuration file

Configuration file for pbuilder (~/.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/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
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-experimental/ubuntu $DIST main"
COMPONENTS="main restricted universe multiverse"

BUILDRESULT=/root/tmp/pbuilder-results
HOOKDIR=/root/pbuilder-hooks
EXTRAPACKAGES="${EXTRAPACKAGES} devscripts gnupg patchutils vim-tiny openssh-client lintian"
ALLOWUNTRUSTED=yes

It's a good idea to configure also lintian pbuilder hook:

mkdir ~/pbuilder-hooks
cp /usr/share/doc/pbuilder/examples/B90lintian ~/pbuilder-hooks/
sed -i 's/lintian -I --show-overrides/& --pedantic -E/; s/^su /##&/; s/^#su /su /' ~/pbuilder-hooks/B90lintian
Create chroot environment

Create specific chroot environment by (example for Ubuntu Xenial - 16.04):

export DIST=xenial
sudo -E cowbuilder --create --distribution=$DIST --basepath=/var/cache/pbuilder/base-${DIST}-ubuntugis-experimental.cow --save-after-login

Build new package

Clone Git repository

mkdir pkg-grass
cd pkg-grass
debcheckout --user <username> --git-track '*' grass
cd pkg-grass/grass

and checkout selected branch (example for Ubuntu Xenial - 16.04):

export DIST=xenial
git checkout ubuntugis/$DIST
export VERSION=7.0.3~rc2
export PATCH=1
export EXP=~exp1

Update tarball (just once):

git checkout pristine-tar
git pull
git checkout ubuntugis/$DIST

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/control debian/control.in debian/gbp.conf 

Update changelog:

# dch -v ${VERSION}-${PATCH}~exp1~${DIST}1
dch -b -v $(dpkg-parsechangelog | grep Version: | awk -F': ' '{print $2}')~${DIST}1 -D ${DIST} -m "Rebuild for ${DIST}."

Commit changes to Git repository:

git commit -am"New upstream release candidate ($VERSION)"

Build package:

gbp buildpackage -S -sa --git-pbuilder --git-dist=${DIST}-ubuntugis-experimental >../log.packager-$DIST 2>&1

Note1: use -sa only when build/uploading first package for GRASS version

Note2: 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 ubuntugis/`echo $VERSION | sed 's/~/./g'`-${PATCH}`echo $EXP | sed 's/~/./g'`.${DIST}1

Upload to Launchpad

Configuration file ~/.dput.cf:

[ubuntugis-experimental]
fqdn = ppa.launchpad.net
method = sftp
incoming = ~ubuntugis/ubuntugis-experimental/ubuntu/
login = <yours-launchpad-id>
allow_unsigned_uploads = 0

Sign created package

debsign ../grass_${VERSION}-${PATCH}${EXP}~${DIST}1_source.changes

and upload to Launchpad:

dput ubuntugis-experimental ../grass_${VERSION}-${PATCH}${EXP}~${DIST}1_source.changes

Push the package:

git push --all --set-upstream
git push --tags

Notes

Create new branch for Ubuntu version

Create a new branch if not exists:

git checkout -b ubuntugis/$DIST debian/`echo $VERSION | sed 's/~/./g'`-${PATCH}.exp1
git push origin ubuntugis/$DIST

Update branch in gbp.conf & Vcs-Git URL, see example.

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
Note: See TracWiki for help on using the wiki.