Introduction

FTP Team decided it is not allowed to ship waf "binary" as-is into source tarballs available in main component of the archive.

waf "binary" is basically a Python script with an embedded bzip2 tarball unpacked at runtime. A more detailed explanation about it is available here.

How to unpack waf

Here is a quick-and-dirty recipe to generate a unpacked waf instance in your source tarball:

./waf --help &> /dev/null
mv .waf-*/* .
sed -i '/^#==>$/,$d' waf
rmdir .waf-*

Also, you will need to remove generated .pyc files during clean phase in the expanded dirs (waflib, wafadmin,...):

find waflib wafadmin -name "*.pyc" -delete

get-orig-source

You can add this to your debian/rules to repack the upstream tarball without waf:

# get-orig-source to drop waf
upstream_version ?= $(shell dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)(\+dfsg\d+)?.*$$/\1/p')
dfsg_version = $(upstream_version)+dfsg1
pkg = $(shell dpkg-parsechangelog | sed -ne 's/^Source: //p')

get-orig-source:
        uscan --noconf --force-download --rename --repack --download-current-version --destdir=.
        tar -xzf $(pkg)_$(upstream_version).orig.tar.gz
        mv $(pkg)-$(upstream_version) $(pkg)-$(dfsg_version)
        cd $(pkg)-$(dfsg_version) ; python waf --help > /dev/null
        mv $(pkg)-$(dfsg_version)/.waf-*/* $(pkg)-$(dfsg_version)
        sed -i '/^#==>$$/,$$d' $(pkg)-$(dfsg_version)/waf
        rmdir $(pkg)-$(dfsg_version)/.waf-*
        GZIP="-9fn" tar -czf $(pkg)_$(dfsg_version).orig.tar.gz $(pkg)-$(dfsg_version)
        rm -rf $(pkg)-$(dfsg_version)

for the uscan to work, you also need to demangle the destination file in debian/watch:

opts=dversionmangle=s/\+dfsg\d+$// \
  http://some.site.org/some/path/foobar-(.+)\.tar\.gz