# Ubuntu PPA packaging instructions
How to upload to https://launchpad.net/~pulpproject/+archive/ubuntu/pulp-ci
## Initial Account Setup
Ask a member to add you to the pulpproject group on Luanchpad
Upload your GPG key. This is how you are authenticated during package upload time. (technically after the upload succeeds)
https://launchpad.net/%7Emikedep333/+editpgpkeys
## Initial Container Setup (ubuntu:focal-ppa-dev)
```
docker pull ubuntu:focal
docker run -it ubuntu:focal /bin/bash
apt update
# Avoid interactive prompt in apt
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
apt install -y ubuntu-dev-tools
apt clean all
# Customize the remainder for your user account
cp -a /etc/skel /home/mdepaulo
chown -R 105442:105442 /home/mdepaulo
echo 'export DEBFULLNAME="Mike DePaulo"' >> /home/mdepaulo/.bashrc
echo 'export DEBEMAIL="mikedep333@redhat.com"' >> /home/mdepaulo/.bashrc
echo 'export USER="mdepaulo"' >> /home/mdepaulo/.bashrc
exit
docker ps --all | head -n10
# Look at the latest stopped container for its nickname
docker commit elated_wiles ubuntu:focal-ppa-dev
```
## Per-container usage:
On another terminal, this may be necessary to unlock the gpg key, without the keyboard input being broken, and the prompt appearing on the wrong terminal:
```
echo "1234" | gpg --no-use-agent -o /dev/null --local-user mikedep333@redhat.com -as -
```
You may also need this for the bind mounts.
```
setenforce 0
```
(otherwise, the container will complain that it does not know who you are in the bash prompt, as it cannot read the /etc/passwd, etc files. It will break the debian commands such as `backportpackage`
Start the container:
```
docker run -ti -u $(id -u):$(id -g) -v ${HOME}/.gnupg/:${HOME}/.gnupg/:ro -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v /etc/shadow:/etc/shadow:ro -v /run/user/$(id -u)/:/run/user/$(id -u)/:ro ubuntu:focal-ppa-dev bash
```
## Backporting a package
Let's backport meson (source package name) from groovy (20.10).
```
backportpackage --key mikedep333@redhat.com -s groovy -d focal -u ppa:pulpproject/pulp-ci meson
```
If everything went well:
```
mdepaulo@8d17904524b5:~$ backportpackage --key mikedep333@redhat.com -s groovy -d focal -u ppa:pulpproject/pulp-ci meson
Downloading meson_0.55.3.orig.tar.gz from archive.ubuntu.com (1.660 MiB)
Downloading meson_0.55.3-1.debian.tar.xz from archive.ubuntu.com (0.013 MiB)
dpkg-source: info: extracting meson in meson-focal
dpkg-source: info: unpacking meson_0.55.3.orig.tar.gz
dpkg-source: info: unpacking meson_0.55.3-1.debian.tar.xz
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: applying 1-disable-openmpi.patch
dpkg-source: info: applying 2-disable-rootdir-test.patch
dch warning: new version (0.55.3-1~ubuntu20.04.1~ppa1) is less than
the current version number (0.55.3-1).
dpkg-buildpackage -us -uc -ui -S -nc -sa -v0.53.2-2ubuntu2
dpkg-buildpackage: info: source package meson
dpkg-buildpackage: info: source version 0.55.3-1~ubuntu20.04.1~ppa1
dpkg-buildpackage: info: source distribution focal
dpkg-buildpackage: info: source changed by Mike DePaulo <mikedep333@redhat.com>
dpkg-source --before-build .
dpkg-buildpackage: warning: building a source package without cleaning up as you asked; it might contain undesired files
dpkg-source -b .
dpkg-source: warning: Version number suggests Ubuntu changes, but Maintainer: does not have Ubuntu address
dpkg-source: warning: Version number suggests Ubuntu changes, but there is no XSBC-Original-Maintainer field
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building meson using existing ./meson_0.55.3.orig.tar.gz
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: building meson in meson_0.55.3-1~ubuntu20.04.1~ppa1.debian.tar.xz
dpkg-source: info: building meson in meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc
dpkg-genbuildinfo --build=source
dpkg-genchanges -sa --build=source -v0.53.2-2ubuntu2 >../meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes
dpkg-genchanges: warning: 'since' option specifies non-existing version '0.53.2-2ubuntu2'
dpkg-genchanges: warning: use newest entry that is earlier than the one specified
dpkg-genchanges: warning: the current version (0.55.3-1~ubuntu20.04.1~ppa1) is earlier than the previous one (0.55.3-1)
dpkg-genchanges: info: including full source code in upload
dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
signfile dsc meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc mikedep333@redhat.com
fixup_buildinfo meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc meson_0.55.3-1~ubuntu20.04.1~ppa1_source.buildinfo
signfile buildinfo meson_0.55.3-1~ubuntu20.04.1~ppa1_source.buildinfo mikedep333@redhat.com
fixup_changes dsc meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes
fixup_changes buildinfo meson_0.55.3-1~ubuntu20.04.1~ppa1_source.buildinfo meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes
signfile changes meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes mikedep333@redhat.com
Successfully signed dsc, buildinfo, changes files
Please check meson 0.55.3-1~ubuntu20.04.1~ppa1 in file:///tmp/backportpackage-0kclnvsw carefully!
Do you want to upload the package to ppa:pulpproject/pulp-ci [Y|n]? Y
$USER not set, will use login information.
Checking signature on .changes
gpg: /tmp/backportpackage-0kclnvsw/meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes: Valid signature from 6636DDDD51745404
Checking signature on .dsc
gpg: /tmp/backportpackage-0kclnvsw/meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc: Valid signature from 6636DDDD51745404
Package includes an .orig.tar.gz file although the debian revision suggests
that it might not be required. Multiple uploads of the .orig.tar.gz may be
rejected by the upload queue management software.
Uploading to ppa (via ftp to ppa.launchpad.net):
Uploading meson_0.55.3-1~ubuntu20.04.1~ppa1.dsc: done.
Uploading meson_0.55.3.orig.tar.gz: done.
Uploading meson_0.55.3-1~ubuntu20.04.1~ppa1.debian.tar.xz: done.
Uploading meson_0.55.3-1~ubuntu20.04.1~ppa1_source.buildinfo: done.
Uploading meson_0.55.3-1~ubuntu20.04.1~ppa1_source.changes: done.
Successfully uploaded packages.
```