Page MenuHomeSoftware Heritage

Add debian packaging for the npm loader
Closed, MigratedEdits Locked

Event Timeline

anlambert triaged this task as Normal priority.Apr 9 2019, 11:41 AM
anlambert created this task.
olasd closed this task as Resolved.EditedApr 9 2019, 5:22 PM
olasd claimed this task.
olasd added subscribers: ardumont, olasd.

The automatic packaging has been set up for the npm loader.

Steps followed :

  1. add the Jenkins jobs for the new repo (rCJSWH70db79eee0b by @ardumont)
  2. ask a Jenkins admin to approve the new groovy scripts in the Jenkins script security panel.
  3. make sure the repository has the Has debian packaging branches tag so Jenkins will be able to push to it
  4. setup the post-receive hook for tags on the phabricator server (/usr/local/bin/phabricator-setup-hook /srv/phabricator/repos/184 post-receive-swh-modules on tate)
  5. bootstrap the Debian packaging branches. This is somewhat scriptable but there's lots of ways this can fail. You can use this script as a copy-paste template :
package=$(basename $(pwd))
ver="0.0.0" # set to the initial tag number

# Nuke all the debian branches from orbit
git branch -D pristine-tar debian/upstream debian/unstable-swh debian/stretch-swh || true

# Generate initial sdist tarball
git checkout v$ver
git clean -dfx

python3 setup.py egg_info
pname=$(awk '/^Name:/{print $2}' *.egg-info/PKG-INFO)
pver=$(awk '/^Version:/{print $2}' *.egg-info/PKG-INFO)

python3 setup.py sdist -d ../packages
mv ../packages/${pname}-${pver}.tar.gz ../packages/${package}_${ver}.orig.tar.gz

# Bootstrap the debian/upstream branch from the original tag
git checkout -b debian/upstream
# ... by removing all files
git ls-tree --name-only HEAD | xargs rm -r
# ...and replacing them with contents of the sdist
tar -x --strip-components 1 -f ../packages/${package}_${ver}.orig.tar.gz
git add .
git commit --no-verify -m "Import upstream version ${ver}"
# Create the upstream tag to appease gbp
git tag debian/upstream/$ver

# Bootstrap the pristine-tar branch ex-nihilo
git checkout --orphan pristine-tar
pristine-tar commit ../packages/${package}_${ver}.orig.tar.gz debian/upstream/${ver}

# Bootstrap the debian/unstable-swh branch from the debian/upstream branch
git checkout debian/upstream
git checkout -b debian/unstable-swh

# Initialize the debian directory.
# You can:
# - copy the debian directory from another repository
# - update all references to the other module
#    (notably in debian/changelog, debian/control, debian/rules, debian/copyright)
# - update dependencies in debian/control

git add debian
git commit -m "Bootstrap Debian packaging"

# This is a good point to test that the package builds with gbp buildpackage
# It might fail to build if your initial tag has no tests, as that makes pytest return an error code.

# Once the unstable package builds, fix up your bootstrap commit, then

# Bootstrap the debian/stretch-swh branch
git checkout debian/unstable-swh
git checkout -b debian/stretch-swh

sed -i s/unstable/stretch/ debian/gbp.conf
dch --bpo -D stretch-swh --force-distribution ''
git add debian
git commit --no-verify -m "Updated debian stretch backport directory for version ${ver}"

# Push all the things
git push --follow-tags --set-upstream origin pristine-tar debian/upstream debian/unstable-swh debian/stretch-swh
  1. push a new tag on the master branch and look at Jenkins (hopefully) update the debian branches and build/upload your new package

rDLDNPMb5cbc6 is the packaging branch bootstrap commit, which can plausibly serve as a canvas for future module bootstraps

Heads up, for loader, we also need to remove the extra __init__.py already installed by swh-core (this is true for all packages depending on swh-core, not only loaders) and swh-loader-core (for loaders only).

Related 5884f8dfa5b68ca81276f696844a29a43e80b0e7