Bug#685787: devscripts: Enabling uscan to simply remove files from upstream source
Andreas Tille
tille at debian.org
Fri Aug 24 14:38:13 UTC 2012
Package: devscripts
Version: 2.10.69+squeeze2
Severity: wishlist
Tags: patch
Hi,
in a (bit longish) thread on debian-devel at l.d.o[1] there was some
discussion about enabling uscan to remove files from upstream archives
according to some information given in some control file. There was no
real consensus about what control file to use. The implementation below
is based on using debian/copyright but is easy to switch to other files
in case some other consensus might be reached.
The attached patch does the following:
1. If (and only if) the debian/copyright file is
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
and if it contains a non-empty field Files-Excluded containing a
space separated list of globs (as used by find and for specifying
file lists in machine readable debian/control files). The deletion
process will loop over every expression and is using the find
command to delete the according globs.
2. If files matching are contained in the source tarball this will
be repackaged except if the option --no-exclusion is given at
uscan command line or if USCAN_NO_EXCLUSION is set in
/etc/devscripts.conf or ~/.devscripts. The removal is implemented
for all tar compression methods as well as for zip archives (which
are unpackaged using unzip). This means if the conditions for
file exclusion as given above are fullfilled the patch below
works similar as --repack.
3. If the tarball did not contained any of the globs in
debian/copyright::Files-Excluded it will be left untouched.
4. In case something was removed the version string will be appended by
'+dfsg' to express the fact that the content of the original source
was changed. Note: There was no real consensus whether to use this
suffix or rather '~dfsg'. This could be solved by some additional
configuration option that could be added later. For some moment I
also had the idea to obtain the suffix which is "wanted" by the
maintainer either from debian/watch:dversionmangle or
debian/changelog but I droped this idea because I did not found
a reliable method to make a safe guess.
5. Sometimes upstream tarballs are dirty and unpack a load of files
into the current directory. The patch tries to behave reasonable
and checks whether it could move those files into a dir named
$pkg-$newversion
(in case no such file or directory just exists in such a dirty
tarball). Also some non-dirty but quite generically named
directories (like "source") are renamed to "$pkg-$newversion".
I have tested the code with five different packages in Debian Med
repository which show different problematic directory structures and
also different compression methods. The according copyright files
including Files-Excluded are commited to the following locations:
Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/ampliconnoise/trunk/
Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/conquest-dicom-server/trunk/
Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/imagej/trunk/
Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/saint/trunk/
Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/tm-align/trunk/
When applying the patch and using `uscan --verbose --force-download`
I get the actual resulting orig.tar.gz as I want it to be.
Remark:
Regarding the implementation there was some uncertainity about the
actual Perl module to use. In the patch below script I decided to
stick to Dpkg::Control and left the code for Parse::DebControl as a
comment which could pretty easily could replace the other parser.
Please consider applying this patch after possibly further discussion on
debian-devel at l.d.o.
Kind regards
Andreas.
PS: Some more skilled Perl programmer might see some room for enhancing
the code - just be warned that Perl is not my native language.
[1] http://lists.debian.org/debian-devel/2012/08/msg00380.html
-- Package-specific info:
--- /etc/devscripts.conf ---
--- ~/.devscripts ---
Not present
-- System Information:
Debian Release: 6.0.5
Architecture: i386 (i686)
Kernel: Linux 2.6.36-xenU-4814-i386 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages devscripts depends on:
ii dpkg-dev 1.15.8.12 Debian package development tools
ii libc6 2.11.3-3 Embedded GNU C Library: Shared lib
ii perl 5.10.1-17squeeze3 Larry Wall's Practical Extraction
Versions of packages devscripts recommends:
pn at <none> (no description available)
ii bsd-mailx [mailx] 8.1.2-0.20100314cvs-1 simple mail user agent
ii curl 7.21.0-2.1+squeeze2 Get a file from an HTTP, HTTPS or
ii dctrl-tools 2.14.5 Command-line tools to process Debi
pn debian-keyring <none> (no description available)
pn debian-maintainers <none> (no description available)
ii dput 0.9.6.1+squeeze1 Debian package upload tool
pn equivs <none> (no description available)
ii fakeroot 1.14.4-1 Gives a fake root environment
ii git [git-core] 1:1.7.2.5-3 fast, scalable, distributed revisi
ii git-core 1:1.7.2.5-3 fast, scalable, distributed revisi
ii gnupg 1.4.10-4 GNU privacy guard - a free PGP rep
pn libauthen-sasl-per <none> (no description available)
pn libcrypt-ssleay-pe <none> (no description available)
pn libjson-perl <none> (no description available)
pn libparse-debcontro <none> (no description available)
pn libsoap-lite-perl <none> (no description available)
pn libterm-size-perl <none> (no description available)
ii libtimedate-perl 1.2000-1 collection of modules to manipulat
ii liburi-perl 1.54-2 module to manipulate and access UR
ii libwww-perl 5.836-1 Perl HTTP/WWW client/server librar
pn libyaml-syck-perl <none> (no description available)
pn lintian <none> (no description available)
ii lsb-release 3.2-23.2squeeze1 Linux Standard Base version report
ii lynx-cur [www-brow 2.8.8dev.5-1 Text-mode WWW Browser with NLS sup
ii lzma 4.43-14 Compression method of 7z format in
ii mailx 1:20071201-3 Transitional package for mailx ren
ii man-db 2.5.7-8 on-line manual pager
ii openssh-client [ss 1:5.5p1-6+squeeze2 secure shell (SSH) client, for sec
ii patch 2.6-2 Apply a diff file to an original
ii patchutils 0.3.1-2 Utilities to work with patches
ii sensible-utils 0.0.4 Utilities for sensible alternative
pn strace <none> (no description available)
ii unzip 6.0-4 De-archiver for .zip files
ii w3m [www-browser] 0.5.2-9 WWW browsable pager with excellent
pn wdiff <none> (no description available)
ii wget 1.12-2.1 retrieves files from the web
ii xz-utils 5.0.0-2 XZ-format compression utilities
Versions of packages devscripts suggests:
ii build-essential 11.5 Informational list of build-essent
pn cvs-buildpackage <none> (no description available)
pn devscripts-el <none> (no description available)
pn gnuplot <none> (no description available)
pn libfile-desktopentry-p <none> (no description available)
pn libnet-smtp-ssl-perl <none> (no description available)
ii mutt 1.5.20-9+squeeze2 text-based mailreader supporting M
pn svn-buildpackage <none> (no description available)
ii w3m 0.5.2-9 WWW browsable pager with excellent
-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exclude-files.diff
Type: text/x-diff
Size: 9847 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/devscripts-devel/attachments/20120824/5b295744/attachment.diff>
More information about the devscripts-devel
mailing list