From PostgreSQL wiki
This page documents the package and repository workflow of apt.postgresql.org.
Almost all packages in the repository are rebuilds of packages in Debian unstable (aka sid). Most packages are rebuilt unmodified, except for a new entry in debian/changelog that adds the ".pgdgNN+X" suffix to the version number.
The reason for the suffix is twofold:
- The added ".pgdg" clearly marks the origin of this package; every .deb file will have ".pgdg" in the filename.
- The "NN+X" part makes sure dist-upgrades work: .pgdg60+1 (squeeze) < .pgdg70+1 (wheezy) < .pgdg+1 (sid), and .pgdg10.4 (lucid) < .pgdg12.4 (precise) < .pgdg14.04 (trusty). (Ubuntu's original spelling of the version numbers is with a leading zero, but we chose not to change the strings we originally started with for lucid an precise.)
All packages are built several times to produce source and binary packages for various distribution (Debian-speak for "release") and architecture combinations. Currently (early 2014) this is (squeeze+wheezy+sid+lucid+precise+trusty)*(amd64+i386) = 12.
All scripts used are maintained on a git repository: http://git.postgresql.org/gitweb/?p=pgapt.git;a=summary. While there is still some old cruft in there, the "jenkins" and "repo" sub directories contain the scripts that are currently used.
Package builds are done in two steps: generation of the source package(s), and building the binary packages.
Source Package Generation
Most packages are built from the VCS that hosts the package for Debian (i.e. Debian/unstable). Some packages use "apt-get source" from unstable instead. From a checkout (or unpacked source package from unstable), the "generate-pgdg-source" script produces a source package (.dsc file). This is usually just the above-mentioned new changelog entry, but a few packages get special tweaks applied here, either unconditionally, or depending on the target distribution (e.g. on lucid, the xz compression support for .deb files is unsupported, so it is removed here using sed/awk).
This step is repeated once per target distribution.
Building Binary Packages
The source packages are then fed to cowbuilder (a pbuilder variant) that builds the binary .deb packages. The script used for this is "build-and-provide-package", slighly patched from the jenkins-debian-glue project. (We don't use the "provide" part of the script, just the "build" part.)
This script also invokes the autopkgtest test suite in debian/tests/*, if the package features one. This is invoked from a pbuilder hook in jenkins/pbuilder-hookdir.
This step is repeated once for every distribution-architecture combination.
Automation in Jenkins
All the above steps are automated using Jenkins.
The repository is a standard "reprepro" setup.