|
|
(39 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | | + | #REDIRECT [[swhdocs:sysadm/deployment/howto-debian-packaging.html]] |
− | == Creating a package for deployment ==
| |
− | | |
− | <tt>swh-environment</tt> contains a script, <tt>bin/make-package</tt>, which generates a Debian package from a given Git repository, and uploads it to our internal repository targeting suites unstable and jessie-backports.
| |
− | | |
− | This assumes that the '''current''' (''HEAD'') revision has been tagged with a version '''v<foo>''' (e.g. v0.0.4), and that the repository contains the debian metadata. (i.e. <tt>debian/{copyright,control,changelog.rules,source/format,compat}</tt>).
| |
− | | |
− | Example:
| |
− | $ git tag -as -m 'version 0.0.42' v0.0.42
| |
− | $ bin/make-package -b -u swh-core
| |
− | | |
− | == Package repository ==
| |
− | | |
− | A package repository is available on http://debian.internal.softwareheritage.org/.
| |
− | | |
− | Unstable / Testing :
| |
− | deb [trusted=yes] http://debian.internal.softwareheritage.org/ unstable main
| |
− | | |
− | Stable / Jessie :
| |
− | deb [trusted=yes] http://debian.internal.softwareheritage.org/ jessie main
| |
− | | |
− | This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).
| |
− | | |
− | === Uploading packages ===
| |
− | | |
− | Packages are added to the repository using <tt>reprepro -vb /srv/softwareheritage/repository processincoming incoming</tt>.
| |
− | | |
− | For packages to be accepted, they need to be :
| |
− | # A changes file uploaded to <tt>/srv/softwareheritage/repository/incoming</tt>
| |
− | # Targetted at one of the supported distributions (unstable, unstable-swh, jessie, jessie-backports, jessie-backports-swh)
| |
− | # Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders
| |
− | | |
− | == Build Environment setup ==
| |
− | | |
− | <tt>bin/make-package.sh</tt> uses sbuild for package construction. You therefore need to setup sbuild before being able to use it.
| |
− | | |
− | === sbuild setup ===
| |
− | | |
− | # Install the package
| |
− | sudo apt-get install sbuild
| |
− |
| |
− | # Add your user to the sbuild group, to allow him to use the sbuild commands
| |
− | sudo sbuild-adduser $USER
| |
− | # You have to logout and log back in
| |
− |
| |
− | # Prepare chroots
| |
− | sudo mkdir /srv/chroots
| |
− | sudo mkdir /srv/chroots/var
| |
− |
| |
− | # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition
| |
− | sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/
| |
− | sudo rm -r /var/lib/schroot
| |
− | sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot
| |
− |
| |
− | sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/
| |
− | sudo rm -r /var/lib/sbuild
| |
− | sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild
| |
− | # end optionally
| |
− |
| |
− | # Create unstable/sid chroot
| |
− | sudo sbuild-createchroot sid /srv/chroots/sid http://httpredir.debian.org/debian/
| |
− |
| |
− | # Create jessie chroot
| |
− | sudo sbuild-createchroot jessie /srv/chroots/jessie http://httpredir.debian.org/debian/
| |
− |
| |
− | # Create sbuild autosign gpg key (!! needs entropy, consider installing haveged and not worrying about it again)
| |
− | sudo sbuild-update --keygen
| |
− |
| |
− | # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts
| |
− | echo hosts >> /etc/schroot/sbuild/nssdatabases
| |
− | | |
− | === schroot setup ===
| |
− | | |
− | Now that the sbuild base setup is done. You now need to configure schroot to use an overlay filesystem, which will avoid copying the chroots at each build.
| |
− | | |
− | In recent (>= 1.6) versions of schroot, you need to update the configuration (in <tt>/etc/schroot/chroot.d/*-sbuild-*</tt>) with the following directives:
| |
− | | |
− | source-groups=root,sbuild
| |
− | source-root-groups=root,sbuild
| |
− | union-type=overlay
| |
− | | |
− | You should also use this opportunity to add "aliases" to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):
| |
− | | |
− | For unstable:
| |
− | aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild
| |
− | | |
− | For jessie:
| |
− | aliases=stable-amd64-sbuild,stable-backports-amd64-sbuild,jessie-backports-amd64-sbuild,jessie-backports-swh-amd64-sbuild
| |
− | | |
− | ==== dependencies cache ====
| |
− | | |
− | Add the following line to schroot's fstab /etc/schroot/sbuild/fstab
| |
− | to permit reuse of existing fetched dependencies:
| |
− | | |
− | /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0
| |
− | | |
− | ==== Backport on jessie chroot (optional) ====
| |
− | | |
− | Some repository may need backport packages in their dependencies.
| |
− | | |
− | To open the backports in your jessie chroot, add the file /srv/chroots/jessie/etc/apt/sources.list.d/jessie-backports.list with the following content:
| |
− | deb http://ftp.debian.org/debian jessie-backports main
| |
− | | |
− | If your chroot folder is different, check your chroot setup in /etc/schroot/chroot.d/jessie-amd64-sbuild-something (ymmv):
| |
− | grep 'directory=' /etc/schroot/chroot.d/*sbuild* | cut -f2 -d'='
| |
− | | |
− | === environment setup ===
| |
− | | |
− | The Debian tools use a few variables to preset your name and email. Add this to your <tt>.<shell>rc</tt>
| |
− | | |
− | export DEBFULLNAME="Debra Hacker"
| |
− | export DEBEMAIL=debra.hacker@example.com
| |
− | | |
− | Make sure this data matches an uid for your GPG key. Else, you can use the <tt>DEBSIGN_KEYID=<yourkeyid></tt> variable.
| |
− | | |
− | | |
− | [[Category:Software development]]
| |
− | [[Category:System administration]]
| |