wiki:UbuntuPpa
Last modified 7 years ago Last modified on 08/03/11 14:18:35

Ubuntu Personal Package Archives (PPA)

Sometimes, such as when updating a community-supported package, it's useful to build your own Ubuntu packages and put them on the web. The Ubuntu Launchpad infrastructure supports this through Personal Package Archives (PPA).

Prerequisites:

  1. Create a GnuPG key if you don't already have one, and upload it to the Ubuntu keyserver with a command like gpg --send-keys --keyserver keyserver.ubuntu.com $GPGKEY
  2. Sign up for Launchpad, use your GPG key to sign the Ubuntu Code of Conduct, and activate a PPA on your Launchpad profile page

After you activate the PPA, it can take about an hour to show up, so now's a good time to install build tools and work on building your package. Much of this information is condensed from https://wiki.ubuntu.com/PackagingGuide/Recipes/Debdiff and https://help.launchpad.net/Packaging

apt-get -y install bzr-builddeb devscripts build-essential wget fakeroot cdbs patchutils debhelper
bzr whoami "Joshua Daniel Franklin <joshuadfranklin@yahoo.com>"
bzr launchpad-login joshuadfranklin
export DEBFULLNAME='Joshua Daniel Franklin' 
export DEBEMAIL='joshuadfranklin@yahoo.com'

mkdir src
cd src
apt-get source opensaml2
# creates opensaml2-2.3 opensaml2_2.3-1build2.dsc 
cd opensaml2-2.3
# edit files in opensaml2, or apply a patch
patch -p0 < ~/$SOME_PATCH

Next use dch to edit the changelog, adding "ppa1" to version number based on the guidelines, and then dbuild to generate the necessary files and sign the package:

dch -i
debuild -S
cd ..
debdiff opensaml2_2.3-1build2.dsc opensaml2_2.3-1build2ppa1.dsc  > mydebdiff
# You can attach the debdiff to a bug report or send it to the relevant person. 
# This will prompt for GnuPG passphrase 
dput ppa:joshuadfranklin:ppa opensaml2_2.3-1build2ppa1_source.changes 

After uploading the the PPA, the package will build after a while and you can install it. You'll need to add the PPA key to your system

# find Fingerprint at https://launchpad.net/~joshuadfranklin/+archive/ppa under "Technical Details"
gpg --recv-keys 75BA62B3B973066B
gpg --export --armor 75BA62B3B973066B | apt-key add -
# create the sources.list entry
cat <<EOF > /etc/apt/sources.list.d/joshuadfranklin-ppa.list
deb http://ppa.launchpad.net/joshuadfranklin/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/joshuadfranklin/ppa/ubuntu lucid main
EOF
apt-get update
apt-get upgrade

Example output:

debuild -S
 dpkg-buildpackage -rfakeroot -d -us -uc -S
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: set CFLAGS to default value: -g -O2
dpkg-buildpackage: set CPPFLAGS to default value: 
dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: source package opensaml2
dpkg-buildpackage: source version 2.3-1build2ppa1
dpkg-buildpackage: source changed by Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
 fakeroot debian/rules clean
dh_testdir
dh_testroot
rm -f configure-stamp build-stamp install-stamp
[ ! -f Makefile ] || /usr/bin/make distclean
dh_clean config.guess config.sub
 dpkg-source -b opensaml2-2.3
dpkg-source: info: using source format `1.0'
dpkg-source: info: building opensaml2 using existing opensaml2_2.3.orig.tar.gz
dpkg-source: info: building opensaml2 in opensaml2_2.3-1build2ppa1.diff.gz
dpkg-source: warning: ignoring deletion of file config.sub
dpkg-source: warning: ignoring deletion of file config.guess
dpkg-source: warning: the diff modifies the following upstream files: 
 saml/signature/ContentReference.cpp
 saml/signature/SignatureProfileValidator.cpp
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: info: building opensaml2 in opensaml2_2.3-1build2ppa1.dsc
 dpkg-genchanges -S >../opensaml2_2.3-1build2ppa1_source.changes
dpkg-genchanges: warning: the current version (2.3-1build2ppa1) is smaller than the previous one (2.3-2+squeeze1)
dpkg-genchanges: not including original source code in upload
dpkg-buildpackage: source only, diff-only upload (original source NOT included)
Now running lintian...
warning: lintian's authors do not recommend running it with root privileges!
W: opensaml2 source: debhelper-but-no-misc-depends opensaml2-tools
W: opensaml2 source: debhelper-but-no-misc-depends libsaml2-doc
W: opensaml2 source: debhelper-but-no-misc-depends libsaml2-dev
W: opensaml2 source: debhelper-but-no-misc-depends opensaml2-schemas
W: opensaml2 source: missing-debian-source-format
W: opensaml2 source: out-of-date-standards-version 3.8.3 (current is 3.8.4)
Finished running lintian.
Now signing changes and any dsc files...
 signfile opensaml2_2.3-1build2ppa1.dsc Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
You need a passphrase to unlock the secret key for
user: "Joshua Daniel Franklin <joshuadfranklin@yahoo.com>"
1024-bit DSA key, ID 65E64156, created 2006-08-23

                  
 signfile opensaml2_2.3-1build2ppa1_source.changes Joshua Daniel Franklin <joshuadfranklin@yahoo.com>

You need a passphrase to unlock the secret key for
user: "Joshua Daniel Franklin <joshuadfranklin@yahoo.com>"
1024-bit DSA key, ID 65E64156, created 2006-08-23              
Successfully signed dsc and changes files


dput ppa:joshuadfranklin:ppa opensaml2_2.3-1build2ppa1_source.changes 
Checking signature on .changes
gpg: Signature made Thu 28 Jul 2011 02:57:34 PM PDT using DSA key ID 65E64156
gpg: Good signature from "Joshua Daniel Franklin <joshuadfranklin@yahoo.com>"
Good signature on /src/opensaml2_2.3-1build2ppa1_source.changes.
Checking signature on .dsc
gpg: Signature made Thu 28 Jul 2011 02:57:30 PM PDT using DSA key ID 65E64156
gpg: Good signature from "Joshua Daniel Franklin <joshuadfranklin@yahoo.com>"
Good signature on /src/opensaml2_2.3-1build2ppa1.dsc.
Uploading to ppa (via ftp to ppa.launchpad.net):
  Uploading opensaml2_2.3-1build2ppa1.dsc: done.
  Uploading opensaml2_2.3-1build2ppa1.diff.gz: done.
  Uploading opensaml2_2.3-1build2ppa1_source.changes: done.
Successfully uploaded packages.