I had a look at pax (1:20120606-2+deb7u1) debian/rules. I didn't find it insane, or even unreadable. There's a few obscure places, and a few minor bugs, but that's it. Thorsten, I hope you'll find my review useful:

DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

I'd use "?=" instead of "=" here. dpkg-buildpackage sets these variables for you, so you could avoid a few forks.

CFLAGS=                 -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g

Here and in other places, I'd use "filter" instead of "findstring".

debian/.build_stamp:
        # goodbye dh_testdir
        test -f tty_subs.c
        test -x debian/rules

dh_testdir is probably the most useless debhelper command. :) I've been eradicating it from my packages. Instead, I use make rules to ensure that d/rules is run from the correct directory. Something like this should do the trick with less forks:

debian/.build_stamp: tty_subs.c debian/rules

        +for opts in '-flto=jobserver' '-fwhole-program --combine' ''; do \
                set -x; \
                ${CC} ${CPPFLAGS} ${CFLAGS} $$opts ${LDFLAGS} -o pax ar.c \
                    ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c \
                    ftree.c gen_subs.c getoldopt.c options.c pat_rep.c pax.c \
                    sel_subs.c tables.c tar.c tty_subs.c; \
                test -x pax && exit 0; \
        done; echo >&2 Compiling failed.; exit 1

Could you perhaps put the file list in a variable? That'd make the command easier to read.

        -rm -f pax

You don't need "-" (here and in other places). The -f option already ignores ENOENT errors, and you _don't_ want other errors ignored.

        echo .nr g 2 | cat - cpio.1 | \
            gzip -n9 >debian/pax/usr/share/man/man1/paxcpio.1.gz
        echo .nr g 2 | cat - pax.1 | \
            gzip -n9 >debian/pax/usr/share/man/man1/pax.1.gz
        echo .nr g 2 | cat - tar.1 | \
            gzip -n9 >debian/pax/usr/share/man/man1/paxtar.1.gz

I'd use a for loop here.

        chmod 644 $$(find debian/pax -type f)
        chmod 755 $$(find debian/pax -type d) \
            debian/pax/bin/pax

I'd use "find ... -exec chmod ..." here, as it handles errors better.

        (cd debian/pax && find . | sort | ./bin/paxcpio \
            -oC512 -Hustar -Minodes -Mlinks -Muidgid -Mgslash) | \
            gzip -n9 >debian/B/data.tar.gz
        cd debian/B/c && chmod 644 *
        (cd debian/B/c && find . | sort | ../../pax/bin/paxcpio \
            -oC512 -Hustar -Minodes -Mlinks -Muidgid -Mgslash) | \
            gzip -n9 >debian/B/control.tar.gz
        echo 2.0 >debian/B/debian-binary
        read fn rest <debian/files && cd debian/B && \
            ../pax/bin/paxtar -A -M dist -cf "../../../$$fn" \
            debian-binary control.tar.gz data.tar.gz

This is completely obscure, but I appreciate the idea of eating your own dog food. :)

--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to