wiki:DebianUbuntuPackaging

Version 53 (modified by martinl, 9 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-unstable/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 Wily - 15.10):

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

Build new package

Clone Git repository

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

and checkout selected branch (example for Ubuntu Wily - 15.10):

export DIST=wily
git checkout ubuntugis/$DIST

Update changelog by

dch -i

a put lines (example for GRASS GIS 7.0.3RC1):

grass (7.0.3~rc1-1~wily1) wily; urgency=medium

  * New upstream release candidate.

 -- [commiters_name] <[commiters_email]>  Tue, 12 Jan 2016 20:57:45 +0100

Commit changes to Git repository:

git commit -am"New upstream release candidate (7.0.3RC1)"
git push

Build package:

gbp buildpackage --git-pbuilder --git-dist=${DIST}-ubuntugis --git-debian-branch=ubuntugis/$DIST

Sign created package

debsign ../grass_7.0.3~rc1-1~wily1_<architecture>.changes

and upload to Launchpad:

dput ppa:grass/grass-stable ../ggrass_7.0.3~rc1-1~wily1_<architecture>.changes

Tag release version in Git repository:

git tag ubuntugis-wily/7.0.3RC1
git push --tags

Notes

Create new branch for Ubuntu version
git checkout -b ubuntugis/wily experimental
git push origin ubuntugis/wily

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.