I've download the .tar.gz, .dsc and .diff.gz of the bash package from Wheezy: https://packages.debian.org/wheezy/bash. Then I ran dpkg-source -x on the dsc file to unpack it, and this is the result:

$ ls -l
total 2696
-rw-rw-r-- 1 pgimeno pgimeno 2748840 Dec 30  2012 bash-4.2dfsg.tar.xz
drwxrwxr-x 3 pgimeno pgimeno    4096 Apr  3 23:36 debian

UPDATE: I can extract the archive manually, the problem is not that. Please read carefully below. I've added emphasis on some key sentences.

That has confused me. What should I do to get a fully unpacked archive with the Debian patches applied, so that I can work on the source and produce a modified package that builds? Do I have to unpack it myself and apply the patches by hand? If so, to what directory should I unpack it? The default after running tar -xf bash-4.2dfsg.tar.xz is bash-4.2, should I leave it like that or move the files to the main directory? And then what?

  • Very similar to askubuntu.com/questions/92328/… – roaima Apr 3 '15 at 22:12
  • Not really. I can unpack the tar.xz by hand (as I indicate in the last part of the question), that's not the problem. The problem is that I'm supposed to get a fully unpacked source that I can work on, not an archive, and the one I extract by hand lacks the patches from debian/patches. – Pedro Gimeno Apr 3 '15 at 22:19

The central place that records what to do with a source package is debian/rules. It's a makefile, and a few targets are mandatory or standardized, including build, which will of necessity unpack and patch any source archive, and patch, which should unpack and patch any source archive. Many packages use helper scripts, the main ones being debhelper (dh_* and the newer dh frontend) and cdbs.

The bash package in wheezy uses a few debhelper scripts and doesn't provide a patch target. It doesn't provide an unpack target either (an common convention), but it does provide some targets that it uses internally:

make -f debian/rules bash_src=bash unpack-bash
make -f debian/rules bash_src=bash patch-bash
  • So I take it that there's no standard way of unpacking a package that comes in this form? Knowing that there isn't one helps too. I gather that the configure trick in my answer would be more compatible across packages, without needing to analyze debian/rules, is that right? If so, adding that to your answer will help others too. – Pedro Gimeno Apr 3 '15 at 23:42
  • 1
    @PedroGimeno There's no standard, it's part of the package's build process. An unpack target and a patch target are common conventions, but not universal. The bash-configure rule name isn't standard either: the common convention would be configure, not PACKAGENAME-configure. – Gilles Apr 4 '15 at 0:04

valdyn from irc.oftc.net helped me find one solution, which was to run:

debian/rules bash-configure

It does some extra work and leaves some directories that are not part of the source, but at least it unpacks it and applies the patches, so that allows me to work on the patched source now. As I suspected, the destination directory was not intended to be bash-4.2 as unpacking by hand did, but just bash.

But this feels like a dirty hack. I'm still looking for the "right" solution, one that just leaves the source ready for a normal build while still allowing me to work on it first, as with most packages, without needing to do a configure run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.