<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.softwareheritage.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ardumont</id>
	<title>Software Heritage Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.softwareheritage.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ardumont"/>
	<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/wiki/Special:Contributions/Ardumont"/>
	<updated>2026-04-20T15:11:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2022&amp;diff=1712</id>
		<title>Google Summer of Code 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2022&amp;diff=1712"/>
		<updated>2022-04-08T15:46:36Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Suggest to avoid asking permission to propose a diff&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:GSoCLogo.png|512px]]&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
This page is the central point of information for [[Software Heritage]] participation into the [https://summerofcode.withgoogle.com/ Google Summer of Code] program in 2022.&lt;br /&gt;
&lt;br /&gt;
Google Summer of Code is a program where Google pays students stipends to work over the (northern hemisphere) summer on free software projects such as Software Heritage. Each student works with mentors from the community to complete a software project.&lt;br /&gt;
&lt;br /&gt;
== I want to participate as a student ==&lt;br /&gt;
&lt;br /&gt;
Great!, we are very glad for your interest in contributing to Software Heritage and we are looking forward to work together.&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
The following prerequisites apply to all Software Heritage GSoC projects:&lt;br /&gt;
&lt;br /&gt;
* [https://www.python.org Python 3] is our language of choice, you should be fluent with that language to apply&lt;br /&gt;
* [https://git-scm.com Git] is our version control system of choice, you should be familiar with it to apply&lt;br /&gt;
* basic knowledge in using a CLI&lt;br /&gt;
* additional prerequisites depend on the project you will work on; check project descriptions for details&lt;br /&gt;
&lt;br /&gt;
=== Before you apply ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps you should follow before applying, to make sure you have a good grasp of what we are doing at Software Heritage and how we do it:&lt;br /&gt;
&lt;br /&gt;
# Follow our [https://docs.softwareheritage.org/devel/developer-setup.html developer setup tutorial]: it will make sure you have the source code of our software stack locally available and that you can run unit tests&lt;br /&gt;
# Create an account on our [https://forge.softwareheritage.org development forge]&lt;br /&gt;
# Familiarize yourself with our [[Code review in Phabricator|code review workflow]]&lt;br /&gt;
# Make at least one simple change to any one of our [https://docs.softwareheritage.org/devel/ software components] and submit it as a [https://forge.softwareheritage.org/differential/ diff] for code review, following the above workflow (no need to ask for permissions). [[Easy hacks]] and [https://forge.softwareheritage.org/project/view/20/ Web UI] issues are good options for what to fix, but feel free to submit any patch you think it might be useful.&lt;br /&gt;
&lt;br /&gt;
=== What to include in your application ===&lt;br /&gt;
&lt;br /&gt;
Make sure that your application includes the following information:&lt;br /&gt;
&lt;br /&gt;
* Describe the '''specific project''' you want to work on. What do you want to achieve? Why is it important? Why is it useful for Software Heritage? The project might be one of the project ideas that we have prepared below, or something else entirely that you want to contribute to Software Heritage. Your source code archival pet peeve, surprise us!&lt;br /&gt;
* Detail your '''work plan''': a brief description of how you plan to go about your project, including a list of  ''deliverables'' and a ''timeline'' of when do you expect them to be available.&lt;br /&gt;
* Include a reference to '''the diff''' you submitted before applying (see the &amp;quot;Before you apply&amp;quot; section above).&lt;br /&gt;
&lt;br /&gt;
== Ideas list ==&lt;br /&gt;
&lt;br /&gt;
Below you can find a list of project ideas that are good options for a reasonably-sized GSoC project (check individual idea pages for expected duration and difficulty of each task):&lt;br /&gt;
&amp;lt;DynamicPageList&amp;gt;&lt;br /&gt;
category = Available GSoC task&lt;br /&gt;
ordermethod = sortkey&lt;br /&gt;
order = ascending&lt;br /&gt;
&amp;lt;/DynamicPageList&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also have a list of internship topics below, which you can use for ideas when applying to GSoC with us.&lt;br /&gt;
Expect each internship topic to require 350 hours and to be on the harder side than GSoC-specific tasks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;DynamicPageList&amp;gt;&lt;br /&gt;
category = Available internship&lt;br /&gt;
ordermethod = sortkey&lt;br /&gt;
order = ascending&lt;br /&gt;
&amp;lt;/DynamicPageList&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All project ideas above are just suggestions, don't feel obliged to pick one of them if there is nothing that fits your taste and abilities.&lt;br /&gt;
Feel free to propose something else that you are excited about and that contributes to improve the Software Heritage archive: we will be happy to consider it!&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
&lt;br /&gt;
GSoC students are encouraged to get in touch with the Software Heritage community using the standard development communication channels, and in particular our [[IRC]] channel (#swh-devel on [https://libera.chat/ Libera Chat]) and mailing list (swh-devel). Prefer public channels over contacting mentors directly.&lt;br /&gt;
&lt;br /&gt;
See our [https://www.softwareheritage.org/community/developers/ development information page] for details.&lt;br /&gt;
&lt;br /&gt;
== Timeline ==&lt;br /&gt;
&lt;br /&gt;
See the official [https://developers.google.com/open-source/gsoc/timeline Google Summer of Code timeline].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Google Summer of Code]]&lt;br /&gt;
[[Category:Google Summer of Code 2022]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1625</id>
		<title>VPN</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1625"/>
		<updated>2021-10-28T12:59:19Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Install redirection to the docs page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[swhdocs:sysadm/user-management/openvpn/openvpn.html]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Puppet_setup&amp;diff=1624</id>
		<title>Puppet setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Puppet_setup&amp;diff=1624"/>
		<updated>2021-10-27T10:41:01Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Install redirection to the puppet page in main docs site&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[swhdocs:sysadm/puppet/reference-setup.html]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Jenkins&amp;diff=1623</id>
		<title>Jenkins</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Jenkins&amp;diff=1623"/>
		<updated>2021-10-27T10:03:38Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Install redirect to docs page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[swhdocs:sysadm/deployment/jenkins.html]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1622</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1622"/>
		<updated>2021-10-27T07:55:09Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Install redirection to the docs page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[swhdocs:sysadm/deployment/howto-debian-packaging.html]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1527</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1527"/>
		<updated>2021-03-15T14:11:39Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Replace stretch reference to buster where it makes sense&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, buster-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package.&lt;br /&gt;
 gbp buildpackage --git-builder='sbuild -As'&lt;br /&gt;
&lt;br /&gt;
Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/buster-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/buster-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo10&amp;quot; -D buster-swh --force-distribution 'Rebuild for buster-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; &amp;lt;post-receive-hook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* there exists 2 types of &amp;lt;post-receive-hook&amp;gt;:&lt;br /&gt;
** ''post-receive-swh-modules'' for swh modules developed by the team&lt;br /&gt;
** ''post-receive-debian-deps'' for external modules packaged by the team&lt;br /&gt;
* remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     python_module: &amp;lt;python-module&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  - project:&lt;br /&gt;
      name: DLDBASE&lt;br /&gt;
      display-name: swh-loader-core&lt;br /&gt;
      repo_name: swh-loader-core&lt;br /&gt;
      pkg: loader.core&lt;br /&gt;
      python_module: swh.loader.core&lt;br /&gt;
      jobs:&lt;br /&gt;
        - 'swh-jobs-{name}'&lt;br /&gt;
 &lt;br /&gt;
Other samples can be found in the dedicated repository.&lt;br /&gt;
* usual swh package: [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$15-22 swh.core]&lt;br /&gt;
* peculiar swh package (with name divergences): [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$51-58 swh.icinga_plugins]&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create buster chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates buster /srv/chroots/buster http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For buster:&lt;br /&gt;
 aliases=buster-swh-amd64-sbuild,buster-backports-amd64-sbuild,buster-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar buster&lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Git_style_guide&amp;diff=1521</id>
		<title>Git style guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Git_style_guide&amp;diff=1521"/>
		<updated>2021-03-11T15:57:53Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Link commits to tasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Various information about how we use Git to develop [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
== Commits ==&lt;br /&gt;
&lt;br /&gt;
Make your commits adhere to this [http://chris.beams.io/posts/git-commit/ ''How to Write a Git Commit Message''] tutorial.&lt;br /&gt;
&lt;br /&gt;
== Link commits to tasks ==&lt;br /&gt;
&lt;br /&gt;
You can reference [[Phabricator]] tasks from your commits, using a [https://secure.phabricator.com/T5132 dedicated syntax].&lt;br /&gt;
When you do so, please put the task action on a separate line, so that it is clearly visible.&lt;br /&gt;
&lt;br /&gt;
Make sure commits that are enough to close a bug do so using a line like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Closes T123456&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you just want to &amp;quot;ping&amp;quot; a task, updating it with the fact that a related commit has been pushed, use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Related to T123456&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://secure.phabricator.com/T5132 special syntax you can use in commit messages to cause effects]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Guidelines]]&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1513</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1513"/>
		<updated>2021-03-10T11:22:51Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Bootstrapping a dependency packaging repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package.&lt;br /&gt;
 gbp buildpackage --git-builder='sbuild -As'&lt;br /&gt;
&lt;br /&gt;
Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; &amp;lt;post-receive-hook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* there exists 2 types of &amp;lt;post-receive-hook&amp;gt;:&lt;br /&gt;
** ''post-receive-swh-modules'' for swh modules developed by the team&lt;br /&gt;
** ''post-receive-debian-deps'' for external modules packaged by the team&lt;br /&gt;
* remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     python_module: &amp;lt;python-module&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  - project:&lt;br /&gt;
      name: DLDBASE&lt;br /&gt;
      display-name: swh-loader-core&lt;br /&gt;
      repo_name: swh-loader-core&lt;br /&gt;
      pkg: loader.core&lt;br /&gt;
      python_module: swh.loader.core&lt;br /&gt;
      jobs:&lt;br /&gt;
        - 'swh-jobs-{name}'&lt;br /&gt;
 &lt;br /&gt;
Other samples can be found in the dedicated repository.&lt;br /&gt;
* usual swh package: [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$15-22 swh.core]&lt;br /&gt;
* peculiar swh package (with name divergences): [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$51-58 swh.icinga_plugins]&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1512</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1512"/>
		<updated>2021-03-10T11:22:12Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Bootstrapping a dependency packaging repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package.&lt;br /&gt;
&lt;br /&gt;
    gbp buildpackage --git-builder='sbuild -As'&lt;br /&gt;
&lt;br /&gt;
Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; &amp;lt;post-receive-hook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* there exists 2 types of &amp;lt;post-receive-hook&amp;gt;:&lt;br /&gt;
** ''post-receive-swh-modules'' for swh modules developed by the team&lt;br /&gt;
** ''post-receive-debian-deps'' for external modules packaged by the team&lt;br /&gt;
* remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     python_module: &amp;lt;python-module&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  - project:&lt;br /&gt;
      name: DLDBASE&lt;br /&gt;
      display-name: swh-loader-core&lt;br /&gt;
      repo_name: swh-loader-core&lt;br /&gt;
      pkg: loader.core&lt;br /&gt;
      python_module: swh.loader.core&lt;br /&gt;
      jobs:&lt;br /&gt;
        - 'swh-jobs-{name}'&lt;br /&gt;
 &lt;br /&gt;
Other samples can be found in the dedicated repository.&lt;br /&gt;
* usual swh package: [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$15-22 swh.core]&lt;br /&gt;
* peculiar swh package (with name divergences): [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$51-58 swh.icinga_plugins]&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Phabricator&amp;diff=1440</id>
		<title>Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Phabricator&amp;diff=1440"/>
		<updated>2021-02-03T08:05:18Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Add admin action on spammy tickets/users&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://phabricator.org/ Phabricator] is the tool that [[Software Heritage]] uses as its coding/collaboration forge.&lt;br /&gt;
&lt;br /&gt;
Software Heritage's Phabricator instance can be found at https://forge.softwareheritage.org/&lt;br /&gt;
&lt;br /&gt;
== Client configuration ==&lt;br /&gt;
&lt;br /&gt;
* [[Arcanist setup]]&lt;br /&gt;
&lt;br /&gt;
== Conventions ==&lt;br /&gt;
&lt;br /&gt;
* [[Phabricator callsign naming convention]]&lt;br /&gt;
&lt;br /&gt;
== Admin ==&lt;br /&gt;
&lt;br /&gt;
* Clean up spam task&lt;br /&gt;
&lt;br /&gt;
    phabricator@tate:~$ ~/phabricator/bin/remove destroy T1234&lt;br /&gt;
&lt;br /&gt;
* Clean up spam user&lt;br /&gt;
&lt;br /&gt;
    phabricator@tate:~$ ~/phabricator/bin/remove destroy @shorrlouis701&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/ SWH Phabricator home]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Phabricator how Wikimedia uses Phabricator], with lots of good tips and mini-tutorials&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:Phabricator]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1376</id>
		<title>VPN</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1376"/>
		<updated>2020-12-17T13:58:18Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Raw OpenVPN */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Software Heritage]] server and the VMs running on it are severely firewalled.&lt;br /&gt;
To get onto their network unrestricted, a VPN based on [https://openvpn.net/ OpenVPN] is available.&lt;br /&gt;
&lt;br /&gt;
The setup is client-server, with per-client certificates.&lt;br /&gt;
&lt;br /&gt;
== OpenVPN client configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Raw OpenVPN ===&lt;br /&gt;
&lt;br /&gt;
Sample configuration file, e.g., /etc/openvpn/swh.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
remote louvre.softwareheritage.org&lt;br /&gt;
ns-cert-type server &lt;br /&gt;
comp-lzo &lt;br /&gt;
nobind&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp &lt;br /&gt;
port 1194 &lt;br /&gt;
log /var/log/openvpn.log&lt;br /&gt;
up-restart &lt;br /&gt;
persist-key &lt;br /&gt;
persist-tun &lt;br /&gt;
client &lt;br /&gt;
ca /etc/openvpn/keys/softwareheritage-ca.crt&lt;br /&gt;
cert /etc/openvpn/keys/softwareheritage.crt&lt;br /&gt;
key /etc/openvpn/keys/softwareheritage.key&lt;br /&gt;
user nobody&lt;br /&gt;
group nogroup&lt;br /&gt;
&lt;br /&gt;
# If you are using resolvconf, add this:&lt;br /&gt;
# Make sure you add louvre to /etc/hosts to avoid issues in using the vpn-provided DNS server.&lt;br /&gt;
script-security 2&lt;br /&gt;
up /etc/openvpn/update-resolv-conf&lt;br /&gt;
down /etc/openvpn/update-resolv-conf&lt;br /&gt;
&lt;br /&gt;
# If you want the connection to persist when your network fails, add this:&lt;br /&gt;
ping-restart 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the above configuration file, you will need to install the following 3 files under /etc/openvpn/keys (matching the paths within the sample above):&lt;br /&gt;
&lt;br /&gt;
* '''[[softwareheritage-ca.crt]]''': ''public'' certificate for the Software Heritage certification authority (CA)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/index.php?title=VPN#For_admins softwareheritage.crt]''': ''public'', client-specific (certificate signed by the admin, see below)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/wiki/VPN#For_users softwareheritage.key]''': ''private'', client-specific key (generated by the user, see below)&lt;br /&gt;
&lt;br /&gt;
Activate the openvpn server&lt;br /&gt;
&lt;br /&gt;
as root, run&lt;br /&gt;
&lt;br /&gt;
   systemctl enable openvpn@swh.service&lt;br /&gt;
   systemctl start openvpn@swh.service&lt;br /&gt;
   systemctl status openvpn@swh.service&lt;br /&gt;
&lt;br /&gt;
Note: Internally, the `swh` must match the /etc/openvpn/swh.conf filename.&lt;br /&gt;
&lt;br /&gt;
Excerpt of a successful start:&lt;br /&gt;
&lt;br /&gt;
  root@machine:~# systemctl status openvpn@swh.service&lt;br /&gt;
  openvpn@swh.service - OpenVPN connection to swh&lt;br /&gt;
   Loaded: loaded (/lib/systemd/system/openvpn@.service; indirect; vendor preset: enabled)&lt;br /&gt;
   Active: active (running) since Thu 2020-12-17 19:03:29 IST; 22min ago&lt;br /&gt;
     Docs: man:openvpn(8)&lt;br /&gt;
           https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage&lt;br /&gt;
           https://community.openvpn.net/openvpn/wiki/HOWTO&lt;br /&gt;
 Main PID: 12302 (openvpn)&lt;br /&gt;
   Status: &amp;quot;Initialization Sequence Completed&amp;quot;&lt;br /&gt;
    Tasks: 1 (limit: 4915)&lt;br /&gt;
   CGroup: /system.slice/system-openvpn.slice/openvpn@swh.service&lt;br /&gt;
           └─12302 /usr/sbin/openvpn --daemon ovpn-swh --status /run/openvpn/swh.status 10 --cd /etc/openvpn --script-security 2 --config /etc/openvpn/swh.conf --writepid /run/openvpn/swh.pid&lt;br /&gt;
&lt;br /&gt;
Dec 17 19:03:29 machine systemd[1]: Starting OpenVPN connection to swh...&lt;br /&gt;
Dec 17 19:03:29 machine systemd[1]: Started OpenVPN connection to swh.&lt;br /&gt;
&lt;br /&gt;
=== Network Manager GUI ===&lt;br /&gt;
&lt;br /&gt;
You need network-manager-openvpn and network-manager-openvpn-gnome for the configuration gui.&lt;br /&gt;
&lt;br /&gt;
[[File:nm_openvpn_base.png]]&lt;br /&gt;
[[File:nm_openvpn_routes.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_general.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_security.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_tls_auth.png]]&lt;br /&gt;
&lt;br /&gt;
== Obtaining a client certificate ==&lt;br /&gt;
&lt;br /&gt;
=== For users ===&lt;br /&gt;
&lt;br /&gt;
Generate a keypair (key + certificate signing request) using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openssl req -new -newkey rsa:2048 -nodes -keyout openvpn.key -out openvpn.csr -subj &amp;quot;/CN=&amp;lt;your username&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please replace &amp;lt;your username&amp;gt; with something that uniquely identifies the certificate.&lt;br /&gt;
&lt;br /&gt;
Make sure openvpn.key is stored in a safe place (it's your private key, which will allow anyone to connect to the VPN).&lt;br /&gt;
&lt;br /&gt;
Provide the CSR file to a sysadmin through a reasonably authenticated medium.&lt;br /&gt;
&lt;br /&gt;
=== For admins ===&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
Fetch the CSR file provided by the user, for instance with &amp;lt;tt&amp;gt;scp USERNAME.csr louvre:&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, as root on louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa import-req ~ADMIN/USERNAME.csr USERNAME&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa sign-req client USERNAME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command imports the csr into the EasyRSA PKI. The second command lets you review and sign it.&lt;br /&gt;
&lt;br /&gt;
Send the signed certificate, &amp;lt;tt&amp;gt;/etc/openvpn/keys/pki/issued/USERNAME.crt&amp;lt;/tt&amp;gt;, to the user. That file only contains public key material.&lt;br /&gt;
&lt;br /&gt;
Add the DNS entry for the new host to hiera and do a puppet run on pergamon.&lt;br /&gt;
&lt;br /&gt;
== Revoking a client certificate ==&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa revoke USERNAME&lt;br /&gt;
[ say yes ]&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa gen-crl; chmod a+r pki/crl.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OpenVPN re-reads the CRL at each connection (which is why we need the CRL to be world-readable), so once the cert is revoked, there's nothing more to do. If you want to make sure the client is disconnected, you need to restart OpenVPN (which will make all clients reconnect).&lt;br /&gt;
&lt;br /&gt;
== /etc/hosts entries ==&lt;br /&gt;
&lt;br /&gt;
Once the Vpn is setup on your machine, you can access Software Heritage hosts via their private IP addresses; see [[Network configuration]].&lt;br /&gt;
&lt;br /&gt;
OpenVPN now pushes the address of our DNS server (192.168.100.29, pergamon).&lt;br /&gt;
&lt;br /&gt;
You might want to add louvre.softwareheritage.org in your /etc/hosts to avoid a bootstrap problem if the &amp;quot;on-vpn&amp;quot; DNS server is in your resolv.conf.&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1375</id>
		<title>VPN</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1375"/>
		<updated>2020-12-17T13:23:48Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Clarify raw openvpn steps to enable the service&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Software Heritage]] server and the VMs running on it are severely firewalled.&lt;br /&gt;
To get onto their network unrestricted, a VPN based on [https://openvpn.net/ OpenVPN] is available.&lt;br /&gt;
&lt;br /&gt;
The setup is client-server, with per-client certificates.&lt;br /&gt;
&lt;br /&gt;
== OpenVPN client configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Raw OpenVPN ===&lt;br /&gt;
&lt;br /&gt;
Sample configuration file, e.g., /etc/openvpn/swh.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
remote louvre.softwareheritage.org&lt;br /&gt;
ns-cert-type server &lt;br /&gt;
comp-lzo &lt;br /&gt;
nobind&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp &lt;br /&gt;
port 1194 &lt;br /&gt;
log /var/log/openvpn.log&lt;br /&gt;
up-restart &lt;br /&gt;
persist-key &lt;br /&gt;
persist-tun &lt;br /&gt;
client &lt;br /&gt;
ca /etc/openvpn/keys/softwareheritage-ca.crt&lt;br /&gt;
cert /etc/openvpn/keys/softwareheritage.crt&lt;br /&gt;
key /etc/openvpn/keys/softwareheritage.key&lt;br /&gt;
user nobody&lt;br /&gt;
group nogroup&lt;br /&gt;
&lt;br /&gt;
# If you are using resolvconf, add this:&lt;br /&gt;
# Make sure you add louvre to /etc/hosts to avoid issues in using the vpn-provided DNS server.&lt;br /&gt;
script-security 2&lt;br /&gt;
up /etc/openvpn/update-resolv-conf&lt;br /&gt;
down /etc/openvpn/update-resolv-conf&lt;br /&gt;
&lt;br /&gt;
# If you want the connection to persist when your network fails, add this:&lt;br /&gt;
ping-restart 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the above configuration file, you will need to install the following 3 files under /etc/openvpn/keys (matching the paths within the sample above):&lt;br /&gt;
&lt;br /&gt;
* '''[[softwareheritage-ca.crt]]''': ''public'' certificate for the Software Heritage certification authority (CA)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/index.php?title=VPN#For_admins softwareheritage.crt]''': ''public'', client-specific (certificate signed by the admin, see below)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/wiki/VPN#For_users softwareheritage.key]''': ''private'', client-specific key (generated by the user, see below)&lt;br /&gt;
&lt;br /&gt;
Activate the openvpn server&lt;br /&gt;
&lt;br /&gt;
as root, run&lt;br /&gt;
&lt;br /&gt;
   systemctl enable openvpn@swh.service&lt;br /&gt;
&lt;br /&gt;
Note: Internally, the `swh` must match the /etc/openvpn/swh.conf filename.&lt;br /&gt;
&lt;br /&gt;
=== Network Manager GUI ===&lt;br /&gt;
&lt;br /&gt;
You need network-manager-openvpn and network-manager-openvpn-gnome for the configuration gui.&lt;br /&gt;
&lt;br /&gt;
[[File:nm_openvpn_base.png]]&lt;br /&gt;
[[File:nm_openvpn_routes.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_general.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_security.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_tls_auth.png]]&lt;br /&gt;
&lt;br /&gt;
== Obtaining a client certificate ==&lt;br /&gt;
&lt;br /&gt;
=== For users ===&lt;br /&gt;
&lt;br /&gt;
Generate a keypair (key + certificate signing request) using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openssl req -new -newkey rsa:2048 -nodes -keyout openvpn.key -out openvpn.csr -subj &amp;quot;/CN=&amp;lt;your username&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please replace &amp;lt;your username&amp;gt; with something that uniquely identifies the certificate.&lt;br /&gt;
&lt;br /&gt;
Make sure openvpn.key is stored in a safe place (it's your private key, which will allow anyone to connect to the VPN).&lt;br /&gt;
&lt;br /&gt;
Provide the CSR file to a sysadmin through a reasonably authenticated medium.&lt;br /&gt;
&lt;br /&gt;
=== For admins ===&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
Fetch the CSR file provided by the user, for instance with &amp;lt;tt&amp;gt;scp USERNAME.csr louvre:&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, as root on louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa import-req ~ADMIN/USERNAME.csr USERNAME&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa sign-req client USERNAME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command imports the csr into the EasyRSA PKI. The second command lets you review and sign it.&lt;br /&gt;
&lt;br /&gt;
Send the signed certificate, &amp;lt;tt&amp;gt;/etc/openvpn/keys/pki/issued/USERNAME.crt&amp;lt;/tt&amp;gt;, to the user. That file only contains public key material.&lt;br /&gt;
&lt;br /&gt;
Add the DNS entry for the new host to hiera and do a puppet run on pergamon.&lt;br /&gt;
&lt;br /&gt;
== Revoking a client certificate ==&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa revoke USERNAME&lt;br /&gt;
[ say yes ]&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa gen-crl; chmod a+r pki/crl.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OpenVPN re-reads the CRL at each connection (which is why we need the CRL to be world-readable), so once the cert is revoked, there's nothing more to do. If you want to make sure the client is disconnected, you need to restart OpenVPN (which will make all clients reconnect).&lt;br /&gt;
&lt;br /&gt;
== /etc/hosts entries ==&lt;br /&gt;
&lt;br /&gt;
Once the Vpn is setup on your machine, you can access Software Heritage hosts via their private IP addresses; see [[Network configuration]].&lt;br /&gt;
&lt;br /&gt;
OpenVPN now pushes the address of our DNS server (192.168.100.29, pergamon).&lt;br /&gt;
&lt;br /&gt;
You might want to add louvre.softwareheritage.org in your /etc/hosts to avoid a bootstrap problem if the &amp;quot;on-vpn&amp;quot; DNS server is in your resolv.conf.&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1374</id>
		<title>VPN</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=VPN&amp;diff=1374"/>
		<updated>2020-12-17T13:18:22Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Internal links to clarify what's what&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Software Heritage]] server and the VMs running on it are severely firewalled.&lt;br /&gt;
To get onto their network unrestricted, a VPN based on [https://openvpn.net/ OpenVPN] is available.&lt;br /&gt;
&lt;br /&gt;
The setup is client-server, with per-client certificates.&lt;br /&gt;
&lt;br /&gt;
== OpenVPN client configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Raw OpenVPN ===&lt;br /&gt;
&lt;br /&gt;
Sample configuration file, e.g., /etc/openvpn/softwareheritage.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
remote louvre.softwareheritage.org&lt;br /&gt;
ns-cert-type server &lt;br /&gt;
comp-lzo &lt;br /&gt;
nobind&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp &lt;br /&gt;
port 1194 &lt;br /&gt;
log /var/log/openvpn.log&lt;br /&gt;
up-restart &lt;br /&gt;
persist-key &lt;br /&gt;
persist-tun &lt;br /&gt;
client &lt;br /&gt;
ca /etc/openvpn/keys/softwareheritage-ca.crt&lt;br /&gt;
cert /etc/openvpn/keys/softwareheritage.crt&lt;br /&gt;
key /etc/openvpn/keys/softwareheritage.key&lt;br /&gt;
user nobody&lt;br /&gt;
group nogroup&lt;br /&gt;
&lt;br /&gt;
# If you are using resolvconf, add this:&lt;br /&gt;
# Make sure you add louvre to /etc/hosts to avoid issues in using the vpn-provided DNS server.&lt;br /&gt;
script-security 2&lt;br /&gt;
up /etc/openvpn/update-resolv-conf&lt;br /&gt;
down /etc/openvpn/update-resolv-conf&lt;br /&gt;
&lt;br /&gt;
# If you want the connection to persist when your network fails, add this:&lt;br /&gt;
ping-restart 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the above configuration file, you will need to install the following 3 files under /etc/openvpn/keys:&lt;br /&gt;
&lt;br /&gt;
* '''[[softwareheritage-ca.crt]]''': ''public'' certificate for the Software Heritage certification authority (CA)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/index.php?title=VPN#For_admins softwareheritage.crt]''': ''public'', client-specific (certificate signed by the admin, see below)&lt;br /&gt;
* '''[https://wiki.softwareheritage.org/wiki/VPN#For_users softwareheritage.key]''': ''private'', client-specific key (generated by the user, see below)&lt;br /&gt;
&lt;br /&gt;
=== Network Manager GUI ===&lt;br /&gt;
&lt;br /&gt;
You need network-manager-openvpn and network-manager-openvpn-gnome for the configuration gui.&lt;br /&gt;
&lt;br /&gt;
[[File:nm_openvpn_base.png]]&lt;br /&gt;
[[File:nm_openvpn_routes.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_general.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_security.png]]&lt;br /&gt;
[[File:nm_openvpn_advanced_tls_auth.png]]&lt;br /&gt;
&lt;br /&gt;
== Obtaining a client certificate ==&lt;br /&gt;
&lt;br /&gt;
=== For users ===&lt;br /&gt;
&lt;br /&gt;
Generate a keypair (key + certificate signing request) using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
openssl req -new -newkey rsa:2048 -nodes -keyout openvpn.key -out openvpn.csr -subj &amp;quot;/CN=&amp;lt;your username&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please replace &amp;lt;your username&amp;gt; with something that uniquely identifies the certificate.&lt;br /&gt;
&lt;br /&gt;
Make sure openvpn.key is stored in a safe place (it's your private key, which will allow anyone to connect to the VPN).&lt;br /&gt;
&lt;br /&gt;
Provide the CSR file to a sysadmin through a reasonably authenticated medium.&lt;br /&gt;
&lt;br /&gt;
=== For admins ===&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
Fetch the CSR file provided by the user, for instance with &amp;lt;tt&amp;gt;scp USERNAME.csr louvre:&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, as root on louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa import-req ~ADMIN/USERNAME.csr USERNAME&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa sign-req client USERNAME&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command imports the csr into the EasyRSA PKI. The second command lets you review and sign it.&lt;br /&gt;
&lt;br /&gt;
Send the signed certificate, &amp;lt;tt&amp;gt;/etc/openvpn/keys/pki/issued/USERNAME.crt&amp;lt;/tt&amp;gt;, to the user. That file only contains public key material.&lt;br /&gt;
&lt;br /&gt;
Add the DNS entry for the new host to hiera and do a puppet run on pergamon.&lt;br /&gt;
&lt;br /&gt;
== Revoking a client certificate ==&lt;br /&gt;
&lt;br /&gt;
On louvre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@louvre:~# cd /etc/openvpn/keys&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa revoke USERNAME&lt;br /&gt;
[ say yes ]&lt;br /&gt;
root@louvre:/etc/openvpn/keys# ./easyrsa gen-crl; chmod a+r pki/crl.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OpenVPN re-reads the CRL at each connection (which is why we need the CRL to be world-readable), so once the cert is revoked, there's nothing more to do. If you want to make sure the client is disconnected, you need to restart OpenVPN (which will make all clients reconnect).&lt;br /&gt;
&lt;br /&gt;
== /etc/hosts entries ==&lt;br /&gt;
&lt;br /&gt;
Once the Vpn is setup on your machine, you can access Software Heritage hosts via their private IP addresses; see [[Network configuration]].&lt;br /&gt;
&lt;br /&gt;
OpenVPN now pushes the address of our DNS server (192.168.100.29, pergamon).&lt;br /&gt;
&lt;br /&gt;
You might want to add louvre.softwareheritage.org in your /etc/hosts to avoid a bootstrap problem if the &amp;quot;on-vpn&amp;quot; DNS server is in your resolv.conf.&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1349</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1349"/>
		<updated>2020-10-22T09:37:38Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Update jenkins job template to match the current reality and add samples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; &amp;lt;post-receive-hook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* there exists 2 types of &amp;lt;post-receive-hook&amp;gt;:&lt;br /&gt;
** ''post-receive-swh-modules'' for swh modules developed by the team&lt;br /&gt;
** ''post-receive-debian-deps'' for external modules packaged by the team&lt;br /&gt;
* remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     python_module: &amp;lt;python-module&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
  - project:&lt;br /&gt;
      name: DLDBASE&lt;br /&gt;
      display-name: swh-loader-core&lt;br /&gt;
      repo_name: swh-loader-core&lt;br /&gt;
      pkg: loader.core&lt;br /&gt;
      python_module: swh.loader.core&lt;br /&gt;
      jobs:&lt;br /&gt;
        - 'swh-jobs-{name}'&lt;br /&gt;
 &lt;br /&gt;
Other samples can be found in the dedicated repository.&lt;br /&gt;
* usual swh package: [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$15-22 swh.core]&lt;br /&gt;
* peculiar swh package (with name divergences): [https://forge.softwareheritage.org/source/swh-jenkins-jobs/browse/master/jobs/swh-packages.yaml$51-58 swh.icinga_plugins]&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1348</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1348"/>
		<updated>2020-10-20T15:03:58Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: clarify the 2 types of post-receive hooks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; &amp;lt;post-receive-hook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* there exists 2 types of &amp;lt;post-receive-hook&amp;gt;:&lt;br /&gt;
** ''post-receive-swh-modules'' for swh modules developed by the team&lt;br /&gt;
** ''post-receive-debian-deps'' for external modules packaged by the team&lt;br /&gt;
* remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1338</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1338"/>
		<updated>2020-09-23T13:23:29Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: mention the port tidbit for tate...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -p 2222 -t tate.internal.softwareheritage.org phabricator-setup-hook /srv/phabricator/repos/&amp;lt;repo-id&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
Note: remember that access to tate is on port 2222.&lt;br /&gt;
&lt;br /&gt;
The repo ID can be found on the repo's &amp;quot;storage&amp;quot; property page on phabricator, typically &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-SHORTNAME/manage/storage/&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main'&lt;br /&gt;
&lt;br /&gt;
or if you need some third-party repository, say for cassandra:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source \&lt;br /&gt;
 --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main' \&lt;br /&gt;
 --extra-repository='deb [arch=amd64 trusted=yes] https://downloads.apache.org/cassandra/debian 40x main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Jenkins&amp;diff=1335</id>
		<title>Jenkins</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Jenkins&amp;diff=1335"/>
		<updated>2020-09-23T13:11:48Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Add links to the actual page declaring the steps to setup phabricator or new jenkins jobs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Jenkins =&lt;br /&gt;
&lt;br /&gt;
The CI is run by [https://jenkins.io/ Jenkins] on jenkins.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
== Authentication ==&lt;br /&gt;
&lt;br /&gt;
Software Heritage staffers can login via the Jenkins Web user interface using the same personal *nix credentials they use to login into other machines.&lt;br /&gt;
&lt;br /&gt;
== Jobs ==&lt;br /&gt;
&lt;br /&gt;
There are 2 categories of job:&lt;br /&gt;
&lt;br /&gt;
* jobs related to jenkins itself, like running Jenkins Job Builder, updating and managing docker images. These are found in the [https://jenkins.softwareheritage.org/job/jenkins-tools/ jenkins-tools] directory.&lt;br /&gt;
* jobs dedicated to testing/building swh packages.&lt;br /&gt;
&lt;br /&gt;
=== Jobs definition ===&lt;br /&gt;
&lt;br /&gt;
Most of the jobs are created using [https://docs.openstack.org/infra/jenkins-job-builder/ Jenkins Job Builder] (aka JJB).&lt;br /&gt;
&lt;br /&gt;
The source repository is https://forge.softwareheritage.org/source/swh-jenkins-jobs/&lt;br /&gt;
&lt;br /&gt;
Each time a new revision is pushed on this repo, the [https://jenkins.softwareheritage.org/job/jenkins-tools/job/swh-jenkins-job-builder/ JJB job] is executed. This job updates already existing jobs or create new ones (if any). Beware not to break the JJB job!&lt;br /&gt;
&lt;br /&gt;
=== Job execution environments ===&lt;br /&gt;
&lt;br /&gt;
Jenkins job execution may occur either on the Jenkins master node directly (typically for [https://jenkins.softwareheritage.org/job/jenkins-tools/ jenkins-tools] jobs), or in a docker jenkins slave.&lt;br /&gt;
&lt;br /&gt;
Docker images used by Jenkins are created and updated using the Dockerfiles in  &lt;br /&gt;
 https://forge.softwareheritage.org/source/swh-jenkins-dockerfiles/&lt;br /&gt;
&lt;br /&gt;
For now, there are 2 different images:&lt;br /&gt;
&lt;br /&gt;
* swh-jenkins/tox: a Debian stretch with python3 and tox installed; used to run unit tests; it's available in Jenkins under the label [https://jenkins.softwareheritage.org/label/swh-tox/ swh-tox]&lt;br /&gt;
* swh-jenkins/sphinx: based on the former tox image, it adds everything needed to compile the documentation with sphinx; it's available in Jenkins under the label [https://jenkins.softwareheritage.org/label/swh-sphinx/ swh-sphinx].&lt;br /&gt;
&lt;br /&gt;
=== swh packages ===&lt;br /&gt;
&lt;br /&gt;
Each swh package has a Jenkins [https://plugins.jenkins.io/cloudbees-folder Folder] in which are all the jobs dedicated to this package.&lt;br /&gt;
&lt;br /&gt;
There are two jenkins jobs for each swh package:&lt;br /&gt;
&lt;br /&gt;
* [https://jenkins.softwareheritage.org/job/DCORE/job/tox/ Phab. Diff] (here for [https://forge.softwareheritage.org/source/swh-core/ swh-core]): these jobs are executed each time a Phabricator Diff is created or updated, &lt;br /&gt;
* [https://jenkins.softwareheritage.org/job/DCORE/job/pipeline/ master branch] (here for [https://forge.softwareheritage.org/source/swh-core/ swh-core]): these jobs are executed when git revisions are pushed on the master branch.&lt;br /&gt;
&lt;br /&gt;
When these jobs are started by Phabricator, the job's end status is pushed back on the Phabricator object that triggered the build (ie. the Diff object or the Revision object). As a result, the build status for a given Diff or git revision will be displayed in the forge.&lt;br /&gt;
&lt;br /&gt;
The Diff in Phabricator will typically look like:&lt;br /&gt;
&lt;br /&gt;
[[File:JenkinsDiffReport.png]]&lt;br /&gt;
&lt;br /&gt;
The Diffusion view of a git repository will look like:&lt;br /&gt;
&lt;br /&gt;
[[File:JenkinsRevisionReport.png]]&lt;br /&gt;
&lt;br /&gt;
where the green &amp;quot;checks&amp;quot; in each revision means the CI passed OK on this revision.&lt;br /&gt;
&lt;br /&gt;
=== Dashboards and metrics ===&lt;br /&gt;
&lt;br /&gt;
The [https://jenkins.softwareheritage.org/view/swh%20dashboard/ swh dashboard] gives a global view on the CI status of swh packages. It shows all the &amp;quot;master branch&amp;quot; job status for all swh packages, as well as a few metrics for these builds (%success, code coverage, execution time, etc.)&lt;br /&gt;
&lt;br /&gt;
=== Starting a job manually ===&lt;br /&gt;
&lt;br /&gt;
[[File:JenkinsBuildButton.png|frameless|left]] &lt;br /&gt;
You should be able to execute any job by hand. When logged in, on the job's description page (eg. [https://jenkins.softwareheritage.org/view/swh%20dashboard/job/DCORE/job/tests/ swh-core master]) you should be able to push the &amp;quot;Build with Parameters&amp;quot; button which opens a form where you can specify the job's input parameters. &lt;br /&gt;
&lt;br /&gt;
[[File:JenkinsRestartFromStage.png|frameless|left]]&lt;br /&gt;
[[File:JenkinsReplay.png|frameless|left]]&lt;br /&gt;
Note that you can also restart a (generally failed) job. From the job execution summary (eg. [https://jenkins.softwareheritage.org/view/swh%20dashboard/job/DCORE/job/tests/50/ this execution]) you may find a &amp;quot;Restart from Stage&amp;quot;  button (on &amp;quot;master branch&amp;quot; jobs only) or a &amp;quot;Replay&amp;quot;  button that will allow you to recreate a job with the same parameters as the original job execution.&lt;br /&gt;
&lt;br /&gt;
== Phabricator ==&lt;br /&gt;
&lt;br /&gt;
[https://wiki.softwareheritage.org/wiki/Debian_packaging#Setting_up_the_repository_on_Phabricator Setting up the repository to trigger debian package]&lt;br /&gt;
&lt;br /&gt;
== New swh module jenkins job ==&lt;br /&gt;
&lt;br /&gt;
[https://wiki.softwareheritage.org/wiki/Debian_packaging#Setting_up_the_Jenkins_jobs Setting up a new swh module jenkins job]&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1325</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1325"/>
		<updated>2020-07-29T12:37:38Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Dependencies between diffs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you still get a 403 error on push, this means you need a forge administrator to enable HTTPS pushes for the repository (which wasn't done by default in historical repositories). Please drop by on IRC and let us know!&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions]).&lt;br /&gt;
Please open one diff per logical commit to keep the diff size to a minimum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx HEAD~&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies between diffs ===&lt;br /&gt;
&lt;br /&gt;
Note that you can manage diff dependencies within the same module with the following keyword in the diff description:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Depends on Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That allows to keep a logical view in your diff.&lt;br /&gt;
It's not strictly necessary (because the tooling now deals with it properly) but it might help reviewers or yourself to do so.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
Update the diff [https://wiki.softwareheritage.org/wiki/Code_review_in_Phabricator#Updating_your_branch_to_reflect_requested_changes following the prior section].&lt;br /&gt;
(It'd be good to let the ci build finish to make sure everything is still green).&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff-only my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;--ff-only&amp;lt;/code&amp;gt; is optional, and makes sure you don't unintentionally create a merge commit.&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, alternatively:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc land --squash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1324</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1324"/>
		<updated>2020-07-29T12:36:58Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: About dependencies between diffs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you still get a 403 error on push, this means you need a forge administrator to enable HTTPS pushes for the repository (which wasn't done by default in historical repositories). Please drop by on IRC and let us know!&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions]).&lt;br /&gt;
Please open one diff per logical commit to keep the diff size to a minimum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx HEAD~&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies between diffs ===&lt;br /&gt;
&lt;br /&gt;
Note that you can manage diff dependencies within the same module with the following keyword in the diff description:&lt;br /&gt;
&lt;br /&gt;
```&lt;br /&gt;
Depends on Dxx&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
That allows to keep a logical view in your diff.&lt;br /&gt;
It's not strictly necessary (because the tooling now deals with it properly) but it might help reviewers or yourself to do so.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
Update the diff [https://wiki.softwareheritage.org/wiki/Code_review_in_Phabricator#Updating_your_branch_to_reflect_requested_changes following the prior section].&lt;br /&gt;
(It'd be good to let the ci build finish to make sure everything is still green).&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff-only my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;--ff-only&amp;lt;/code&amp;gt; is optional, and makes sure you don't unintentionally create a merge commit.&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, alternatively:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc land --squash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1323</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1323"/>
		<updated>2020-07-29T12:33:00Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Starting a new feature and submit it for review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you still get a 403 error on push, this means you need a forge administrator to enable HTTPS pushes for the repository (which wasn't done by default in historical repositories). Please drop by on IRC and let us know!&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions]).&lt;br /&gt;
Please open one diff per logical commit to keep the diff size to a minimum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
Update the diff [https://wiki.softwareheritage.org/wiki/Code_review_in_Phabricator#Updating_your_branch_to_reflect_requested_changes following the prior section].&lt;br /&gt;
(It'd be good to let the ci build finish to make sure everything is still green).&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff-only my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;--ff-only&amp;lt;/code&amp;gt; is optional, and makes sure you don't unintentionally create a merge commit.&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, alternatively:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc land --squash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1322</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=1322"/>
		<updated>2020-07-29T12:32:47Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Starting a new feature and submit it for review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you still get a 403 error on push, this means you need a forge administrator to enable HTTPS pushes for the repository (which wasn't done by default in historical repositories). Please drop by on IRC and let us know!&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions])&lt;br /&gt;
Please open one diff per logical commit to keep the diff size to a minimum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
Update the diff [https://wiki.softwareheritage.org/wiki/Code_review_in_Phabricator#Updating_your_branch_to_reflect_requested_changes following the prior section].&lt;br /&gt;
(It'd be good to let the ci build finish to make sure everything is still green).&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff-only my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;--ff-only&amp;lt;/code&amp;gt; is optional, and makes sure you don't unintentionally create a merge commit.&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, alternatively:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc land --squash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1284</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1284"/>
		<updated>2020-05-27T15:22:35Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Give more details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -t tate.internal.softwareheritage.org phabricator-setup-hook &amp;lt;repository-path&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Place yourself on the debian/unstable-swh branch and &amp;quot;gbp import-origin&amp;quot; a more&lt;br /&gt;
recent upstream release tarballs.&lt;br /&gt;
&lt;br /&gt;
For example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags (`debian/upstream/0.0.7` here).&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
Ensure the [https://wiki.softwareheritage.org/wiki/Debian_packaging#Local_package_building update builds fine] &lt;br /&gt;
And [https://wiki.softwareheritage.org/wiki/Debian_packaging#Remote_package_building tags accordingly the debian/unstable-swh branch when ok]. &lt;br /&gt;
Jenkins will then keep up on building the package.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1283</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1283"/>
		<updated>2020-05-27T15:10:03Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Add chapter about updating a dependency packaging repository&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -t tate.internal.softwareheritage.org phabricator-setup-hook &amp;lt;repository-path&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Updating a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Example (current version on 0.0.5, upstream bumped to 0.0.7):&lt;br /&gt;
 gbp import-origin https://files.pythonhosted.org/packages/7a/bb/cf8fec6009e7d0cec52dc179d09b28c4c70d158e79b565e8aab7606e1717/attrs-strict-0.0.7.tar.gz&lt;br /&gt;
&lt;br /&gt;
This will update the following branches:&lt;br /&gt;
* debian/upstream&lt;br /&gt;
* pristine-tar&lt;br /&gt;
* debian/unstable-swh&lt;br /&gt;
* debian/buster-swh&lt;br /&gt;
&lt;br /&gt;
This also includes the necessary tags.&lt;br /&gt;
&lt;br /&gt;
You then need to push all branches/tags to the repository for jenkins to do its&lt;br /&gt;
packaging work:&lt;br /&gt;
 git push origin --all --follow-tags&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1123</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=1123"/>
		<updated>2019-09-04T07:51:27Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* schroot setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Buster :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ buster-swh main&lt;br /&gt;
&lt;br /&gt;
Oldstable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 git init pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir -p debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 echo 9 &amp;gt; debian/compat&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1 --distribution unstable-swh&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -t tate.internal.softwareheritage.org phabricator-setup-hook &amp;lt;repository-path&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1110</id>
		<title>Google Summer of Code 2019/Increase archive coverage</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1110"/>
		<updated>2019-08-26T13:14:28Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Learnings: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Title:===&lt;br /&gt;
'''Increase archive coverage''' &lt;br /&gt;
&lt;br /&gt;
=== Description:===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to increase the archive coverage by making listers and loaders for different forges. &lt;br /&gt;
[https://docs.softwareheritage.org/devel/swh-lister/index.html#swh-lister Listers] are components that crawl the APIs of software forges (e.g., Bitbucket, GitHub, Sourceforge, ...) and return a list of the software available in it. Loaders take a bundle of software (tarball, Git repository ...) and load it into Software Heritage, by adapting it so that it matches the archive data model.&lt;br /&gt;
&lt;br /&gt;
===Student: === &lt;br /&gt;
Archit Agrawal&lt;br /&gt;
* [https://forge.softwareheritage.org/p/nahimilega/ Forge activity]&lt;br /&gt;
&lt;br /&gt;
=== Mentors:===&lt;br /&gt;
* Nicolas Dandrimont&lt;br /&gt;
* Antoine R. Dumont&lt;br /&gt;
&lt;br /&gt;
===Work Done:===&lt;br /&gt;
* '''Listers:'''&lt;br /&gt;
** Completed and merged&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSfedfd73c8e4be8ce1d08b31c9a5cb99f9ca40fd6 Phabricator Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1482 GNU Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSa9a37a85bf9efac416cfdd152588bf01b7a063b2 CRAN Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1584 Packagist Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1610 CGit Lister]&lt;br /&gt;
** Did research on the methods that could be used to make following listers and made an implementation plan for the same&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1734 Launchpad Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1777 Rubygem Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1718 NuGET(.NET) Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1724 Maven Lister]&lt;br /&gt;
**  [https://forge.softwareheritage.org/rDLS08ade29e6de0616a3964360454ab52b58c082b75 Add tests to PyPI Lister]&lt;br /&gt;
** [https://forge.softwareheritage.org/rDLSf424f07c7e628eb7a19d25f4fdb749682d97a21f Refactor base tests for listers]&lt;br /&gt;
**  [https://forge.softwareheritage.org/D1441 Add documentation on *How to run a new lister*]&lt;br /&gt;
* '''Loaders:'''&lt;br /&gt;
** '''[https://forge.softwareheritage.org/T1389 Base Package Manager Loader]'''&lt;br /&gt;
*** Ingesting source code from package managers is a process somewhat similar for all of the package managers. This calls for a common base implementation for loading content from package managers into the archive. I worked on this idea, analysed the steps required to make a loader and the implementation of present package manager loader. Came up with the plan to implement the base loader and made the pass([https://forge.softwareheritage.org/D1694 D1694], [https://forge.softwareheritage.org/D1810 D1810], [https://forge.softwareheritage.org/D1811 D1811], [https://forge.softwareheritage.org/D1812 D1812], [https://forge.softwareheritage.org/D1813 D1813], [https://forge.softwareheritage.org/D1814 D1814], [https://forge.softwareheritage.org/D1744 D1744]). However, after the recommendation from my mentor, we changed the approach to make the base loader. Instead of making the whole base loader in one go, we decided to break it into multiple steps(3 steps) and follow the incremental approach.&lt;br /&gt;
**'''[https://forge.softwareheritage.org/D1824 GNU Loader]'''&lt;br /&gt;
*** As part of the first step towards the implementation of Base Loader, GNU Loader was implemented.&lt;br /&gt;
&lt;br /&gt;
===TO-DO:===&lt;br /&gt;
* Implement the Listers using the research done and the implementation plan made for Launchpad, Rubygem.&lt;br /&gt;
* Find the workarounds to solve the challenges in making the Maven and NuGET(.NET) Lister.&lt;br /&gt;
* Work on the remaining steps in order to complete the Base Package Manager Loader.&lt;br /&gt;
&lt;br /&gt;
=== Learnings: ===&lt;br /&gt;
Working in Software Heritage was a wholesome experience. I got to learn a new thing almost every day. Here is a few of the most prominent ones: &lt;br /&gt;
*Work on a huge codebase&lt;br /&gt;
*Plan and design before jumping to code&lt;br /&gt;
*Write clean and well-commented code&lt;br /&gt;
*Learn the difference between doing projects in college and in the industry(Spoiler Alert: '''A lot''')&lt;br /&gt;
*Multiple language integration in a python library (Used in CRAN Lister)&lt;br /&gt;
*Different programming methodologies explained to me by my mentors(eg [https://en.wikipedia.org/wiki/Test-driven_development TDD])&lt;br /&gt;
*Work with tools; DVCS (git), issue tracker (phabricator forge), containerization/virtualization (docker)&lt;br /&gt;
&lt;br /&gt;
=== Activity reports:===&lt;br /&gt;
* May 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00003.html Week 20 Second Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00010.html Week 21 Third Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00017.html Week 22 First Week (Coding)]&lt;br /&gt;
* June 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00009.html Week 23 Second Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00016.html Week 24 Third Week  (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00026.html Week 25 Fourth Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00033.html Week 26 Fifth Week  (First Evaluation)]&lt;br /&gt;
* July 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00003.html Week 27 Sixth Week   (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00006.html Week 28 Seventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00011.html Week 29 Eight Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00015.html Week 30 Nineth Week (Second Evaluation)]&lt;br /&gt;
* August 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00002.html Week 31 Tenth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00004.html Week 32 Eleventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00008.html Week 33 Twelfth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00011.html Week 34 Thirteenth Week (Final Evaluation)]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-lister/    Lister source code repository]&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-loader-core/   Loader source code repository]&lt;br /&gt;
* see project [https://summerofcode.withgoogle.com/projects/#5658995887439872 on the GSoC portal]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Google Summer of Code]]&lt;br /&gt;
[[Category: Google Summer of Code 2019]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1108</id>
		<title>Google Summer of Code 2019/Increase archive coverage</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1108"/>
		<updated>2019-08-26T12:38:50Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Learnings: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Title:===&lt;br /&gt;
'''Increase archive coverage''' &lt;br /&gt;
&lt;br /&gt;
=== Description:===&lt;br /&gt;
As Software Heritage works on archiving and sharing source code, one of the major tasks is to ingest the latest source code available in the database from time to time and from all the possible sources where you can fetch the source code using listers and ingest them using loaders. [https://docs.softwareheritage.org/devel/swh-lister/index.html#swh-lister Listers] are components that crawl the APIs of software forges (e.g., Bitbucket, GitHub, Sourceforge, ...) and return a list of the software available in it whereas [Loaders take a bundle of software (tarball, Git repository ...) and load it into Software Heritage, by adapting it so that it matches the archive data model. The goal of this project is to increase the archive coverage by making listers and loaders for different websites that which stores source code, so that Software Heritage can fetch as much source code as possible and store it in the database to preserve it for future generations.&lt;br /&gt;
&lt;br /&gt;
===Student: === &lt;br /&gt;
Archit Agrawal&lt;br /&gt;
* [https://forge.softwareheritage.org/p/nahimilega/ Forge activity]&lt;br /&gt;
&lt;br /&gt;
=== Mentors:===&lt;br /&gt;
* Nicolas Dandrimont&lt;br /&gt;
* Antoine R. Dumont&lt;br /&gt;
&lt;br /&gt;
===Work Done:===&lt;br /&gt;
* '''Listers:'''&lt;br /&gt;
** Completed and merged&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSfedfd73c8e4be8ce1d08b31c9a5cb99f9ca40fd6 Phabricator Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1482 GNU Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSa9a37a85bf9efac416cfdd152588bf01b7a063b2 CRAN Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1584 Packagist Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1610 CGit Lister]&lt;br /&gt;
** Did research on the methods that could be used to make following listers and made an implementation plan for the same&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1734 Launchpad Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1777 Rubygem Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1718 NuGET(.NET) Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1724 Maven Lister]&lt;br /&gt;
**  [https://forge.softwareheritage.org/rDLS08ade29e6de0616a3964360454ab52b58c082b75 Add tests to PyPI Lister]&lt;br /&gt;
** [https://forge.softwareheritage.org/rDLSf424f07c7e628eb7a19d25f4fdb749682d97a21f Refactor base tests for listers]&lt;br /&gt;
**  [https://forge.softwareheritage.org/D1441 Add documentation on *How to run a new lister*]&lt;br /&gt;
* '''Loaders:'''&lt;br /&gt;
** '''[https://forge.softwareheritage.org/T1389 Base Package Manager Loader]'''&lt;br /&gt;
*** Ingesting source code from package managers is a process somewhat similar for all of the package managers. This calls for a common base implementation for loading content from package managers into the archive. I worked on this idea, analysed the steps required to make a loader and the implementation of present package manager loader. Came up with the plan to implement the base loader and made the pass([https://forge.softwareheritage.org/D1694 D1694], [https://forge.softwareheritage.org/D1810 D1810], [https://forge.softwareheritage.org/D1811 D1811], [https://forge.softwareheritage.org/D1812 D1812], [https://forge.softwareheritage.org/D1813 D1813], [https://forge.softwareheritage.org/D1814 D1814], [https://forge.softwareheritage.org/D1744 D1744]). However, after the recommendation from my mentor, we changed the approach to make the base loader. Instead of making the whole base loader in one go, we decided to break it into multiple steps(3 steps) and follow the incremental approach.&lt;br /&gt;
**'''[https://forge.softwareheritage.org/D1824 GNU Loader]'''&lt;br /&gt;
*** As part of the first step towards the implementation of Base Loader, GNU Loader was implemented.&lt;br /&gt;
&lt;br /&gt;
===TO-DO:===&lt;br /&gt;
* Implement the Listers using the research done and the implementation plan made for Launchpad, Rubygem.&lt;br /&gt;
* Find the workarounds to solve the challenges in making the Maven and NuGET(.NET) Lister.&lt;br /&gt;
* Work on the remaining steps in order to complete the Base Package Manager Loader.&lt;br /&gt;
&lt;br /&gt;
=== Learnings: ===&lt;br /&gt;
Working in Software Heritage was a wholesome experience. I got to learn a new thing almost every day. Here is a few of the most prominent ones: &lt;br /&gt;
*Work on a huge codebase&lt;br /&gt;
*Plan and design before jumping to code&lt;br /&gt;
*Write clean and well-commented code&lt;br /&gt;
*Learn the difference between doing projects in college and in the industry(Spoiler Alert: '''A lot''')&lt;br /&gt;
*Multiple language integration in a python library (Used in CRAN Lister)&lt;br /&gt;
*Different programming methodologies explained to me by my mentors(eg [https://en.wikipedia.org/wiki/Test-driven_development TDD])&lt;br /&gt;
*Work with tools; DVCS (git), issue tracker (phabricator forge), docker&lt;br /&gt;
&lt;br /&gt;
=== Activity reports:===&lt;br /&gt;
* May 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00003.html Week 20 Second Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00010.html Week 21 Third Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00017.html Week 22 First Week (Coding)]&lt;br /&gt;
* June 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00009.html Week 23 Second Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00016.html Week 24 Third Week  (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00026.html Week 25 Fourth Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00033.html Week 26 Fifth Week  (First Evaluation)]&lt;br /&gt;
* July 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00003.html Week 27 Sixth Week   (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00006.html Week 28 Seventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00011.html Week 29 Eight Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00015.html Week 30 Nineth Week (Second Evaluation)]&lt;br /&gt;
* August 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00002.html Week 31 Tenth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00004.html Week 32 Eleventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00008.html Week 33 Twelfth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00011.html Week 34 Thirteenth Week (Final Evaluation)]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-lister/    Lister source code repository]&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-loader-core/   Loader source code repository]&lt;br /&gt;
* see project [https://summerofcode.withgoogle.com/projects/#5658995887439872 on the GSoC portal]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Google Summer of Code]]&lt;br /&gt;
[[Category: Google Summer of Code 2019]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1107</id>
		<title>Google Summer of Code 2019/Increase archive coverage</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019/Increase_archive_coverage&amp;diff=1107"/>
		<updated>2019-08-26T12:30:45Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Work Done: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Title:===&lt;br /&gt;
'''Increase archive coverage''' &lt;br /&gt;
&lt;br /&gt;
=== Description:===&lt;br /&gt;
As Software Heritage works on archiving and sharing source code, one of the major tasks is to ingest the latest source code available in the database from time to time and from all the possible sources where you can fetch the source code using listers and ingest them using loaders. [https://docs.softwareheritage.org/devel/swh-lister/index.html#swh-lister Listers] are components that crawl the APIs of software forges (e.g., Bitbucket, GitHub, Sourceforge, ...) and return a list of the software available in it whereas [Loaders take a bundle of software (tarball, Git repository ...) and load it into Software Heritage, by adapting it so that it matches the archive data model. The goal of this project is to increase the archive coverage by making listers and loaders for different websites that which stores source code, so that Software Heritage can fetch as much source code as possible and store it in the database to preserve it for future generations.&lt;br /&gt;
&lt;br /&gt;
===Student: === &lt;br /&gt;
Archit Agrawal&lt;br /&gt;
* [https://forge.softwareheritage.org/p/nahimilega/ Forge activity]&lt;br /&gt;
&lt;br /&gt;
=== Mentors:===&lt;br /&gt;
* Nicolas Dandrimont&lt;br /&gt;
* Antoine R. Dumont&lt;br /&gt;
&lt;br /&gt;
===Work Done:===&lt;br /&gt;
* '''Listers:'''&lt;br /&gt;
** Completed and merged&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSfedfd73c8e4be8ce1d08b31c9a5cb99f9ca40fd6 Phabricator Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1482 GNU Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/rDLSa9a37a85bf9efac416cfdd152588bf01b7a063b2 CRAN Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1584 Packagist Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/D1610 CGit Lister]&lt;br /&gt;
** Did research on the methods that could be used to make following listers and made an implementation plan for the same&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1734 Launchpad Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1777 Rubygem Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1718 NuGET(.NET) Lister]&lt;br /&gt;
*** [https://forge.softwareheritage.org/T1724 Maven Lister]&lt;br /&gt;
**  [https://forge.softwareheritage.org/rDLS08ade29e6de0616a3964360454ab52b58c082b75 Add tests to PyPI Lister]&lt;br /&gt;
** [https://forge.softwareheritage.org/rDLSf424f07c7e628eb7a19d25f4fdb749682d97a21f Refactor base tests for listers]&lt;br /&gt;
**  [https://forge.softwareheritage.org/D1441 Add documentation on *How to run a new lister*]&lt;br /&gt;
* '''Loaders:'''&lt;br /&gt;
** '''[https://forge.softwareheritage.org/T1389 Base Package Manager Loader]'''&lt;br /&gt;
*** Ingesting source code from package managers is a process somewhat similar for all of the package managers. This calls for a common base implementation for loading content from package managers into the archive. I worked on this idea, analysed the steps required to make a loader and the implementation of present package manager loader. Came up with the plan to implement the base loader and made the pass([https://forge.softwareheritage.org/D1694 D1694], [https://forge.softwareheritage.org/D1810 D1810], [https://forge.softwareheritage.org/D1811 D1811], [https://forge.softwareheritage.org/D1812 D1812], [https://forge.softwareheritage.org/D1813 D1813], [https://forge.softwareheritage.org/D1814 D1814], [https://forge.softwareheritage.org/D1744 D1744]). However, after the recommendation from my mentor, we changed the approach to make the base loader. Instead of making the whole base loader in one go, we decided to break it into multiple steps(3 steps) and follow the incremental approach.&lt;br /&gt;
**'''[https://forge.softwareheritage.org/D1824 GNU Loader]'''&lt;br /&gt;
*** As part of the first step towards the implementation of Base Loader, GNU Loader was implemented.&lt;br /&gt;
&lt;br /&gt;
===TO-DO:===&lt;br /&gt;
* Implement the Listers using the research done and the implementation plan made for Launchpad, Rubygem.&lt;br /&gt;
* Find the workarounds to solve the challenges in making the Maven and NuGET(.NET) Lister.&lt;br /&gt;
* Work on the remaining steps in order to complete the Base Package Manager Loader.&lt;br /&gt;
&lt;br /&gt;
=== Learnings: ===&lt;br /&gt;
Working in Software Heritage was a wholesome experience. I got to learn a new thing almost every day. It would me injustice id I say I can account all my learnings in a section of a blog, however here are a list of few of most prominent once: &lt;br /&gt;
*Working on a huge codebase&lt;br /&gt;
*Plan and design before jumping to code&lt;br /&gt;
*Writing clean and well-commented code&lt;br /&gt;
*Difference between doing projects in college and in the industry(Spoiler Alert: '''A lot''')&lt;br /&gt;
*Multiple language integration in a python library (Used in CRAN Lister)&lt;br /&gt;
*Different programming methodologies explained to me by my mentors(eg [https://en.wikipedia.org/wiki/Test-driven_development TDD])&lt;br /&gt;
*Working with git and forge&lt;br /&gt;
*Working with Docker&lt;br /&gt;
&lt;br /&gt;
=== Activity reports:===&lt;br /&gt;
* May 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00003.html Week 20 Second Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00010.html Week 21 Third Week (Community Bonding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-05/msg00017.html Week 22 First Week (Coding)]&lt;br /&gt;
* June 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00009.html Week 23 Second Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00016.html Week 24 Third Week  (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00026.html Week 25 Fourth Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-06/msg00033.html Week 26 Fifth Week  (First Evaluation)]&lt;br /&gt;
* July 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00003.html Week 27 Sixth Week   (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00006.html Week 28 Seventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00011.html Week 29 Eight Week (Coding)(Work Summary)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-07/msg00015.html Week 30 Nineth Week (Second Evaluation)]&lt;br /&gt;
* August 2019&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00002.html Week 31 Tenth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00004.html Week 32 Eleventh Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00008.html Week 33 Twelfth Week (Coding)]&lt;br /&gt;
** [https://sympa.inria.fr/sympa/arc/swh-devel/2019-08/msg00011.html Week 34 Thirteenth Week (Final Evaluation)]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-lister/    Lister source code repository]&lt;br /&gt;
* [https://forge.softwareheritage.org/source/swh-loader-core/   Loader source code repository]&lt;br /&gt;
* see project [https://summerofcode.withgoogle.com/projects/#5658995887439872 on the GSoC portal]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Google Summer of Code]]&lt;br /&gt;
[[Category: Google Summer of Code 2019]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Report_issues_on_phabricator&amp;diff=981</id>
		<title>Report issues on phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Report_issues_on_phabricator&amp;diff=981"/>
		<updated>2019-03-18T23:30:39Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Bootstrap report on phabricator&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When you decide that there is a bug, it is important to&lt;br /&gt;
report it in a useful way in [https://forge.softwareheritage.org/task our forge]. &lt;br /&gt;
&lt;br /&gt;
What is most useful is an exact description of what commands you executed, until the problem happens.&lt;br /&gt;
&lt;br /&gt;
If you feel the command and the stack trace are too long, you can use a paste&lt;br /&gt;
software. For example, [https://forge.softwareheritage.org/paste our forge] proposes one. &lt;br /&gt;
That's easier to discuss it in the #swh-devel irc channel by referencing it or even attach it to the task.&lt;br /&gt;
&lt;br /&gt;
There is a bot in the irc channel which will automatically create a summary of the task/paste when mentioned.&lt;br /&gt;
In the forge, automatic linking happens when mentioning phabricator objects.&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
Inspired from [https://www.gnu.org/software/emacs/draft/manual/html_node/emacs/Understanding-Bug-Reporting.html the emacs manual]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=978</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=978"/>
		<updated>2019-03-13T12:32:43Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Landing your change onto master */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions])&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
Update the diff [https://wiki.softwareheritage.org/wiki/Code_review_in_Phabricator#Updating_your_branch_to_reflect_requested_changes following the prior section].&lt;br /&gt;
(It'd be good to let the ci build finish to make sure everything is still green).&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Graph_compression_on_the_development_history_of_software_(internship)&amp;diff=977</id>
		<title>Graph compression on the development history of software (internship)</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Graph_compression_on_the_development_history_of_software_(internship)&amp;diff=977"/>
		<updated>2019-03-12T21:17:21Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Graph compression on the development history of software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graph compression on the development history of software ==&lt;br /&gt;
&lt;br /&gt;
'''Context''': [https://www.softwareheritage.org/ Software Heritage] is an&lt;br /&gt;
ambitious research project whose goal is to collect, preserve in the very long&lt;br /&gt;
term, and share the whole publicly accessible Free/Open Source Software&lt;br /&gt;
(FOSS) in source code form.&lt;br /&gt;
&lt;br /&gt;
'''Description''': The Software Heritage&lt;br /&gt;
[https://docs.softwareheritage.org/devel/swh-model/data-model.html data model]&lt;br /&gt;
is a big [https://en.wikipedia.org/wiki/Merkle_tree Merkle] DAG made of nodes&lt;br /&gt;
like revisions, releases, directories, etc. It is a very big graph, with ~10 B&lt;br /&gt;
nodes and ~100 B edges, which makes it hard to fit in memory using naive&lt;br /&gt;
approaches. Graph compression techniques have been successfully used to compress&lt;br /&gt;
the Web graph (which is slightly larger than the Software Heritage one) and make&lt;br /&gt;
it fit in memory. The goal of this internship is review existing graph&lt;br /&gt;
compression techniques and apply the most appropriate one to the Software&lt;br /&gt;
Heritage case, enabling in-memory processing of its Merkle DAG.&lt;br /&gt;
&lt;br /&gt;
'''Desirable skills''' to obtain this internship:&lt;br /&gt;
* familiarity with system programming&lt;br /&gt;
* familiarity with basic graph algorithms&lt;br /&gt;
* C development&lt;br /&gt;
* working knowledge of basic compression techniques from information theory would be a plus&lt;br /&gt;
&lt;br /&gt;
'''Workplace''': Inria Paris&lt;br /&gt;
&lt;br /&gt;
'''Environment''': you will work shoulder to shoulder with all members of the&lt;br /&gt;
Software Heritage team, and you will have a chance to witness from within the&lt;br /&gt;
construction of the ultimate source code archive.&lt;br /&gt;
&lt;br /&gt;
'''Internship mentors''':&lt;br /&gt;
* Francesca Bassi &amp;lt;francesca.bassi@l2s.centralesupelec.fr&amp;gt;&lt;br /&gt;
* Stefano Zacchiroli &amp;lt;zack@upsilon.cc&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
* Paolo Boldi, Sebastiano Vigna, ''The webgraph framework I: compression techniques'', Proceedings of the 13th international conference on World Wide Web. ACM, 2004. [http://www.web.ethz.ch/CDstore/www2004/docs/1p595.pdf pdf]&lt;br /&gt;
* Paolo Boldi, Marco Rosa, Massimo Santini, Sebastiano Vigna, ''Layered label propagation: A multiresolution coordinate-free ordering for compressing social networks''. [https://arxiv.org/pdf/1011.5425 pdf]&lt;br /&gt;
* [http://webgraph.di.unimi.it WebGraph] (Java framework that implements the techniques above)&lt;br /&gt;
&lt;br /&gt;
[[Category:Available internship]]&lt;br /&gt;
[[Category:Internship]]&lt;br /&gt;
[[Category:Lang:English]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=972</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=972"/>
		<updated>2019-02-16T08:49:06Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Bootstrapping the backport branches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 mkdir pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
 git init&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir debian&lt;br /&gt;
 mkdir debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l &amp;quot;~bpo9&amp;quot; -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -t tate.internal.softwareheritage.org phabricator-setup-hook &amp;lt;repository-path&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stable-amd64-sbuild,stable-backports-amd64-sbuild,stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=971</id>
		<title>Code review in Phabricator</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Code_review_in_Phabricator&amp;diff=971"/>
		<updated>2019-02-14T09:59:05Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Starting a new feature and submit it for review */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We use the [[Differential]] application of [[Phabricator]] to perform [[code review|code reviews]] in the context of [[Software Heritage]].&lt;br /&gt;
&lt;br /&gt;
* we use Git and history.immutable=true (but beware as that is partly a Phabricator misnomer, read on)&lt;br /&gt;
* when code reviews are required, developers will be allowed to push directly to master once an accepted Differential diff exists&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Arcanist configuration ===&lt;br /&gt;
&lt;br /&gt;
When using git, [[Arcanist]] by default mess with the local history, rewriting commits at the time of first submission.&amp;lt;br /&amp;gt;&lt;br /&gt;
To avoid that we use so called [https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/#history-mutability-git history immutability].&lt;br /&gt;
&lt;br /&gt;
To that end, you shall configure your &amp;lt;tt&amp;gt;arc&amp;lt;/tt&amp;gt; accordingly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc set-config history.immutable true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this does ''not'' mean that you are forbidden to rewrite your local branches (e.g., with &amp;lt;tt&amp;gt;git rebase&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Quite the contrary: you are encouraged to locally rewrite branches before pushing to ensure that commits are logically separated and your commit history easy to bisect.&lt;br /&gt;
The above setting just means that ''arc'' will not rewrite commit history under your nose.&lt;br /&gt;
&lt;br /&gt;
=== Enabling &amp;lt;tt&amp;gt;git push&amp;lt;/tt&amp;gt; to our forge ===&lt;br /&gt;
&lt;br /&gt;
The way we've configured our review setup for continuous integration needs you to configure git to allow pushes to our forge. There's two ways you can do this : setting a ssh key to push over ssh, or setting a specific password for git pushes over https.&lt;br /&gt;
&lt;br /&gt;
==== SSH key for pushes ====&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you have access to a ''Authentication'' &amp;gt; ''SSH Public Keys'' section (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/ssh/&amp;lt;/tt&amp;gt;). You then have the option to upload a SSH public key, which will authenticate your pushes.&lt;br /&gt;
&lt;br /&gt;
You then need to configure ssh/git to use that key pair, for instance by editing the &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
Finally, you should configure git to push over ssh when pushing to https://forge.softwareheritage.org, by running the following command:&lt;br /&gt;
 git config --global url.git@forge.softwareheritage.org:.pushInsteadOf https://forge.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
This lets git know that it should use &amp;lt;tt&amp;gt;git@forge.softwareheritage.org:&amp;lt;/tt&amp;gt; as a base url when pushing repositories cloned from forge.softwareheritage.org over https.&lt;br /&gt;
&lt;br /&gt;
==== VCS password for pushes ====&lt;br /&gt;
&lt;br /&gt;
If you're not comfortable setting up SSH to upload your changes, you have the option of setting a VCS password. This password, ''separate from your account password'', allows Phabricator to authenticate your uploads over HTTPS.&lt;br /&gt;
&lt;br /&gt;
In your forge User settings page (On the top right, click on your avatar, then click ''Settings''), you need to use the ''Authentication'' &amp;gt; ''VCS Password'' section to set your VCS password (Direct link: &amp;lt;tt&amp;gt;hxxps://forge.softwareheritage.org/settings/user/'''&amp;lt;your username&amp;gt;'''/page/vcspassword/&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Workflow ==&lt;br /&gt;
&lt;br /&gt;
* work in a feature branch: &amp;lt;tt&amp;gt;git checkout -b my-feat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* initial review request: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* react to change requests: hack/commit/hack/commit ; &amp;lt;tt&amp;gt;arc diff --update Dxx origin/master&amp;lt;/tt&amp;gt;&lt;br /&gt;
* landing change: &amp;lt;tt&amp;gt;git checkout master ; git merge my-feat ; git push&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting a new feature and submit it for review ===&lt;br /&gt;
&lt;br /&gt;
Use a '''one branch per feature''' workflow, with well-separated ''logical commits'' ([https://wiki.softwareheritage.org/wiki/Git_style_guide following those conventions])&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout -b my-shiny-feature&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'architecture skeleton for my-shiny-feature'&lt;br /&gt;
... hack hack hack ...&lt;br /&gt;
git commit -m 'my-shiny-feature: implement module foo'&lt;br /&gt;
... etc ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please, follow the &lt;br /&gt;
To '''submit your code for review''' the first time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
arc will prompt for a '''code review message'''. Provide the following information:&lt;br /&gt;
* first line: ''short description'' of the overall work (i.e., the feature you're working on). This will become the title of the review&lt;br /&gt;
* ''Summary'' field (optional): ''long description'' of the overall work; the field can continue in subsequent lines, up to the next field. This will become the &amp;quot;Summary&amp;quot; section of the review&lt;br /&gt;
* ''Test Plan'' field (optional): write here if something special is needed to test your change&lt;br /&gt;
* ''Reviewers'' field (optional): the (Phabricator) name(s) of desired reviewers. If you don't specify one (recommended) the default reviewers will be chosen&lt;br /&gt;
* ''Subscribers'' field (optional): the (Phabricator) name(s) of people that will be notified about changes to this review request. In most cases it should be left empty&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mercurial loader&lt;br /&gt;
&lt;br /&gt;
Summary: first stab at a mercurial loader (T329)&lt;br /&gt;
&lt;br /&gt;
The implementation follows the plan detailed in F2F discussion with @foo.&lt;br /&gt;
&lt;br /&gt;
Performances seem decent enough for a first trial (XXX seconds for YYY repository&lt;br /&gt;
that contains ZZZ patches).&lt;br /&gt;
&lt;br /&gt;
Test plan: &lt;br /&gt;
&lt;br /&gt;
Reviewers: &lt;br /&gt;
&lt;br /&gt;
Subscribers: foo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After completing the message arc will submit the review request and tell you its number and URL:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
Created a new Differential revision:&lt;br /&gt;
        Revision URI: https://forge.softwareheritage.org/Dxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Updating your branch to reflect requested changes ===&lt;br /&gt;
&lt;br /&gt;
Your feature might get accepted as is, YAY!&lt;br /&gt;
Or, reviewers might request changes; no big deal!&lt;br /&gt;
&lt;br /&gt;
Use the Differential web UI to follow-up to received comments, if needed.&lt;br /&gt;
&lt;br /&gt;
To implement requested changes in the code, hack on your branch as usual by:&lt;br /&gt;
&lt;br /&gt;
* adding new commits, and/or&lt;br /&gt;
* rewriting old commits with git rebase (to preserve a nice, easy to bisect history)&lt;br /&gt;
&lt;br /&gt;
When you're ready to '''update your review request''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc diff --update Dxx origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arc will prompt you for a message: describe what you've changed w.r.t. the previous review request, free form.&lt;br /&gt;
Your message will become the changelog entry in Differential for this new version of the diff.&lt;br /&gt;
&lt;br /&gt;
Differential only care about the code diff, and not about the commits or their order.&lt;br /&gt;
Therefore each &amp;quot;update&amp;quot; can be a completely different series of commits, possibly rewritten from the previous submission.&lt;br /&gt;
&lt;br /&gt;
=== Landing your change onto master ===&lt;br /&gt;
&lt;br /&gt;
Once your change has been approved in Differential, you will be able to land it onto the master branch.&lt;br /&gt;
&lt;br /&gt;
Before doing so, you're encouraged to '''clean up your git commit history''', reordering/splitting/merging commits as needed to have separate logical commits and an easy to bisect history.&lt;br /&gt;
The correspondence between the accepted review and pushed code is checked by looking only at the code diff, so commit fiddling will not impact your ability to push to master.&lt;br /&gt;
&lt;br /&gt;
Once you're happy you can '''push to origin/master''' directly, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge my-shiny-feature&lt;br /&gt;
git push&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally you can then delete your local feature branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch -d my-shiny-feature&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reviewing locally / landing someone else's changes ===&lt;br /&gt;
&lt;br /&gt;
You can do local reviews of code with arc patch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arc patch Dxyz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a branch '''arcpatch-Dxyz''' containing the changes on your local checkout.&lt;br /&gt;
&lt;br /&gt;
You can then merge those changes upstream with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout master&lt;br /&gt;
git merge --ff arcpatch-Dxyz&lt;br /&gt;
git push origin master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Code review]] for guidelines on how code is reviewed when developing for Software Heritage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=969</id>
		<title>Debian packaging</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Debian_packaging&amp;diff=969"/>
		<updated>2019-02-08T15:46:03Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Keep the same visual order as the phabricator ui&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Package repository ==&lt;br /&gt;
&lt;br /&gt;
A package repository is available on https://debian.softwareheritage.org/.&lt;br /&gt;
&lt;br /&gt;
Unstable / Testing :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ unstable main&lt;br /&gt;
&lt;br /&gt;
Stable / Stretch :&lt;br /&gt;
  deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main&lt;br /&gt;
&lt;br /&gt;
This package repository is handled via reprepro on pergamon.internal.softwareheritage.org (base directory : /srv/softwareheritage/repository).&lt;br /&gt;
&lt;br /&gt;
=== Uploading packages ===&lt;br /&gt;
&lt;br /&gt;
Packages are added to the repository using &amp;lt;tt&amp;gt;reprepro -vb /srv/softwareheritage/repository processincoming incoming&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For packages to be accepted, they need to be :&lt;br /&gt;
# A changes file uploaded to &amp;lt;tt&amp;gt;/srv/softwareheritage/repository/incoming&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Targetted at one of the supported distributions (unstable, unstable-swh, stretch, stretch-backports, stretch-backports-swh), jessie, jessie-backports, jessie-backports-swh)&lt;br /&gt;
# Signed by one of the keys listed in /srv/softwareheritage/repository/conf/uploaders&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Git repositories for Debian packages ==&lt;br /&gt;
&lt;br /&gt;
Our git repository structure for Debian packages is compatible with &amp;lt;tt&amp;gt;git-buildpackage&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We have two different ways of handling repositories for Debian packages:&lt;br /&gt;
* Packages of python modules where *we* are upstream&lt;br /&gt;
* Packages of dependencies from another upstream (this also encompasses upstream Debian packages that we wish to backport for deployment)&lt;br /&gt;
&lt;br /&gt;
For these classes of packages, we have two sets of (identical) Jenkins jobs to handle building and uploading these packages to our package repository. The structure of the packaging branches for both classes is pretty much the same, the repositories only differ on how we handle upstream commits:&lt;br /&gt;
* Our own modules are merged with the upstream repository&lt;br /&gt;
* External dependencies ignore the upstream repository and only have packaging branches.&lt;br /&gt;
&lt;br /&gt;
=== Branch and tags structure ===&lt;br /&gt;
&lt;br /&gt;
Our debian packaging Jenkins jobs expect the following branches, which are pretty close to what https://dep-team.pages.debian.net/deps/dep14/ mandates:&lt;br /&gt;
* debian/upstream (history of unpacked upstream releases)&lt;br /&gt;
* debian/&amp;lt;suite&amp;gt; (history of the packaging of the given suite, e.g. unstable-swh, stretch-swh)&lt;br /&gt;
* pristine-tar (data to regenerate upstream tarballs from a git export)&lt;br /&gt;
&lt;br /&gt;
The name of the debian/upstream branch doesn't matter ''as long as it's properly configured in the &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt; file''. It's only really used by &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; when importing a new release.&lt;br /&gt;
&lt;br /&gt;
The tags marking upstream releases imported from tarballs for Debian packaging purposes are named &amp;lt;tt&amp;gt;debian/upstream/''&amp;lt;upstream version number&amp;gt;''&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Our Jenkins jobs are triggered on incoming tags named &amp;lt;tt&amp;gt;debian/''&amp;lt;version&amp;gt;''&amp;lt;/tt&amp;gt;. To generate the proper tags, use &amp;lt;tt&amp;gt;gbp buildpackage --git-tag-only&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The git-buildpackage configuration, &amp;lt;tt&amp;gt;debian/gbp.conf&amp;lt;/tt&amp;gt;, should be the following:&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/''&amp;lt;current suite&amp;gt;''&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
&lt;br /&gt;
==== Automatic packaging for swh python modules ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;swh.*&amp;lt;/tt&amp;gt; python modules have an extra jenkins job that updates the packaging automatically when we do an upstream release. This job only runs &amp;lt;tt&amp;gt;gbp import-orig&amp;lt;/tt&amp;gt; with the tarball we release to PyPI, and the right options to merge the upstream history.&lt;br /&gt;
&lt;br /&gt;
To merge changes from the upstream history, we add the following option to &amp;lt;tt&amp;gt;gbp.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 upstream-vcs-tag=v%(version)s&lt;br /&gt;
&lt;br /&gt;
=== Bootstrapping a dependency packaging repository ===&lt;br /&gt;
&lt;br /&gt;
Bootstrapping the packaging repository for a dependency is analoguous to regular Debian practices:&lt;br /&gt;
&lt;br /&gt;
Download the upstream tarball. For PyPI, use the redirector at http://pypi.debian.net/&amp;lt;pkgname&amp;gt;/&lt;br /&gt;
 wget http://pypi.debian.net/pytest-postgresql/pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Create a new git repository&lt;br /&gt;
 mkdir pytest-postgresql&lt;br /&gt;
 cd pytest-postgresql&lt;br /&gt;
 git init&lt;br /&gt;
&lt;br /&gt;
Import the original upstream version&lt;br /&gt;
 git checkout -b debian/unstable-swh&lt;br /&gt;
 gbp import-orig --pristine-tar --upstream-branch=debian/upstream --upstream-tag=debian/upstream/%(version)s --debian-branch=debian/unstable-swh ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
 # What will be the source package name? [pytest-postgresql] &lt;br /&gt;
 # What is the upstream version? [1.3.4] &lt;br /&gt;
 # gbp:info: Importing '../pytest-postgresql-1.3.4.tar.gz' to branch 'debian/upstream'...&lt;br /&gt;
 # gbp:info: Source package is pytest-postgresql&lt;br /&gt;
 # gbp:info: Upstream version is 1.3.4&lt;br /&gt;
 # gbp:info: Successfully imported version 1.3.4 of ../pytest-postgresql-1.3.4.tar.gz&lt;br /&gt;
&lt;br /&gt;
Bootstrap the debian directory&lt;br /&gt;
 mkdir debian&lt;br /&gt;
 mkdir debian/source&lt;br /&gt;
 echo '3.0 (quilt)' &amp;gt; debian/source/format&lt;br /&gt;
 cat &amp;gt; debian/gbp.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 upstream-branch=debian/upstream&lt;br /&gt;
 upstream-tag=debian/upstream/%(version)s&lt;br /&gt;
 debian-branch=debian/unstable-swh&lt;br /&gt;
 pristine-tar=True&lt;br /&gt;
 EOF&lt;br /&gt;
 cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules&lt;br /&gt;
 vim debian/control&lt;br /&gt;
 # [...] adapt debian/control from another package&lt;br /&gt;
 dch --create --package pytest-postgresql --newversion 1.3.4-1+swh1&lt;br /&gt;
 vim debian/copyright&lt;br /&gt;
 # [...] adapt debian/copyright from another package&lt;br /&gt;
 git add debian&lt;br /&gt;
 git commit -m &amp;quot;Initial packaging for pytest-postgresql&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can then go on to try building the package. Once the package builds, if you want to check your package's conformance to Debian policy, you can run &amp;lt;tt&amp;gt;lintian&amp;lt;/tt&amp;gt; on the changes:&lt;br /&gt;
 lintian -EI ../pytest-postgresql_1.3.4-1+swh1_amd64.changes&lt;br /&gt;
&lt;br /&gt;
Note that you have to ignore warnings about unknown distributions, as we're building specifically for our repository&lt;br /&gt;
&lt;br /&gt;
We need to use a &amp;lt;tt&amp;gt;+swh1&amp;lt;/tt&amp;gt; version suffix to avoid clashing with potential upstream Debian package versions.&lt;br /&gt;
&lt;br /&gt;
==== Bootstrapping the backport branches ====&lt;br /&gt;
&lt;br /&gt;
During most of the operation, backports should happen automatically as we have a Jenkins job that generates backports on successful builds. However, when creating a packaging repository, we need to bootstrap the branches once, before Jenkins is able to do the work automatically.&lt;br /&gt;
&lt;br /&gt;
The backport branches should (ideally) be bootstrapped from a debian tag that has successfully built on Jenkins.&lt;br /&gt;
&lt;br /&gt;
Checkout the new branch&lt;br /&gt;
 git checkout debian/&amp;lt;version number&amp;gt;&lt;br /&gt;
 git checkout -b debian/stretch-swh&lt;br /&gt;
&lt;br /&gt;
Update the gbp config to match the branch&lt;br /&gt;
 sed -i s/unstable-swh/stretch-swh/ debian/gbp.conf&lt;br /&gt;
&lt;br /&gt;
Generate the initial backports entry. Use the current Debian version number (9 for stretch, 10 for buster, ...)&lt;br /&gt;
 dch -l ~bpo9 -D stretch-swh --force-distribution 'Rebuild for stretch-swh'&lt;br /&gt;
&lt;br /&gt;
You should then be able to try a local package build, and if that succeeds, to push the tag for Jenkins to autobuild.&lt;br /&gt;
&lt;br /&gt;
==== Setting up the repository on Phabricator ====&lt;br /&gt;
&lt;br /&gt;
The repository on Phabricator needs the following settings:&lt;br /&gt;
* Callsign: non-empty (prefix should be P according to https://wiki.softwareheritage.org/wiki/Phabricator_callsign_naming_convention)&lt;br /&gt;
* Short name: non-empty (used to make pretty git clone URLs; ideally matching the source package name)&lt;br /&gt;
* Repository tags: &amp;quot;Has debian packaging branches&amp;quot; (allows Jenkins to push on the debian/* branches)&lt;br /&gt;
* Policy&lt;br /&gt;
** View: Public (no login required)&lt;br /&gt;
** Edit: Developers&lt;br /&gt;
** Push: All users (actual restrictions are handled by Herald rules)&lt;br /&gt;
* Activate the repository&lt;br /&gt;
* Look up the path to the repository on the storage tab&lt;br /&gt;
&lt;br /&gt;
You need to setup the post-receive hook for Jenkins to be able to trigger on tag pushes.&lt;br /&gt;
 ssh -t tate.internal.softwareheritage.org phabricator-setup-hook &amp;lt;repository-path&amp;gt; post-receive-debian-deps&lt;br /&gt;
&lt;br /&gt;
==== Setting up the Jenkins jobs ====&lt;br /&gt;
&lt;br /&gt;
The Jenkins jobs are accessible through the ui: https://jenkins.softwareheritage.org/view/Debian%20dependency%20packages/&lt;br /&gt;
They are declared in the repository: https://forge.softwareheritage.org/source/swh-jenkins-jobs&lt;br /&gt;
&lt;br /&gt;
Jobs for dependency packages are configured in &amp;lt;tt&amp;gt;jobs/dependency-packages.yaml&amp;lt;/tt&amp;gt;. You can add a section as follows:&lt;br /&gt;
&lt;br /&gt;
 - project:&lt;br /&gt;
     name: &amp;lt;Callsign&amp;gt;&lt;br /&gt;
     display-name: &amp;lt;short-name&amp;gt;&lt;br /&gt;
     pkg: &amp;lt;source-name&amp;gt;&lt;br /&gt;
     jobs:&lt;br /&gt;
       - 'dependency-jobs-{name}'&lt;br /&gt;
&lt;br /&gt;
Use the regular review process to land your changes.&lt;br /&gt;
Once your changes are pushed, a dedicated Jenkins job will generate the jobs from the configuration.&lt;br /&gt;
&lt;br /&gt;
If your package needs extra repositories to build, you can add them as comma-separated values to the &amp;lt;tt&amp;gt;deb-extra-repositories&amp;lt;/tt&amp;gt; setting, with the following notes:&lt;br /&gt;
* When building packages for the &amp;quot;*-swh&amp;quot; suites, the Software Heritage Debian repository is automatically enabled.&lt;br /&gt;
* When building packages for backports suites, the backports repository is automatically enabled.&lt;br /&gt;
&lt;br /&gt;
=== Local package building ===&lt;br /&gt;
&lt;br /&gt;
To locally test a package build, go on the appropriate debian packaging branch, and run&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --no-clean-source&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; passes all options not starting with &amp;lt;tt&amp;gt;--git-&amp;lt;/tt&amp;gt; to the builder. Some useful options are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;--git-ignore-new&amp;lt;/tt&amp;gt; builds from the working tree, with all the uncommitted changes. Useful for quick iteration when something *just* *doesn't* *work*.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--no-clean-source&amp;lt;/tt&amp;gt; doesn't run debian/rules clean outside of the chroot, so you don't have to clutter your dev machine with all build dependencies&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository=&amp;quot;'''repository specification'''&amp;quot;&amp;lt;/tt&amp;gt; adds the given repository in the chroot before building.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-repository-key='''repository signing key'''&amp;lt;/tt&amp;gt; adds the given key as a trusted gpg key for package sources&lt;br /&gt;
* &amp;lt;tt&amp;gt;--extra-package='''&amp;lt;.deb file or directory&amp;gt;'''&amp;lt;/tt&amp;gt; makes the given package (or all .deb packages in the given directory) available for dependency resolution. Useful when testing builds with a dependency chain.&lt;br /&gt;
* &amp;lt;tt&amp;gt;--force-orig-source&amp;lt;/tt&amp;gt; forces addition of the &amp;lt;tt&amp;gt;.orig.tar.gz&amp;lt;/tt&amp;gt; file in the &amp;lt;tt&amp;gt;.changes&amp;lt;/tt&amp;gt; file (useful when trying to upload a backport)&lt;br /&gt;
&lt;br /&gt;
See &amp;lt;tt&amp;gt;gbp help buildpackage&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man sbuild&amp;lt;/tt&amp;gt; for a full description of all options&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
 gbp buildpackage --git-builder=sbuild -As --force-orig-source --extra-repository='deb [trusted=yes] https://debian.softwareheritage.org/ stretch-swh main'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(TODO: rewrite bin/make-package as bin/swh-gbp-buildpackage wrapping &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; with the most common options)&lt;br /&gt;
&lt;br /&gt;
=== Remote package building ===&lt;br /&gt;
&lt;br /&gt;
Jenkins builds packages when the repository receives a tag.&lt;br /&gt;
&lt;br /&gt;
Once the local build succeeds, tag the package with:&lt;br /&gt;
 gbp buildpackage --git-tag-only --git-sign-tags&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can add the &amp;lt;tt&amp;gt;--git-tag&amp;lt;/tt&amp;gt; option to your &amp;lt;tt&amp;gt;gbp buildpackage&amp;lt;/tt&amp;gt; command so the tag happens automatically on a successful build.&lt;br /&gt;
&lt;br /&gt;
Then, push your tag, and Jenkins jobs should get triggered&lt;br /&gt;
 git push --tags&lt;br /&gt;
&lt;br /&gt;
== Build Environment setup ==&lt;br /&gt;
&lt;br /&gt;
Our automated packaging setup uses sbuild, which is also used by the Debian build daemons themselves. This section shows how to set it up for local use.&lt;br /&gt;
&lt;br /&gt;
=== sbuild setup ===&lt;br /&gt;
&lt;br /&gt;
 # Install the package&lt;br /&gt;
 sudo apt-get install sbuild&lt;br /&gt;
 &lt;br /&gt;
 # Add your user to the sbuild group, to allow him to use the sbuild commands&lt;br /&gt;
 sudo sbuild-adduser $USER&lt;br /&gt;
 # You have to logout and log back in&lt;br /&gt;
 &lt;br /&gt;
 # Prepare chroots&lt;br /&gt;
 sudo mkdir /srv/chroots&lt;br /&gt;
 sudo mkdir /srv/chroots/var&lt;br /&gt;
 &lt;br /&gt;
 # Optionally create a separate filesystem for /srv/chroots and move the sbuild/schroot data to that partition&lt;br /&gt;
 sudo rsync -avz --delete /var/lib/schroot/ /srv/chroots/var/schroot/&lt;br /&gt;
 sudo rm -r /var/lib/schroot&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/schroot /var/lib/schroot&lt;br /&gt;
 &lt;br /&gt;
 sudo rsync -avz --delete /var/lib/sbuild/ /srv/chroots/var/sbuild/&lt;br /&gt;
 sudo rm -r /var/lib/sbuild&lt;br /&gt;
 sudo ln -sf /srv/chroots/var/sbuild /var/lib/sbuild&lt;br /&gt;
 # end optionally&lt;br /&gt;
 &lt;br /&gt;
 # Create unstable/sid chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates sid /srv/chroots/sid http://deb.debian.org/debian/&lt;br /&gt;
 &lt;br /&gt;
 # Create stretch chroot&lt;br /&gt;
 sudo sbuild-createchroot --include apt-transport-https,ca-certificates stretch /srv/chroots/stretch http://deb.debian.org/debian/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 # If you use /etc/hosts to resolve *.internal.softwareheritage.org hosts&lt;br /&gt;
 echo hosts &amp;gt;&amp;gt; /etc/schroot/sbuild/nssdatabases&lt;br /&gt;
&lt;br /&gt;
=== schroot setup ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
You need to update the configuration (in &amp;lt;tt&amp;gt;/etc/schroot/chroot.d/*-sbuild-*&amp;lt;/tt&amp;gt;) with the following directives:&lt;br /&gt;
&lt;br /&gt;
 source-groups=root,sbuild&lt;br /&gt;
 source-root-groups=root,sbuild&lt;br /&gt;
 union-type=overlay&lt;br /&gt;
&lt;br /&gt;
This allows the sbuild group to edit the contents of the source chroot (for instance to update it) and sets up the overlay.&lt;br /&gt;
&lt;br /&gt;
You should also use this opportunity to add &amp;quot;aliases&amp;quot; to your chroot, so that sbuild will directly support the distributions we're using (unstable-swh, jessie-backports-swh):&lt;br /&gt;
&lt;br /&gt;
For unstable:&lt;br /&gt;
 aliases=unstable-amd64-sbuild,UNRELEASED-amd64-sbuild,unstable-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
For stretch:&lt;br /&gt;
 aliases=stable-amd64-sbuild,stable-backports-amd64-sbuild,stretch-swh-amd64-sbuild,stretch-backports-amd64-sbuild,stretch-backports-swh-amd64-sbuild&lt;br /&gt;
&lt;br /&gt;
==== dependencies cache ====&lt;br /&gt;
&lt;br /&gt;
Add the following line to schroot's fstab /etc/schroot/sbuild/fstab&lt;br /&gt;
to permit reuse of existing fetched dependencies:&lt;br /&gt;
&lt;br /&gt;
 /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0&lt;br /&gt;
&lt;br /&gt;
You can also run apt-cacher-ng, which will avoid locking issues when several chroots try to access the package cache at once. You then need to add the proxy configuration to apt by adding a file in &amp;lt;tt&amp;gt;/etc/apt/apt.conf.d&amp;lt;/tt&amp;gt; on each chroot&lt;br /&gt;
&lt;br /&gt;
=== schroot update ===&lt;br /&gt;
&lt;br /&gt;
You should update your chroot environments once in a while (to avoid repeating over and over the same step during your package build):&lt;br /&gt;
&lt;br /&gt;
  sudo sbuild-update -udcar sid; sudo sbuild-update -udcar stretch; sudo sbuild-update -ud jessie &lt;br /&gt;
&lt;br /&gt;
=== environment setup ===&lt;br /&gt;
&lt;br /&gt;
The Debian tools use a few variables to preset your name and email. Add this to your &amp;lt;tt&amp;gt;.&amp;lt;shell&amp;gt;rc&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export DEBFULLNAME=&amp;quot;Debra Hacker&amp;quot;&lt;br /&gt;
 export DEBEMAIL=debra.hacker@example.com&lt;br /&gt;
&lt;br /&gt;
Make sure this data matches an uid for your GPG key. Else, you can use the &amp;lt;tt&amp;gt;DEBSIGN_KEYID=&amp;lt;yourfullkeyid&amp;gt;&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
(Future version of gpg2, e.g. 2.2.5 can refuse to sign with the short key id).&lt;br /&gt;
&lt;br /&gt;
=== overlay in tmpfs for faster builds ===&lt;br /&gt;
&lt;br /&gt;
You can add this to your fstab to put the overlay hierarchy in RAM:&lt;br /&gt;
&lt;br /&gt;
  tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0750,nr_inodes=0  0  0&lt;br /&gt;
&lt;br /&gt;
=== Base packages ===&lt;br /&gt;
&lt;br /&gt;
In order not to reinstall the same packages every time, it is also reasonable to install debhelper, python3 and python3-all in the chroot.&lt;br /&gt;
&lt;br /&gt;
'''If you do so, do not use these chroots to upload to Debian itself!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software development]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019&amp;diff=951</id>
		<title>Google Summer of Code 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019&amp;diff=951"/>
		<updated>2019-02-05T13:34:17Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Improve and extend the archive Web UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:GSoCLogo.png|1024px]]&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
This page is the central point of information for [[Software Heritage]] participation into the [https://summerofcode.withgoogle.com/ Google Summer of Code] program.&lt;br /&gt;
&lt;br /&gt;
Google Summer of Code is a program where Google pays students stipends to work over the (northern hemisphere) summer on free software projects such as Software Heritage. Each student works with mentors from the community to complete a software project.&lt;br /&gt;
&lt;br /&gt;
== I want to participate as a student ==&lt;br /&gt;
&lt;br /&gt;
Great!, we are very glad for your interest in contributing to Software Heritage and we are looking forward to work together.&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
The following prerequisites apply to Software Heritage GSoC projects:&lt;br /&gt;
&lt;br /&gt;
* [https://www.python.org Python] 3 is our language of choice, you should be fluent with that language to apply&lt;br /&gt;
* [https://git-scm.com Git] is our version control system of choice, you should be familiar with it to apply&lt;br /&gt;
* additional prerequisites depend on the project you will work on; check project descriptions for details&lt;br /&gt;
&lt;br /&gt;
=== Before you apply ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps you should follow before applying, to make sure you have a good grasp of what we are doing at Software Heritage and how we do it:&lt;br /&gt;
&lt;br /&gt;
# Follow our [https://docs.softwareheritage.org/devel/getting-started.html getting started guide]: it will make sure you can locally run a (small) copy of the archive and ingest source code into it&lt;br /&gt;
# Create an account our [https://forge.softwareheritage.org development forge]&lt;br /&gt;
# Familiarize yourself with our [[Code review in Phabricator|code review workflow]]&lt;br /&gt;
# Make a simple change to any one of our [https://docs.softwareheritage.org/devel/ software components] and submit it as a [https://forge.softwareheritage.org/differential/ diff] for code review, following the above workflow. [[Easy hacks]] and [https://forge.softwareheritage.org/project/view/20/ Web UI] issues are good options for what to fix, but feel free to submit any patch you think it might be useful.&lt;br /&gt;
&lt;br /&gt;
=== What to include in your application ===&lt;br /&gt;
&lt;br /&gt;
Make sure that your application includes the following information:&lt;br /&gt;
&lt;br /&gt;
* Describe the '''specific project''' you want to work on. What do you want to achieve? Why is it important? Why is it useful for Software Heritage? The project might be one of the project ideas that we have prepared, or something else entirely that you want to contribute to Software Heritage. Your source code archival pet peeve, surprise us!&lt;br /&gt;
* Detail your '''work plan''': a brief description of how you plan to go about your project, including a list of  ''deliverables'' and a ''timeline'' of when do you expect them to be available.&lt;br /&gt;
* Include a reference to '''the diff''' you submitted before applying (see the &amp;quot;Before you apply&amp;quot; section above).&lt;br /&gt;
&lt;br /&gt;
== Ideas list ==&lt;br /&gt;
&lt;br /&gt;
Below you can find a list of project ideas that are good options for a reasonably sized GSoC project.&lt;br /&gt;
They are just suggestion though, don't feel obliged to pick one of them if there is nothing that fits your taste and abilities.&lt;br /&gt;
Feel free to propose something else that you are excited about and that contributes to improve the Software Heritage archive: we will be happy to consider it!&lt;br /&gt;
&lt;br /&gt;
=== Increase archive coverage ===&lt;br /&gt;
&lt;br /&gt;
Software Heritage aims to archive '''all the software'''. We naturally started with the place where most of the software is easily available today: git repositories on GitHub.&lt;br /&gt;
&lt;br /&gt;
As Software Heritage grows, we're incrementally trying to increase the coverage of the archive by expanding the sources from which we archive software. We built ways of archiving things like mercurial repositories, Debian packages, pypi bundles, etc.&lt;br /&gt;
&lt;br /&gt;
Expanding the coverage of the archive has two different components:&lt;br /&gt;
&lt;br /&gt;
1. Create '''origin listers'''. Listers are pieces of code that crawl the APIs of Software Forges[https://en.wikipedia.org/wiki/Forge_(software)] (like Bitbucket, Gitorious, Sourceforge, NPM...)  and return a list of the software available in it. The documentation on listers is here: https://docs.softwareheritage.org/devel/swh-lister/index.html&lt;br /&gt;
&lt;br /&gt;
2. Create '''loaders'''. Loaders take a bundle of software (tarball, git repository, Python package, ...) and load it into Software Heritage, by adapting it so that it matches our uniform data model[https://docs.softwareheritage.org/devel/swh-model/data-model.html].&lt;br /&gt;
&lt;br /&gt;
In a few words, a lister can be a way of asking &amp;quot;what are all the repositories available on npm.org?&amp;quot;, while a loader would be &amp;quot;how do I load the NPM package I downloaded into Software Heritage?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Writing a lister or a loader is a great way to contribute to Software Heritage by expanding its coverage! We have a list of software sources we would like to archive here[https://wiki.softwareheritage.org/wiki/Suggestion_box:_source_code_to_add], but you're free to suggest more.&lt;br /&gt;
&lt;br /&gt;
=== Mine information from archived content ===&lt;br /&gt;
&lt;br /&gt;
'''TODO'''&lt;br /&gt;
&lt;br /&gt;
=== Improve and extend the archive Web UI ===&lt;br /&gt;
&lt;br /&gt;
In order to easily navigate into the archive content, a [https://forge.softwareheritage.org/source/swh-web/ web application] is currently developed.&lt;br /&gt;
So far it offers the following main features:&lt;br /&gt;
* programmatic access to the content of the archive via the [https://archive.softwareheritage.org/api/ Software Heritage API]&lt;br /&gt;
* in-browser navigation of the content of the archive via the [https://archive.softwareheritage.org/browse/ Software Heritage browse UI]&lt;br /&gt;
&lt;br /&gt;
There are still numerous improvements and new features to add to that web application, for instance:&lt;br /&gt;
* improve overall design&lt;br /&gt;
* improve navigation for mobile browsers&lt;br /&gt;
* add new source code search criteria and improve the search interface&lt;br /&gt;
* implement new developer oriented features: source file history, blame interface, ...&lt;br /&gt;
* improve web application [https://www.w3.org/WAI/ accessibility]&lt;br /&gt;
&lt;br /&gt;
If you are interested in web development and want to contribute to the application&lt;br /&gt;
enabling users to navigate in the biggest public source code archive collected so far,&lt;br /&gt;
feel free to apply.&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
&lt;br /&gt;
GSoC students are encouraged to get in touch with the Software Heritage community using the standard development communication channels, i.e.:&lt;br /&gt;
&lt;br /&gt;
* the #swh-devel IRC channel on [https://freenode.net Freenode]&lt;br /&gt;
* the [https://sympa.inria.fr/sympa/info/swh-devel swh-devel mailing list]&lt;br /&gt;
&lt;br /&gt;
See our [https://www.softwareheritage.org/community/developers/ development information page] for more details.&lt;br /&gt;
&lt;br /&gt;
== Timeline ==&lt;br /&gt;
&lt;br /&gt;
See the official [https://developers.google.com/open-source/gsoc/timeline Google Summer of Code timeline].&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019&amp;diff=949</id>
		<title>Google Summer of Code 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Google_Summer_of_Code_2019&amp;diff=949"/>
		<updated>2019-02-04T08:45:57Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* What to include in your application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:GSoCLogo.png|1024px]]&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
This page is the central point of information for [[Software Heritage]] participation into the [https://summerofcode.withgoogle.com/ Google Summer of Code] program.&lt;br /&gt;
&lt;br /&gt;
Google Summer of Code is a program where Google pays students stipends to work over the (northern hemisphere) summer on free software projects such as Software Heritage. Each student works with mentors from the community to complete a software project.&lt;br /&gt;
&lt;br /&gt;
== I want to participate as a student ==&lt;br /&gt;
&lt;br /&gt;
Great!, we are very glad for your interest in contributing to Software Heritage and we are looking forward to work together.&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
The following prerequisites apply to Software Heritage GSoC projects:&lt;br /&gt;
&lt;br /&gt;
* [https://www.python.org Python] 3 is our language of choice, you should be fluent with that language to apply&lt;br /&gt;
* [https://git-scm.com Git] is our version control system of choice, you should be familiar with it to apply&lt;br /&gt;
* additional prerequisites depend on the project you will work on; check project descriptions for details&lt;br /&gt;
&lt;br /&gt;
=== Before you apply ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps you should follow before applying, to make sure you have a good grasp of what we are doing at Software Heritage and how we do it:&lt;br /&gt;
&lt;br /&gt;
# Follow our [https://docs.softwareheritage.org/devel/getting-started.html getting started guide]: it will make sure you can locally run a (small) copy of the archive and ingest source code into it&lt;br /&gt;
# Create an account our [https://forge.softwareheritage.org development forge]&lt;br /&gt;
# Familiarize yourself with our [[Code review in Phabricator|code review workflow]]&lt;br /&gt;
# Make a simple change to any one of our [https://docs.softwareheritage.org/devel/ software components] and submit it as a [https://forge.softwareheritage.org/differential/ diff] for code review, following the above workflow. [[Easy hacks]] and [https://forge.softwareheritage.org/project/view/20/ Web UI] issues are good options for what to fix, but feel free to submit any patch you think it might be useful.&lt;br /&gt;
&lt;br /&gt;
=== What to include in your application ===&lt;br /&gt;
&lt;br /&gt;
Make sure that your application includes the following information:&lt;br /&gt;
&lt;br /&gt;
* Describe the '''specific project''' you want to work on. What do you want to achieve? Why is it important? Why is it useful for Software Heritage? The project might be one of the project ideas that we have prepared, or something else entirely that you want to contribute to Software Heritage. Your source code archival pet peeve, surprise us!&lt;br /&gt;
* Detail your '''work plan''': a brief description of how you plan to go about your project, including a list of  ''deliverables'' and a ''timeline'' of when do you expect them to be available.&lt;br /&gt;
* Include a reference to '''the diff''' you submitted before applying (see the &amp;quot;Before you apply&amp;quot; section above).&lt;br /&gt;
&lt;br /&gt;
== Ideas list ==&lt;br /&gt;
&lt;br /&gt;
Below you can find a list of project ideas that are good options for a reasonably sized GSoC project.&lt;br /&gt;
They are just suggestion though, don't feel obliged to pick one of them if there is nothing that fits your taste and abilities.&lt;br /&gt;
Feel free to propose something else that you are excited about and that contributes to improve the Software Heritage archive: we will be happy to consider it!&lt;br /&gt;
&lt;br /&gt;
=== Increase archive coverage ===&lt;br /&gt;
&lt;br /&gt;
Software Heritage aims to archive '''all the software'''. We naturally started with the place where most of the software is easily available today: git repositories on GitHub.&lt;br /&gt;
&lt;br /&gt;
As Software Heritage grows, we're incrementally trying to increase the coverage of the archive by expanding the sources from which we archive software. We built ways of archiving things like mercurial repositories, Debian packages, pypi bundles, etc.&lt;br /&gt;
&lt;br /&gt;
Expanding the coverage of the archive has two different components:&lt;br /&gt;
&lt;br /&gt;
1. Create '''origin listers'''. Listers are pieces of code that crawl the APIs of Software Forges[https://en.wikipedia.org/wiki/Forge_(software)] (like Bitbucket, Gitorious, Sourceforge, NPM...)  and return a list of the software available in it. The documentation on listers is here: https://docs.softwareheritage.org/devel/swh-lister/index.html&lt;br /&gt;
&lt;br /&gt;
2. Create '''loaders'''. Loaders take a bundle of software (tarball, git repository, Python package, ...) and load it into Software Heritage, by adapting it so that it matches our uniform data model[https://docs.softwareheritage.org/devel/swh-model/data-model.html].&lt;br /&gt;
&lt;br /&gt;
In a few words, a lister can be a way of asking &amp;quot;what are all the repositories available on npm.org?&amp;quot;, while a loader would be &amp;quot;how do I load the NPM package I downloaded into Software Heritage?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Writing a lister or a loader is a great way to contribute to Software Heritage by expanding its coverage! We have a list of software sources we would like to archive here[https://wiki.softwareheritage.org/wiki/Suggestion_box:_source_code_to_add], but you're free to suggest more.&lt;br /&gt;
&lt;br /&gt;
=== Mine information from archived content ===&lt;br /&gt;
&lt;br /&gt;
'''TODO'''&lt;br /&gt;
&lt;br /&gt;
=== Improve and extend the archive Web UI ===&lt;br /&gt;
&lt;br /&gt;
'''TODO'''&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
&lt;br /&gt;
GSoC students are encouraged to get in touch with the Software Heritage community using the standard development communication channels, i.e.:&lt;br /&gt;
&lt;br /&gt;
* the #swh-devel IRC channel on [https://freenode.net Freenode]&lt;br /&gt;
* the [https://sympa.inria.fr/sympa/info/swh-devel swh-devel mailing list]&lt;br /&gt;
&lt;br /&gt;
See our [https://www.softwareheritage.org/community/developers/ development information page] for more details.&lt;br /&gt;
&lt;br /&gt;
== Timeline ==&lt;br /&gt;
&lt;br /&gt;
See the official [https://developers.google.com/open-source/gsoc/timeline Google Summer of Code timeline].&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=850</id>
		<title>Streaming Replication</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=850"/>
		<updated>2018-06-15T09:38:22Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Fix sentence phrasing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Migrated to [https://intranet.softwareheritage.org/index.php?title=Streaming_Replication intranet].&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=849</id>
		<title>Streaming Replication</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=849"/>
		<updated>2018-06-15T09:38:05Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Move page to the intranet (was wrongly created here, no credentials leaked or anything anyway)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Move away to [https://intranet.softwareheritage.org/index.php?title=Streaming_Replication intranet].&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=848</id>
		<title>Streaming Replication</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=848"/>
		<updated>2018-06-15T09:30:40Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Fix _, sub issues&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Following steps are described how to setup the streaming replication&lt;br /&gt;
between a master and slave.&lt;br /&gt;
&lt;br /&gt;
= Master =&lt;br /&gt;
== Master information ==&lt;br /&gt;
Example db:&lt;br /&gt;
&lt;br /&gt;
* host: somerset.internal.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
* port: 5434&lt;br /&gt;
&lt;br /&gt;
* db: softwareheritage-indexer&lt;br /&gt;
&lt;br /&gt;
== Replication user needed ==&lt;br /&gt;
Make sure a replication user exists on the master server&lt;br /&gt;
&lt;br /&gt;
    su - postgres&lt;br /&gt;
    createuser -p 5434 replicator --replication&lt;br /&gt;
    psql -p 5434 template1&lt;br /&gt;
    alter user replicator with password '&amp;lt;precious-secret&amp;gt;';&lt;br /&gt;
&lt;br /&gt;
Note: To retrieve the password.&lt;br /&gt;
&lt;br /&gt;
    swhpass ls infra/somerset/postgres/5434/replicator&lt;br /&gt;
&lt;br /&gt;
== Postgres configuration adaptation ==&lt;br /&gt;
=== pg_hba.conf ===&lt;br /&gt;
File: /etc/postgresql/10/indexer/pg_hba.conf&lt;br /&gt;
&lt;br /&gt;
    # TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD&lt;br /&gt;
    host    replication     replicator      192.168.200.0/21        md5	# Azure&lt;br /&gt;
&lt;br /&gt;
=== postgresql.conf ===&lt;br /&gt;
File: /etc/postgresql/10/indexer/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
    wal_level = replica      # or higher, logical is fine&lt;br /&gt;
    wal_keep_segments = 500  # in logfile segments, 16MB each; 0 disables&lt;br /&gt;
    wal_compression = on     # enable compression of full-page writes&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* wal_compression is an optimization which reduces I/O and network&lt;br /&gt;
  traffic at the expense of CPU time. It is not required.&lt;br /&gt;
&lt;br /&gt;
* wal_keep_segments needs to be set to a reasonable value in order to&lt;br /&gt;
  keep enough wal data between the initial database backup and its&lt;br /&gt;
  subsequent regular startup on the slave. Slave startup can fail at&lt;br /&gt;
  first, so make sure to have at least a couple hours of slack in case&lt;br /&gt;
  things go wrong.&lt;br /&gt;
&lt;br /&gt;
== Restart db ==&lt;br /&gt;
Make the db aware of those changes:&lt;br /&gt;
&lt;br /&gt;
    # to determine the main pid of the concerned db&lt;br /&gt;
    sudo systemctl status postgres@10-indexer.service&lt;br /&gt;
    # Actually make the db aware&lt;br /&gt;
    # kill -HUP &amp;lt;pid-of-db&amp;gt;&lt;br /&gt;
    # or&lt;br /&gt;
    sudo systemctl restart postgres@10-indexer.service&lt;br /&gt;
&lt;br /&gt;
= Slave =&lt;br /&gt;
== Package Dependencies ==&lt;br /&gt;
Install client for connection part, and server for replication one.&lt;br /&gt;
&lt;br /&gt;
    # client part and server&lt;br /&gt;
    sudo apt install postgresql-client-10 postgresl-10&lt;br /&gt;
&lt;br /&gt;
== Postgres setup ==&lt;br /&gt;
Make sure the connection is ok.&lt;br /&gt;
&lt;br /&gt;
As postgres user:&lt;br /&gt;
&lt;br /&gt;
    su - postgres&lt;br /&gt;
    touch .pgpass&lt;br /&gt;
    cat &amp;gt; .pgpass &amp;lt;&amp;lt;EOF&lt;br /&gt;
    somerset.internal.softwareheritage.org:5434:replication:replicator:&amp;lt;precious-secret&amp;gt;&lt;br /&gt;
    EOF&lt;br /&gt;
    chmod 0600 .pgpass&lt;br /&gt;
    # should permit connection&lt;br /&gt;
&lt;br /&gt;
== Create replica cluster ==&lt;br /&gt;
This is a necessary and temporary step to permit to initialize&lt;br /&gt;
configuration files that would need editing down the line.&lt;br /&gt;
&lt;br /&gt;
    # drop installed main cluster as this won't be used&lt;br /&gt;
    sudo pg_dropcluster --stop 10 main&lt;br /&gt;
    # prepare directories in data volume&lt;br /&gt;
    sudo mkdir /srv/softwareheritage/postgres&lt;br /&gt;
    sudo chown postgres:postgres /srv/softwareheritage/postgres&lt;br /&gt;
      # create the cluster configuration&lt;br /&gt;
    sudo -u postgres env LC_ALL=C.UTF-8 \&lt;br /&gt;
        pg_createcluster 10 replica \&lt;br /&gt;
            -D /srv/softwareheritage/postgres/10/replica \&lt;br /&gt;
            -p 5434&lt;br /&gt;
&lt;br /&gt;
== Make sure the slave can connect to the master ==&lt;br /&gt;
Edit the local configuration according to the master.  The slave must&lt;br /&gt;
have the at least the same boundaries for some configuration options:&lt;br /&gt;
&lt;br /&gt;
file: /etc/postgresql/10/replica/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
    max_connections = 128      # same as master somerset.internal.softwareheritage.org:5434:softwareheritage-indexer&lt;br /&gt;
    max_worker_processes = 10  # same as master somerset.internal.softwareheritage.org:5434:softwareheritage-indexer&lt;br /&gt;
&lt;br /&gt;
Note: You will be notified in logs when trying to start the db that&lt;br /&gt;
some setup are not correctly set.  Some form of:&lt;br /&gt;
&lt;br /&gt;
    ardumont@dbreplica1 $ sudo journalctl -xef -u postgresql@10-replica.service&lt;br /&gt;
    ...&lt;br /&gt;
    Jun 15 08:13:24 dbreplica1 postgresql@10-replica[654]: 2018-06-15 08:13:24.425 UTC [664] FATAL:  hot standby is not possible because max_worker_processes = 8 is a lower setting than on the ma&lt;br /&gt;
    ster server (its value was 10)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
== Retrieve backup ==&lt;br /&gt;
From the replica node, as postgres user:&lt;br /&gt;
&lt;br /&gt;
    postgres@dbreplica1 $ pg_basebackup --progress --write-recovery-conf \&lt;br /&gt;
            -h somerset.internal.softwareheritage.org -p 5434 -U replicator \&lt;br /&gt;
            -D /srv/softwareheritage/postgres/10/somerset-swh-indexer.backup&lt;br /&gt;
&lt;br /&gt;
Note that this step could fail if your .pgpass is not setup correctly.&lt;br /&gt;
&lt;br /&gt;
== Install backup as db ==&lt;br /&gt;
Move the backup files to the regular pgdata location and start the&lt;br /&gt;
slave server:&lt;br /&gt;
&lt;br /&gt;
    postgres@dbreplica1 $ cd /srv/softwareheritage/postgres/10&lt;br /&gt;
    # Remove 'temporary' cluster&lt;br /&gt;
    postgres@dbreplica1 $ rm -rf replica&lt;br /&gt;
    # Rename the backup as replica&lt;br /&gt;
    postgres@dbreplica1 $ mv somerset-swh-indexer.backup replica&lt;br /&gt;
    ardumont@dbreplica1 $ sudo systemctl status postgresql@10-replica.service&lt;br /&gt;
&lt;br /&gt;
== Start cluser ==&lt;br /&gt;
Now that everything is ready, start the cluster.  This will start by&lt;br /&gt;
redoing the necessary steps to synchronize the dbs.&lt;br /&gt;
&lt;br /&gt;
    sudo systemctl start postgresql@10-replica.service&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=847</id>
		<title>Streaming Replication</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=847"/>
		<updated>2018-06-15T09:20:59Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: First iteration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Following steps are described how to setup the streaming replication&lt;br /&gt;
between a master and slave.&lt;br /&gt;
&lt;br /&gt;
= Master =&lt;br /&gt;
== Master information ==&lt;br /&gt;
Example db:&lt;br /&gt;
&lt;br /&gt;
* host: somerset.internal.softwareheritage.org&lt;br /&gt;
&lt;br /&gt;
* port: 5434&lt;br /&gt;
&lt;br /&gt;
* db: softwareheritage-indexer&lt;br /&gt;
&lt;br /&gt;
== Replication user needed ==&lt;br /&gt;
Make sure a replication user exists on the master server&lt;br /&gt;
&lt;br /&gt;
    su - postgres&lt;br /&gt;
    createuser -p 5434 replicator --replication&lt;br /&gt;
    psql -p 5434 template1&lt;br /&gt;
    alter user replicator with password '&amp;lt;precious-secret&amp;gt;';&lt;br /&gt;
&lt;br /&gt;
Note: To retrieve the password.&lt;br /&gt;
&lt;br /&gt;
    swhpass ls infra/somerset/postgres/5434/replicator&lt;br /&gt;
&lt;br /&gt;
== Postgres configuration adaptation ==&lt;br /&gt;
=== pg&amp;lt;sub&amp;gt;hba.conf&amp;lt;/sub&amp;gt; ===&lt;br /&gt;
File: /etc/postgresql/10/indexer/pg&amp;lt;sub&amp;gt;hba.conf&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    # TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD&lt;br /&gt;
    host    replication     replicator      192.168.200.0/21        md5	# Azure&lt;br /&gt;
&lt;br /&gt;
=== postgresql.conf ===&lt;br /&gt;
File: /etc/postgresql/10/indexer/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
    wal_level = replica      # or higher, logical is fine&lt;br /&gt;
    wal_keep_segments = 500  # in logfile segments, 16MB each; 0 disables&lt;br /&gt;
    wal_compression = on     # enable compression of full-page writes&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
* wal&amp;lt;sub&amp;gt;compression&amp;lt;/sub&amp;gt; is an optimization which reduces I/O and network&lt;br /&gt;
  traffic at the expense of CPU time. It is not required.&lt;br /&gt;
&lt;br /&gt;
* wal&amp;lt;sub&amp;gt;keep&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;segments&amp;lt;/sub&amp;gt; needs to be set to a reasonable value in order to&lt;br /&gt;
  keep enough wal data between the initial database backup and its&lt;br /&gt;
  subsequent regular startup on the slave. Slave startup can fail at&lt;br /&gt;
  first, so make sure to have at least a couple hours of slack in case&lt;br /&gt;
  things go wrong.&lt;br /&gt;
&lt;br /&gt;
== Restart db ==&lt;br /&gt;
Make the db aware of those changes:&lt;br /&gt;
&lt;br /&gt;
    # to determine the main pid of the concerned db&lt;br /&gt;
    sudo systemctl status postgres@10-indexer.service&lt;br /&gt;
    # Actually make the db aware&lt;br /&gt;
    # kill -HUP &amp;lt;pid-of-db&amp;gt;&lt;br /&gt;
    # or&lt;br /&gt;
    sudo systemctl restart postgres@10-indexer.service&lt;br /&gt;
&lt;br /&gt;
= Slave =&lt;br /&gt;
== Package Dependencies ==&lt;br /&gt;
Install client for connection part, and server for replication one.&lt;br /&gt;
&lt;br /&gt;
    # client part and server&lt;br /&gt;
    sudo apt install postgresql-client-10 postgresl-10&lt;br /&gt;
&lt;br /&gt;
== Postgres setup ==&lt;br /&gt;
Make sure the connection is ok.&lt;br /&gt;
&lt;br /&gt;
As postgres user:&lt;br /&gt;
&lt;br /&gt;
    su - postgres&lt;br /&gt;
    touch .pgpass&lt;br /&gt;
    cat &amp;gt; .pgpass &amp;lt;&amp;lt;EOF&lt;br /&gt;
    somerset.internal.softwareheritage.org:5434:replication:replicator:&amp;lt;precious-secret&amp;gt;&lt;br /&gt;
    EOF&lt;br /&gt;
    chmod 0600 .pgpass&lt;br /&gt;
    # should permit connection&lt;br /&gt;
&lt;br /&gt;
== Create replica cluster ==&lt;br /&gt;
This is a necessary and temporary step to permit to initialize&lt;br /&gt;
configuration files that would need editing down the line.&lt;br /&gt;
&lt;br /&gt;
    # drop installed main cluster as this won't be used&lt;br /&gt;
    sudo pg_dropcluster --stop 10 main&lt;br /&gt;
    # prepare directories in data volume&lt;br /&gt;
    sudo mkdir /srv/softwareheritage/postgres&lt;br /&gt;
    sudo chown postgres:postgres /srv/softwareheritage/postgres&lt;br /&gt;
      # create the cluster configuration&lt;br /&gt;
    sudo -u postgres env LC_ALL=C.UTF-8 \&lt;br /&gt;
        pg_createcluster 10 replica \&lt;br /&gt;
            -D /srv/softwareheritage/postgres/10/replica \&lt;br /&gt;
            -p 5434&lt;br /&gt;
&lt;br /&gt;
== Make sure the slave can connect to the master ==&lt;br /&gt;
Edit the local configuration according to the master.  The slave must&lt;br /&gt;
have the at least the same boundaries for some configuration options:&lt;br /&gt;
&lt;br /&gt;
file: /etc/postgresql/10/replica/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
    max_connections = 128      # same as master somerset.internal.softwareheritage.org:5434:softwareheritage-indexer&lt;br /&gt;
    max_worker_processes = 10  # same as master somerset.internal.softwareheritage.org:5434:softwareheritage-indexer&lt;br /&gt;
&lt;br /&gt;
Note: You will be notified in logs when trying to start the db that&lt;br /&gt;
some setup are not correctly set.  Some form of:&lt;br /&gt;
&lt;br /&gt;
    ardumont@dbreplica1 $ sudo journalctl -xef -u postgresql@10-replica.service&lt;br /&gt;
    ...&lt;br /&gt;
    Jun 15 08:13:24 dbreplica1 postgresql@10-replica[654]: 2018-06-15 08:13:24.425 UTC [664] FATAL:  hot standby is not possible because max_worker_processes = 8 is a lower setting than on the ma&lt;br /&gt;
    ster server (its value was 10)&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
== Retrieve backup ==&lt;br /&gt;
From the replica node, as postgres user:&lt;br /&gt;
&lt;br /&gt;
    postgres@dbreplica1 $ pg_basebackup --progress --write-recovery-conf \&lt;br /&gt;
            -h somerset.internal.softwareheritage.org -p 5434 -U replicator \&lt;br /&gt;
            -D /srv/softwareheritage/postgres/10/somerset-swh-indexer.backup&lt;br /&gt;
&lt;br /&gt;
Note that this step could fail if your .pgpass is not setup correctly.&lt;br /&gt;
&lt;br /&gt;
== Install backup as db ==&lt;br /&gt;
Move the backup files to the regular pgdata location and start the&lt;br /&gt;
slave server:&lt;br /&gt;
&lt;br /&gt;
    postgres@dbreplica1 $ cd /srv/softwareheritage/postgres/10&lt;br /&gt;
    # Remove 'temporary' cluster&lt;br /&gt;
    postgres@dbreplica1 $ rm -rf replica&lt;br /&gt;
    # Rename the backup as replica&lt;br /&gt;
    postgres@dbreplica1 $ mv somerset-swh-indexer.backup replica&lt;br /&gt;
    ardumont@dbreplica1 $ sudo systemctl status postgresql@10-replica.service&lt;br /&gt;
&lt;br /&gt;
== Start cluser ==&lt;br /&gt;
Now that everything is ready, start the cluster.  This will start by&lt;br /&gt;
redoing the necessary steps to synchronize the dbs.&lt;br /&gt;
&lt;br /&gt;
    sudo systemctl start postgresql@10-replica.service&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=846</id>
		<title>Streaming Replication</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=Streaming_Replication&amp;diff=846"/>
		<updated>2018-06-15T09:00:46Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Bootstrap streaming replication documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Postgres]]&lt;br /&gt;
[[Category:System administration]]&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
Related tasks&lt;br /&gt;
- https://forge.softwareheritage.org/T883&lt;br /&gt;
- https://forge.softwareheritage.org/T1094&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=845</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=845"/>
		<updated>2018-06-14T12:06:29Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Add category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to integrate external contribution =&lt;br /&gt;
New [https://forge.softwareheritage.org/D301 external contributions are starting].  Here is the current team&lt;br /&gt;
workflow defined on how to integrate them:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready. We should only be able to accept it if the contributor has already signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt;` for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;br /&gt;
&lt;br /&gt;
[[Category:Software_development]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=844</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=844"/>
		<updated>2018-06-14T11:55:27Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Add missing `&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to integrate external contribution =&lt;br /&gt;
New [https://forge.softwareheritage.org/D301 external contributions are starting].  Here is the current team&lt;br /&gt;
workflow defined on how to integrate them:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready. We should only be able to accept it if the contributor has already signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt;` for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=841</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=841"/>
		<updated>2018-06-14T10:02:38Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Simplify not using footnotes as i did not find out fast enough&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to integrate external contribution =&lt;br /&gt;
New [https://forge.softwareheritage.org/D301 external contributions are starting].  Here is the current team&lt;br /&gt;
workflow defined on how to integrate them:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready. We should only be able to accept it if the contributor has already&lt;br /&gt;
&lt;br /&gt;
signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt; for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=840</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=840"/>
		<updated>2018-06-14T09:53:49Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to integrate external contribution =&lt;br /&gt;
New external contributions are starting [1].  Here is the current team&lt;br /&gt;
workflow defined.&lt;br /&gt;
&lt;br /&gt;
We should:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready [2]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt; for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Footnotes ===&lt;br /&gt;
&lt;br /&gt;
[1] https://forge.softwareheritage.org/D301&lt;br /&gt;
https://forge.softwareheritage.org/D302&lt;br /&gt;
&lt;br /&gt;
[2] We should only be able to accept it if the contributor has already&lt;br /&gt;
signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=839</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=839"/>
		<updated>2018-06-14T09:47:56Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* External contribution integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= External contribution integration =&lt;br /&gt;
New external contributions are starting [1].  Here is the current team&lt;br /&gt;
workflow defined.&lt;br /&gt;
&lt;br /&gt;
We should:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready [2]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt; for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1] https://forge.softwareheritage.org/D301&lt;br /&gt;
https://forge.softwareheritage.org/D302&lt;br /&gt;
&lt;br /&gt;
[2] We should only be able to accept it if the contributor has already&lt;br /&gt;
signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=838</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=838"/>
		<updated>2018-06-14T09:47:29Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Improve readability&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= External contribution integration =&lt;br /&gt;
New external contributions are starting [1].  Here is the current team&lt;br /&gt;
workflow defined.&lt;br /&gt;
&lt;br /&gt;
We should:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready [2]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt; for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1] https://forge.softwareheritage.org/D301&lt;br /&gt;
    https://forge.softwareheritage.org/D302&lt;br /&gt;
&lt;br /&gt;
[2] We should only be able to accept it if the contributor has already&lt;br /&gt;
    signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=837</id>
		<title>External contribution integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=External_contribution_integration&amp;diff=837"/>
		<updated>2018-06-14T09:46:43Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: Bootstrap external contribution integration as a team workflow&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= External contribution integration =&lt;br /&gt;
New external contributions are starting [1].  Here is the current team&lt;br /&gt;
workflow defined.&lt;br /&gt;
&lt;br /&gt;
We should:&lt;br /&gt;
&lt;br /&gt;
* Review the diff and explain what's need adapting&lt;br /&gt;
&lt;br /&gt;
* Accept the diff if ready. We should only be able to accept it if the&lt;br /&gt;
  contributor has already signed the [https://wiki.softwareheritage.org/index.php?title=Contributor_License_Agreement CLA]&lt;br /&gt;
&lt;br /&gt;
* Integrate the patch using [https://wiki.softwareheritage.org/index.php?title=Arcanist arcanist]:&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/&amp;lt;repository-concerned-by-diff&amp;gt;&lt;br /&gt;
    PATCH_NAME=&amp;lt;patch-name&amp;gt;  # use the right patch name D301 for example&lt;br /&gt;
    CONTRIBUTOR_NAME=&amp;quot;&amp;lt;contributor-name&amp;gt;&amp;quot;  # use the right contributor's full name&lt;br /&gt;
    arc patch $PATCH_NAME&lt;br /&gt;
    # this will create a local commit amend the commit message if&lt;br /&gt;
    # necessary (added a `Close &amp;lt;concerned-task&amp;gt; for example)&lt;br /&gt;
    echo $CONTRIBUTOR_NAME &amp;gt;&amp;gt; CONTRIBUTORS&lt;br /&gt;
    git add CONTRIBUTORS&lt;br /&gt;
    git commit -m 'Update contributors file'&lt;br /&gt;
    git checkout master&lt;br /&gt;
    BRANCH_TO_MERGE=&amp;quot;arcpatch-$PATCH_NAME&amp;quot;&lt;br /&gt;
    git merge $BRANCH_TO_MERGE&lt;br /&gt;
    git branch -d $BRANCH_TO_MERGE&lt;br /&gt;
    git push&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1] https://forge.softwareheritage.org/D301&lt;br /&gt;
    https://forge.softwareheritage.org/D302&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=836</id>
		<title>New machine setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=836"/>
		<updated>2018-06-14T08:27:51Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setting up a new Software Heritage desktop machine =&lt;br /&gt;
&lt;br /&gt;
== Debian install ==&lt;br /&gt;
&lt;br /&gt;
* Stable&lt;br /&gt;
* root w/temporary password; no regular user (after setting up root password, cancel twice and jump forward to clock settings)&lt;br /&gt;
* full disk with LVM; reduce home LV to leave half of the disk free&lt;br /&gt;
* Standard system utilities, ssh server, no desktop environment (puppet will install that)&lt;br /&gt;
&lt;br /&gt;
== Base system setup (from console) ==&lt;br /&gt;
&lt;br /&gt;
* Login as root&lt;br /&gt;
* Enable password root access in ssh (/etc/ssh/sshd_config, PermitRootLogin yes)&lt;br /&gt;
* Write down IP configuration and add the machine to the Gandi DNS&lt;br /&gt;
* Test SSH login as root from your workstation&lt;br /&gt;
* Stay at your desk :)&lt;br /&gt;
&lt;br /&gt;
== Full system setup (from your desk) ==&lt;br /&gt;
&lt;br /&gt;
* SSH login as root&lt;br /&gt;
* Edit sources.list to add testing&lt;br /&gt;
* apt-get update, dist-upgrade, autoremove --purge&lt;br /&gt;
** While you wait, create [[Vpn]] certificates for the new machine&lt;br /&gt;
** add the machine to the puppet configuration, in the swh_desktop role&lt;br /&gt;
* apt-get install puppet openvpn&lt;br /&gt;
* configure openvpn per [[Vpn]]&lt;br /&gt;
** add pergamon IP address to /etc/resolv.conf&lt;br /&gt;
** add louvre.softwareheritage.org to /etc/hosts&lt;br /&gt;
* configure puppet&lt;br /&gt;
** systemctl disable puppet&lt;br /&gt;
** server=pergamon.internal.softwareheritage.org in /etc/puppet/puppet.conf&lt;br /&gt;
** puppet agent --enable&lt;br /&gt;
** puppet agent -t&lt;br /&gt;
** run puppet on pergamon to update munin server config&lt;br /&gt;
* set proper root password, add it to password store&lt;br /&gt;
* reboot&lt;br /&gt;
&lt;br /&gt;
= Setting up a new Virtual Machine (semi-manual process) =&lt;br /&gt;
As a requisite step, clone the [https://forge.softwareheritage.org/diffusion/SPRE/repository/master/ sysadm-provisioning] repository.&lt;br /&gt;
&lt;br /&gt;
== Naming scheme ==&lt;br /&gt;
&amp;lt;machine-name&amp;gt;.(&amp;lt;zone&amp;gt;.:&amp;lt;hoster&amp;gt;).internal.softwareheritage.org.&lt;br /&gt;
&lt;br /&gt;
The parenthesis denotes optional scheme.&lt;br /&gt;
&lt;br /&gt;
== Modus operandi ==&lt;br /&gt;
The modus operandi is as follows:&lt;br /&gt;
&lt;br /&gt;
* Install infra's requisite dependencies (read per infra/cloud resources)&lt;br /&gt;
&lt;br /&gt;
* provision a vm from the dedicated infrastructure cloud provider&lt;br /&gt;
&lt;br /&gt;
* bootstrap packages puppet dependencies on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on the dns node&lt;br /&gt;
&lt;br /&gt;
== Example with azure ==&lt;br /&gt;
First, Install [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/README.md$4 azure's requirements].&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/sysadm-provisioning&lt;br /&gt;
    # historic implementation detail (really use the following user)&lt;br /&gt;
    # using this user (uid 1000) permits to simplify steps down the&lt;br /&gt;
    # line&lt;br /&gt;
    ADMIN_USER=zack&lt;br /&gt;
    # Create the vm 'worker01' with type 'worker'&lt;br /&gt;
    # (other possible types: db, replica, &amp;lt;whatever&amp;gt;)&lt;br /&gt;
    ./azure/create-vm.sh worker01 worker&lt;br /&gt;
    # retrieve ip of the new vm&lt;br /&gt;
    # then copy the provision-vm.sh script to run there&lt;br /&gt;
    # (this does as entertained earlier puppet bootstrap + run)&lt;br /&gt;
    scp ./azure/provision-vm.sh $ADMIN_USER@&amp;lt;ip&amp;gt;:/tmp&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; chmod +x /tmp/provision-vm.sh&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; /tmp/provision-vm.sh public&lt;br /&gt;
    &lt;br /&gt;
    # note that you could also connect to the node, install tmux, run a&lt;br /&gt;
    # tmux session, then trigger the script from within&lt;br /&gt;
&lt;br /&gt;
After this, run the puppet agent on the dns server:&lt;br /&gt;
&lt;br /&gt;
    ssh &amp;lt;your-user&amp;gt;@pergamon.internal.softwareheritage.org sudo puppet agent --test&lt;br /&gt;
&lt;br /&gt;
As always, the truth lies within the source code, details explained in&lt;br /&gt;
comments:&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/create-vm.sh create-vm.sh]&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/provision-vm.sh provision-vm.sh]&lt;br /&gt;
&lt;br /&gt;
= Troubleshoot =&lt;br /&gt;
&lt;br /&gt;
== Recreating machine with the same exact configuration ==&lt;br /&gt;
&lt;br /&gt;
It so happens that we could scratch and recreate the same machine.&lt;br /&gt;
We then need to clean up on the puppet-master the old certificate (based on the machine's fqdn).&lt;br /&gt;
&lt;br /&gt;
    puppet cert clean &amp;lt;fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Duplicate resource found error ==&lt;br /&gt;
&lt;br /&gt;
For information, after a wrong manipulation (wrong hostname setup for example), you could end &lt;br /&gt;
up having stale data in the puppet master (in puppetdb).&lt;br /&gt;
&lt;br /&gt;
You would end up with the puppet agent complaining about duplicate resources found, for example:&lt;br /&gt;
    A duplicate resource was found while collecting exported resources&lt;br /&gt;
&lt;br /&gt;
That means there exists some stale data in the master (puppetdb).&lt;br /&gt;
Here is the command to clean those up.&lt;br /&gt;
&lt;br /&gt;
    puppet node deactivate &amp;lt;wrong-fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=835</id>
		<title>New machine setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=835"/>
		<updated>2018-06-14T08:23:22Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Modus operandi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setting up a new Software Heritage desktop machine =&lt;br /&gt;
&lt;br /&gt;
== Debian install ==&lt;br /&gt;
&lt;br /&gt;
* Stable&lt;br /&gt;
* root w/temporary password; no regular user (after setting up root password, cancel twice and jump forward to clock settings)&lt;br /&gt;
* full disk with LVM; reduce home LV to leave half of the disk free&lt;br /&gt;
* Standard system utilities, ssh server, no desktop environment (puppet will install that)&lt;br /&gt;
&lt;br /&gt;
== Base system setup (from console) ==&lt;br /&gt;
&lt;br /&gt;
* Login as root&lt;br /&gt;
* Enable password root access in ssh (/etc/ssh/sshd_config, PermitRootLogin yes)&lt;br /&gt;
* Write down IP configuration and add the machine to the Gandi DNS&lt;br /&gt;
* Test SSH login as root from your workstation&lt;br /&gt;
* Stay at your desk :)&lt;br /&gt;
&lt;br /&gt;
== Full system setup (from your desk) ==&lt;br /&gt;
&lt;br /&gt;
* SSH login as root&lt;br /&gt;
* Edit sources.list to add testing&lt;br /&gt;
* apt-get update, dist-upgrade, autoremove --purge&lt;br /&gt;
** While you wait, create [[Vpn]] certificates for the new machine&lt;br /&gt;
** add the machine to the puppet configuration, in the swh_desktop role&lt;br /&gt;
* apt-get install puppet openvpn&lt;br /&gt;
* configure openvpn per [[Vpn]]&lt;br /&gt;
** add pergamon IP address to /etc/resolv.conf&lt;br /&gt;
** add louvre.softwareheritage.org to /etc/hosts&lt;br /&gt;
* configure puppet&lt;br /&gt;
** systemctl disable puppet&lt;br /&gt;
** server=pergamon.internal.softwareheritage.org in /etc/puppet/puppet.conf&lt;br /&gt;
** puppet agent --enable&lt;br /&gt;
** puppet agent -t&lt;br /&gt;
** run puppet on pergamon to update munin server config&lt;br /&gt;
* set proper root password, add it to password store&lt;br /&gt;
* reboot&lt;br /&gt;
&lt;br /&gt;
= Setting up a new Virtual Machine (semi-manual process) =&lt;br /&gt;
As a requisite step, clone the [https://forge.softwareheritage.org/diffusion/SPRE/repository/master/ sysadm-provisioning] repository.&lt;br /&gt;
&lt;br /&gt;
== Naming scheme ==&lt;br /&gt;
&amp;lt;machine-name&amp;gt;.(&amp;lt;zone&amp;gt;.:&amp;lt;hoster&amp;gt;).internal.softwareheritage.org.&lt;br /&gt;
&lt;br /&gt;
The parenthesis denotes optional scheme.&lt;br /&gt;
&lt;br /&gt;
= Modus operandi =&lt;br /&gt;
The modus operandi is as follows:&lt;br /&gt;
&lt;br /&gt;
* Install infra's requisite dependencies (read per infra/cloud resources)&lt;br /&gt;
&lt;br /&gt;
* provision a vm from the dedicated infrastructure cloud provider&lt;br /&gt;
&lt;br /&gt;
* bootstrap packages puppet dependencies on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on the dns node&lt;br /&gt;
&lt;br /&gt;
= Example with azure =&lt;br /&gt;
First, Install [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/README.md$4 azure's requirements].&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/sysadm-provisioning&lt;br /&gt;
    # historic implementation detail (really use the following user)&lt;br /&gt;
    # using this user (uid 1000) permits to simplify steps down the&lt;br /&gt;
    # line&lt;br /&gt;
    ADMIN_USER=zack&lt;br /&gt;
    # Create the vm 'worker01' with type 'worker'&lt;br /&gt;
    # (other possible types: db, replica, &amp;lt;whatever&amp;gt;)&lt;br /&gt;
    ./azure/create-vm.sh worker01 worker&lt;br /&gt;
    # retrieve ip of the new vm&lt;br /&gt;
    # then copy the provision-vm.sh script to run there&lt;br /&gt;
    # (this does as entertained earlier puppet bootstrap + run)&lt;br /&gt;
    scp ./azure/provision-vm.sh $ADMIN_USER@&amp;lt;ip&amp;gt;:/tmp&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; chmod +x /tmp/provision-vm.sh&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; /tmp/provision-vm.sh public&lt;br /&gt;
    &lt;br /&gt;
    # note that you could also connect to the node, install tmux, run a&lt;br /&gt;
    # tmux session, then trigger the script from within&lt;br /&gt;
&lt;br /&gt;
After this, run the puppet agent on the dns server:&lt;br /&gt;
&lt;br /&gt;
    ssh &amp;lt;your-user&amp;gt;@pergamon.internal.softwareheritage.org sudo puppet agent --test&lt;br /&gt;
&lt;br /&gt;
As always, the truth lies within the source code, details explained in&lt;br /&gt;
comments:&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/create-vm.sh create-vm.sh]&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/provision-vm.sh provision-vm.sh]&lt;br /&gt;
&lt;br /&gt;
= Troubleshoot =&lt;br /&gt;
&lt;br /&gt;
== Recreating machine with the same exact configuration ==&lt;br /&gt;
&lt;br /&gt;
It so happens that we could scratch and recreate the same machine.&lt;br /&gt;
We then need to clean up on the puppet-master the old certificate (based on the machine's fqdn).&lt;br /&gt;
&lt;br /&gt;
    puppet cert clean &amp;lt;fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Duplicate resource found error ==&lt;br /&gt;
&lt;br /&gt;
For information, after a wrong manipulation (wrong hostname setup for example), you could end &lt;br /&gt;
up having stale data in the puppet master (in puppetdb).&lt;br /&gt;
&lt;br /&gt;
You would end up with the puppet agent complaining about duplicate resources found, for example:&lt;br /&gt;
    A duplicate resource was found while collecting exported resources&lt;br /&gt;
&lt;br /&gt;
That means there exists some stale data in the master (puppetdb).&lt;br /&gt;
Here is the command to clean those up.&lt;br /&gt;
&lt;br /&gt;
    puppet node deactivate &amp;lt;wrong-fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
	<entry>
		<id>https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=834</id>
		<title>New machine setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.softwareheritage.org/index.php?title=New_machine_setup&amp;diff=834"/>
		<updated>2018-06-14T08:22:42Z</updated>

		<summary type="html">&lt;p&gt;Ardumont: /* Example with azure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setting up a new Software Heritage desktop machine =&lt;br /&gt;
&lt;br /&gt;
== Debian install ==&lt;br /&gt;
&lt;br /&gt;
* Stable&lt;br /&gt;
* root w/temporary password; no regular user (after setting up root password, cancel twice and jump forward to clock settings)&lt;br /&gt;
* full disk with LVM; reduce home LV to leave half of the disk free&lt;br /&gt;
* Standard system utilities, ssh server, no desktop environment (puppet will install that)&lt;br /&gt;
&lt;br /&gt;
== Base system setup (from console) ==&lt;br /&gt;
&lt;br /&gt;
* Login as root&lt;br /&gt;
* Enable password root access in ssh (/etc/ssh/sshd_config, PermitRootLogin yes)&lt;br /&gt;
* Write down IP configuration and add the machine to the Gandi DNS&lt;br /&gt;
* Test SSH login as root from your workstation&lt;br /&gt;
* Stay at your desk :)&lt;br /&gt;
&lt;br /&gt;
== Full system setup (from your desk) ==&lt;br /&gt;
&lt;br /&gt;
* SSH login as root&lt;br /&gt;
* Edit sources.list to add testing&lt;br /&gt;
* apt-get update, dist-upgrade, autoremove --purge&lt;br /&gt;
** While you wait, create [[Vpn]] certificates for the new machine&lt;br /&gt;
** add the machine to the puppet configuration, in the swh_desktop role&lt;br /&gt;
* apt-get install puppet openvpn&lt;br /&gt;
* configure openvpn per [[Vpn]]&lt;br /&gt;
** add pergamon IP address to /etc/resolv.conf&lt;br /&gt;
** add louvre.softwareheritage.org to /etc/hosts&lt;br /&gt;
* configure puppet&lt;br /&gt;
** systemctl disable puppet&lt;br /&gt;
** server=pergamon.internal.softwareheritage.org in /etc/puppet/puppet.conf&lt;br /&gt;
** puppet agent --enable&lt;br /&gt;
** puppet agent -t&lt;br /&gt;
** run puppet on pergamon to update munin server config&lt;br /&gt;
* set proper root password, add it to password store&lt;br /&gt;
* reboot&lt;br /&gt;
&lt;br /&gt;
= Setting up a new Virtual Machine (semi-manual process) =&lt;br /&gt;
As a requisite step, clone the [https://forge.softwareheritage.org/diffusion/SPRE/repository/master/ sysadm-provisioning] repository.&lt;br /&gt;
&lt;br /&gt;
== Naming scheme ==&lt;br /&gt;
&amp;lt;machine-name&amp;gt;.(&amp;lt;zone&amp;gt;.:&amp;lt;hoster&amp;gt;).internal.softwareheritage.org.&lt;br /&gt;
&lt;br /&gt;
The parenthesis denotes optional scheme.&lt;br /&gt;
&lt;br /&gt;
== Modus operandi ==&lt;br /&gt;
The modus operandi is as follows:&lt;br /&gt;
&lt;br /&gt;
* install pre-requisite as per infra (cf. dedicated infra/cloud resources)&lt;br /&gt;
&lt;br /&gt;
* provision a vm from the dedicated infrastructure cloud provider&lt;br /&gt;
&lt;br /&gt;
* bootstrap packages puppet dependencies on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on that vm&lt;br /&gt;
&lt;br /&gt;
* run puppet agent on the dns node&lt;br /&gt;
&lt;br /&gt;
= Example with azure =&lt;br /&gt;
First, Install [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/README.md$4 azure's requirements].&lt;br /&gt;
&lt;br /&gt;
    cd /path/to/sysadm-provisioning&lt;br /&gt;
    # historic implementation detail (really use the following user)&lt;br /&gt;
    # using this user (uid 1000) permits to simplify steps down the&lt;br /&gt;
    # line&lt;br /&gt;
    ADMIN_USER=zack&lt;br /&gt;
    # Create the vm 'worker01' with type 'worker'&lt;br /&gt;
    # (other possible types: db, replica, &amp;lt;whatever&amp;gt;)&lt;br /&gt;
    ./azure/create-vm.sh worker01 worker&lt;br /&gt;
    # retrieve ip of the new vm&lt;br /&gt;
    # then copy the provision-vm.sh script to run there&lt;br /&gt;
    # (this does as entertained earlier puppet bootstrap + run)&lt;br /&gt;
    scp ./azure/provision-vm.sh $ADMIN_USER@&amp;lt;ip&amp;gt;:/tmp&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; chmod +x /tmp/provision-vm.sh&lt;br /&gt;
    ssh $ADMIN_USER@&amp;lt;ip&amp;gt; /tmp/provision-vm.sh public&lt;br /&gt;
    &lt;br /&gt;
    # note that you could also connect to the node, install tmux, run a&lt;br /&gt;
    # tmux session, then trigger the script from within&lt;br /&gt;
&lt;br /&gt;
After this, run the puppet agent on the dns server:&lt;br /&gt;
&lt;br /&gt;
    ssh &amp;lt;your-user&amp;gt;@pergamon.internal.softwareheritage.org sudo puppet agent --test&lt;br /&gt;
&lt;br /&gt;
As always, the truth lies within the source code, details explained in&lt;br /&gt;
comments:&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/create-vm.sh create-vm.sh]&lt;br /&gt;
&lt;br /&gt;
* [https://forge.softwareheritage.org/diffusion/SPRE/browse/master/azure/provision-vm.sh provision-vm.sh]&lt;br /&gt;
&lt;br /&gt;
= Troubleshoot =&lt;br /&gt;
&lt;br /&gt;
== Recreating machine with the same exact configuration ==&lt;br /&gt;
&lt;br /&gt;
It so happens that we could scratch and recreate the same machine.&lt;br /&gt;
We then need to clean up on the puppet-master the old certificate (based on the machine's fqdn).&lt;br /&gt;
&lt;br /&gt;
    puppet cert clean &amp;lt;fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Duplicate resource found error ==&lt;br /&gt;
&lt;br /&gt;
For information, after a wrong manipulation (wrong hostname setup for example), you could end &lt;br /&gt;
up having stale data in the puppet master (in puppetdb).&lt;br /&gt;
&lt;br /&gt;
You would end up with the puppet agent complaining about duplicate resources found, for example:&lt;br /&gt;
    A duplicate resource was found while collecting exported resources&lt;br /&gt;
&lt;br /&gt;
That means there exists some stale data in the master (puppetdb).&lt;br /&gt;
Here is the command to clean those up.&lt;br /&gt;
&lt;br /&gt;
    puppet node deactivate &amp;lt;wrong-fqdn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Infrastructure]]&lt;br /&gt;
[[Category:System administration]]&lt;/div&gt;</summary>
		<author><name>Ardumont</name></author>
	</entry>
</feed>