Ubuntu PPA
Resources
- Ask Ubuntu - How do I Create a PPA?
- Launchpad - Login
- Launchpad - Homepage
- Launchpad Help - PPA
- Launchpad Help - Building a Source Package
- Ubuntu Packaging Documentation - A: 0. Overview
- Ubuntu Packaging Documentation - A: 2. Getting Setup
- Ubuntu Packaging Documentation - A: 6. Packaging New Software
- Ubuntu Packaging Documentation - KB: 2. Basic Overview of the Debian Directory : the debian files - what is there and how to manage them
- Debian Dev Manuals
- Debian Dev Manuals - NMG: 4. Required Files Under the Debian Directory : specification of all of the fields in the control file
- Debian Dev Manuals - MG: 4. A Simple Example : simple makefile project example
- Debian Dev Manuals - MG: 8. More Examples : many other examples (including a no makefile example)
- https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html
- Simple Packaging Tutorial : make a deb for a single script, then builds on that
- CMake DebSourcePPA : with an example project using it here
Creating the PPA
- Login to launchpad and add SSH keys for your computers
- Sign the Ubuntu Code of Conduct
Setup on a New PC
# Required build tools are mostly all under meta-package packaging-dev sudo apt-get install packaging-dev python-stdeb python3-stdeb # If you need to create the key, follow the instructions in 2. Getting Setup # Or import your private/public key, e.g. to quickly import the public key # (you'll have to get the private key separately so you can do signing) gpg --keyserver keyserver.ubuntu.com --recv 46301634 # Get pbuilder ready for distro=xenial pbuilder-dist xenial create # Bazaar connected to launchpad bzr whoami "Daniel Stonier <d.stonier@gmail.com>" bzr launchpad-login stonier # Environment Variables export DEBFULLNAME="Daniel Stonier" export DEBEMAIL="d.stonier@gmail.com" # My ppas sudo apt-add-repository ppa:d-stonier/snorriheim gpg --export --armor 46301634 | sudo apt-key add - && sudo apt-get update
Python
Resources
Method
# Download from pip pip download yujin_tools # Build the source distribution folder (this sets unstable->xenial in debian/changelog) py2dsc --suite xenial yujin_tools*.tar.gz # Sign it cd deb_dist/yujin-tools*/debian; debuild -S -sa # Upload cd deb_dist; dput ppa:d-stonier/snorriheim yujin-tools_*_source.changes
Successfully uploaded packages - NOT
Beware of the dput command telling you that it has successfully uploaded packages. It actually fails for many reasons and you will get an email within 15mins with the actual response to this command.
Other
- Create a stdeb.cfg and use with py2dsc --extra-cfg-file stdeb.cfg yujin_tools*.tar.gz
- PPA builds always run dh_auto_test - make sure you have Build-Depends in stdeb.cfg to support this
- If the tests are broken (frequently the case for ros packages because they don't install all test files), would be nice to disable tests, but no way that I know of with stdeb yet.
- Might be able to do a bzr builddeb -S and push as per the packaging new software guide after generating the source distribution with py2dsc
Re-Releasing on Other Distros
- Goto Packages in Snorriheim
- Goto Copy Packages (link at the top right-ish)
- Select the package, Select This PPA, Select a different Destination, Select Copy Binaries
- Be froody
CMake
The dh builder is able to automagically recognise a cmake project so just get the cmake project sources sitting along with the debian subfolder and bob's your uncle. Some magic for setting cmake variables though.
#!/usr/bin/make -f %: dh $@ override_dh_auto_configure: dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/opt/snorriheim
Note that installing to /opt is forbidden by ubuntu ppa's.
Debian Files
To generate some example files, run dh_make -f <source tarball>, or better still, run bzr dh-make as in the Packaging New Software (Ubuntu Packaging Guide) which is more likely to get you something exactly correct.
I'm custom hacking things with dpkg-buildpackage and debbuild right now to be both more flexible and to get a better understanding of how it works. However, it may have been better to strictly follow the bzr/udd/ubuntu way since there are alot of mechanisms you've got to get right (original tarballs, debian revision numbers) and that also has a great lintian check as well as (sandboxed?) pbuilder method. Another option is to follow the git way, like OSRF did.
Control
Great references are in the debian developer manual and ubuntu debian folder overview.
- Source Fields
- Priority - all my packages are optional
- Section - use lower case version of those listed on the ubuntu packages web site (xenial)
- Standards-Version - get from the bottom of the debian policy guide.
- Binary Fields
Compat
You'll need this now, it specifies the version of debhelper you need. Just populate it with a '9'
Rules
Instruct on how to build the package. Typically the dh builder will auto-detect your package - autotools, cmake, make, ... and create appropriate targets itself and so all you need here is:
#!/usr/bin/make -f %: dh $@
But you can override individual targets by creating override_dh_auto_xyz targets of your own. A common case is overriding the install rule so that it does not go to /usr/local e.g.:
#!/usr/bin/make -f %: dh $@ override_dh_auto_install: $(MAKE) install PREFIX=$(CURDIR)/debian/ttygif/usr
Changelog
There is a useful tool called dch that can be run from the parent directory of the debian folder. For more information, read the changelog section of the ubuntu debian control guide.
# First time dch --create # Incrementing the debian revision number and pre-pending (the vendor thing is broken, but this avoids an ubuntu suffix) dch -i --distribution=xenial --urgency=low --increment --vendor=override