Subject: Re: implement capability to run custom mk-origtargz

From: Christopher Hoskin <[email-masked]>
Date: Wed, 30 Aug 2017 20:22:01 +0100

Package: devscripts
Version: 2.17.6+deb9u1
Followup-For: Bug #831521

Thanks for looking into this. My second thought is that there's a lot of useful functionality in mk-origtargz (determining the correct form of the tarball from debain/changelog, converting from zip or xpi, excluding files based on patterns...) and anyone needing some custom functionality shouldn't need to reinvent this. In my case I needed to run a command on a number of files within the upstream tarball, and also exclude some files.

Now I could create a debian/mk-origtargz script which creates a temp directory, extracts the upstream tar ball to it, runs my commands on the extracted files, re-tars the temporary folder into an intermediate tarball, calls /usr/bin/mk-origtargz with the path of intermediate tarball as an argument and then removes the temporary folder and intermediate tarball, but that seems to duplicate a lot of what mk-origtargz already does.

I was wondering if it would be possible to insert some code around line 437 of mk-origtargz to check for the existance of a debian/modify-upstream script, and if it exists, call it with the path of the extracted files as the working directory?

Another possibility might be to split the mk-origtargz into an unpack and repack scripts, and re-implement mk-origtargz as a wrapper which calls the unpack and repack script. Anyone implementing a debian/mk-origtargz could then call the unpack script, do some custome logic and then call the repack script.

In the case of there being no upstream tarball, debian/mk-origtargz could assemble the upstream source into a temporary folder an then just call the repack script.

I haven't thought too hard about this, so these ideas may be flawed.

Christopher

---

From: Christopher Hoskin <[email-masked]>
Date: Thu, 31 Aug 2017 09:35:40 +0100

Package: devscripts
Version: 2.17.6+deb9u1

Just thinking aloud here:

I wonder if it would make sense to create a debhelper plugin to add a get-orig-source sequence, with a sequence of commands, e.g. something like:

dh_uscan
dh_unpack
dh_repack
dh_exclude_files
dh_strip_icc_profiles

Packaging teams could then add commands to do common options e.g. the Java team might want a command to automatically exclude jar and war files. The commands could be overriden in debian/rules to cope with bespoke situations.

Just a thought.

Christopher