You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Debian Packaging

From Wikitech-static
Revision as of 22:57, 4 December 2018 by imported>Effie Mouzeli
Jump to navigation Jump to search

Rebuilding a package

Process to simple repackage a debian package and push it to wmf apt repo.

Example: repackage python-libthumbor for debian stretch

1. Login to boron.eqiad.wmnet

2. As a user run the following to download python-libthumbor's source package:

$ apt-get source libthumbor=1.3.2-0+wmf1

3. We should now have 3 files and 1 directory in our working directory:

 -rw-r--r--  1 user wikidev  15K Jul  6  2016 libthumbor_1.3.2.orig.tar.gz          -> source code of the upstream authors
 -rw-r--r--  1 user wikidev 1.2K Jul  6  2016 libthumbor_1.3.2-0+wmf1.dsc           -> meta file describing which files are around
 -rw-r--r--  1 user wikidev 2.4K Jul  6  2016 libthumbor_1.3.2-0+wmf1.debian.tar.xz -> Debian-specific changes
 drwxr-xr-x  6 user wikidev 4.0K Nov 20 14:11 libthumbor-1.3.2                      -> extracted source package

4. In the libthumbor-1.3.2/debian directory, we may find the following files:

  changelog -> records all changes and defines the version of the package
  compat -> a meta file used for automation of the package build
  control -> defines the binary package names and their relation to other packages (e.g. files needed to build and run the package)
  copyright -> decribes the license and the copyright holders
  docs -> this can be used to declare some files as documentation
  patches -> a directory of code changes done to the original tarball
  rules -> defines the package build process
  source -> a directory defining some details of how the source package is defined
  watch -> a meta file which contains information where to look for new releases (i.e. where to download a newer source)

5. Go to libthumbor-1.3.2

 $ libthumbor-1.3.2
 $ dch -i

6. We should see something like the following:

  libthumbor (1.3.2-0+wmf1+stretch1) stretch-wikimedia; urgency=low

   * Rebuild for stretch

  -- Effie Mouzeli <effie@wikimedia.org>  Tue, 20 Nov 2018 13:42:24 +0000

  libthumbor (1.3.2-0+wmf1) unstable; urgency=low

   * Initial release. (Closes: #783577)

  -- Gilles Dubuc <gilles@wikimedia.org>  Thu, 19 May 2016 15:30:16 +0000

7. Add your new version string, make sure it is a higher version than the previous one 8. Build!

 $ DIST=stretch pdebuild   -> (use packages from stretch repo)
 or 
 $ DIST=stretch-wikimedia pdebuild  -> (include packages from stretch-wikimedia repo)

9. Find the build results

 user@boron:~$ ls  -la /var/cache/pbuilder/result/stretch-amd64/*thum*
 -rw-r--r-- 1 user wikidev 5873 Nov 20 14:12 /var/cache/pbuilder/result/stretch-amd64/libthumbor_1.3.2-0+wmf1+stretch1_amd64.buildinfo
 -rw-r--r-- 1 user wikidev 1797 Nov 20 14:12 /var/cache/pbuilder/result/stretch-amd64/libthumbor_1.3.2-0+wmf1+stretch1_amd64.changes
 -rw-r--r-- 1 user wikidev 2500 Nov 20 14:12 /var/cache/pbuilder/result/stretch-amd64/libthumbor_1.3.2-0+wmf1+stretch1.debian.tar.xz
 -rw-r--r-- 1 user wikidev 1260 Nov 20 14:12 /var/cache/pbuilder/result/stretch-amd64/libthumbor_1.3.2-0+wmf1+stretch1.dsc
 -rw-r--r-- 1 user wikidev 7862 Nov 20 14:12 /var/cache/pbuilder/result/stretch-amd64/python-libthumbor_1.3.2-0+wmf1+stretch1_all.deb

Upload to Wikimedia Repo

1. Login to install1002.wikimedia.org, create a directory and copy

 $ ssh install1002.wikimedia.org
 $ mkdir libthumbor; cd libthumbor
 $ rsync rsync://boron.eqiad.wmnet/pbuilder-result/stretch-amd64/*thum* .

2. Import!

 $ sudo -H bash
 $ reprepro -C main include stretch-wikimedia libthumbor_1.3.2-0+stretch+wmf1_amd64.changes

Note: We split the archives sometimes

3. Do not forget to !log uploads in -operations IRC channel

4. Achievement Unlocked.