Package: dpkg-dev
Version: 1.15.5.6
Severity: normal

TEST CASE

1. Upstream sources includes files that should not be there. Like
   backup *~ files
2. In debian/rules, the dh_clean would remove these *~ files,
   but then the version control (git) wouldn't be happy as these
   are part of the original sources.

   Solution:the files are temporarily moved under other name so that
   they can be restores:

      *~  => *~.original

3. Unfortunately dpkg-source thinks that there are now local changes
   and before debian/rules::build is run, it concludes

    dpkg-source: info: local changes stored in 
ccbuild.git/debian/patches/debian-changes-1.5.7-2, the modified files are:
     ccbuild.git/src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~.original
     ccbuild.git/src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~.original
     ccbuild.git/src/SourceScanner/yylex.cc
     ccbuild.git/src/ccbuild.cc~.original

   But we wouldn't want these recorded.

SUGGESTION

The generating of debian/patches/debian-changes* should happen as late
as possible. Now it's too early. Best, if this could be done, say, in
debian/rules::binary-arch somewhere (dh_builddeb?).

This would give a chnage to modify the sources, and restore them prior
building the *.deb and associated *.diff.

Attached are the debian/rules for inspection and the
build.log. Basicly the SAVE and RESTORE here don't work as intended
with "format quilt 3.0" as outline above.

    override_dh_auto_clean:
            $(file-state-save)
            dh_auto_clean

    ...

    binary-arch: install
             # target: binary-arch - Build architecture-dependent files
             $(file-state-restore)

-----------------------------------------------------------------------

# debian/rules
#!/usr/bin/make -f

#export DH_VERBOSE=1

include debian/debian-save-restore.mk

# Inclued in original sources,; dh(1) would delete these.
FILE_LIST_PRESERVE = \
 src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~ \
 src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~ \
 src/ccbuild.cc~

define file-state-save
        # save files
        suffix=.original; \
        for file in $(FILE_LIST_PRESERVE); \
        do \
                if [ -f "$$file" ] && [ ! -f "$$file$$suffix" ]; then \
                        cp --verbose "$$file" "$$file$$suffix"; \
                fi; \
        done
endef

define file-state-restore
        # restore files
        suffix=.original; \
        for file in $(FILE_LIST_PRESERVE); \
        do \
                if [ -f "$$file$$suffix" ]; then \
                         mv --verbose "$$file$$suffix" "$$file"; \
                fi; \
        done
endef

# Check what is happening in patches directory
override_dh_auto_configure:
        ls -la ebian/patches/*
        dh_auto_configure

override_dh_auto_clean:
        $(file-state-save)
        dh_auto_clean

install: build
         # target: install
         dh_testdir
         dh_prep
         dh_installdirs
         $(MAKE) DESTDIR=$(CURDIR)/debian/ccbuild install

binary-arch: install
             # target: binary-arch - Build architecture-dependent files
             $(file-state-restore)
             dh_testdir
             dh_testroot
             dh_installchangelogs ChangeLog
             dh_installdocs
             dh_installman
             dh_strip
             dh_compress
             dh_fixperms
             dh_installdeb
             dh_shlibdeps
             dh_gencontrol
             dh_md5sums
             dh_builddeb

binary: binary-arch

%:
        dh  $@

.PHONY: install binary-arch binary

-----------------------------------------------------------------------

build.log (relevant parts, see "!!")

    $ dpkg-buildpackage -rfakeroot -D -us -uc -i.pc -iconfig.status 
-ibackup.bzr -i.git -i -I.svn -I.bzr -Ibackup.bzr -I.bzr.bac\
    kup -I.hg -I.git -I_MTN -I.darcs -ICVS -IRCS
    dpkg-buildpackage: warning: using a gain-root-command while being root
    dpkg-buildpackage: set CFLAGS to default value: -g -O2
    dpkg-buildpackage: set CPPFLAGS to default value: 
    dpkg-buildpackage: set LDFLAGS to default value: 
    dpkg-buildpackage: set FFLAGS to default value: -g -O2
    dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
    dpkg-buildpackage: source package ccbuild
    dpkg-buildpackage: source version 1.5.7-2
    dpkg-buildpackage: source changed by Jari Aalto <jari.aa...@cante.net>
    dpkg-buildpackage: host architecture amd64
     fakeroot debian/rules clean
    make[1]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    dh  clean
       dh_testdir
       debian/rules override_dh_auto_clean
    make[2]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
!!  # save files
    suffix=.original; for file in src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~ 
src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~ src/ccbuild.cc~; \
    do if [ -f "$file" ] && [ ! -f "$file$suffix" ]; then cp --verbose "$file" 
"$file$suffix"; fi; done
    `src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~' -> 
`src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~.original'
    `src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~' -> 
`src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~.original'
    `src/ccbuild.cc~' -> `src/ccbuild.cc~.original'
    dh_auto_clean
    make[3]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    test -z "ccbuild" || rm -f ccbuild
    [...clip...]
    make[2]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
       dh_clean
    make[1]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
     dpkg-source -i -I.svn -I.bzr -Ibackup.bzr -I.bzr.backup -I.hg -I.git 
-I_MTN -I.darcs -ICVS -IRCS -b ccbuild.git
    dpkg-source: info: using source format `3.0 (quilt)'
    dpkg-source: info: building ccbuild using existing 
./ccbuild_1.5.7.orig.tar.gz
!!  dpkg-source: info: local changes stored in 
ccbuild.git/debian/patches/debian-changes-1.5.7-2, the modified files are:
     ccbuild.git/src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~.original
     ccbuild.git/src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~.original
     ccbuild.git/src/SourceScanner/yylex.cc
     ccbuild.git/src/ccbuild.cc~.original
    dpkg-source: info: building ccbuild in ccbuild_1.5.7-2.debian.tar.gz
    dpkg-source: info: building ccbuild in ccbuild_1.5.7-2.dsc
     debian/rules build
    make[1]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    dh  build
       dh_testdir
       debian/rules override_dh_auto_configure
    make[2]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    ls -la debian/patches/*
    -rw-r--r-- 1 root root  5340 Jan  6 15:40 
debian/patches/10-ccbuild.1-fix-spelling.patch
    -rw-r--r-- 1 root src  71783 Mar  9 16:10 
debian/patches/debian-changes-1.5.7-2
    -rw-r--r-- 1 root root    55 Mar  9 16:10 debian/patches/series
    dh_auto_configure
    [...clip...]
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... awk
    checking whether make sets $(MAKE)... yes
    [...clip...]
    config.status: executing depfiles commands
       dh_auto_build
    make[2]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    g++ -DPACKAGE_NAME=\"ccbuild\" -DPACKAGE_TARNAME=...
    [...clip...]
    make[2]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
       dh_auto_test
    make[1]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
     fakeroot debian/rules binary
    make[1]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    dh  build
    # target: install
    dh_testdir
    dh_prep
    dh_installdirs
    /usr/bin/make DESTDIR=/srv/deb/debian/ccbuild/ccbuild.git/debian/ccbuild 
install
    make[2]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    make[3]: Entering directory `/srv/deb/debian/ccbuild/ccbuild.git'
    test -z "/usr/bin" || /bin/mkdir -p 
"/srv/deb/debian/ccbuild/ccbuild.git/debian/ccbuild/usr/bin"
      /usr/bin/install -c 'ccbuild' 
'/srv/deb/debian/ccbuild/ccbuild.git/debian/ccbuild/usr/bin/ccbuild'
    make[3]: Nothing to be done for `install-data-am'.
    make[3]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
    make[2]: Leaving directory `/srv/deb/debian/ccbuild/ccbuild.git'
    # target: binary-arch - Build architecture-dependent files
!!  # restore files
    suffix=.original; for file in src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~ 
src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~ src/ccbuild.cc~; \
    do if [ -f "$file$suffix" ]; then mv --verbose "$file$suffix" "$file"; fi; 
done
    `src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~.original' -> 
`src/MD5Info/MD5Hash/GCrypt/GCrypt.cc~'
    `src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~.original' -> 
`src/MD5Info/MD5Hash/GCrypt/GCrypt.hh~'
    `src/ccbuild.cc~.original' -> `src/ccbuild.cc~'
    dh_testdir
    dh_testroot
    dh_installchangelogs ChangeLog
    dh_installdocs
    dh_installman
    dh_strip
    dh_compress
    dh_fixperms
    dh_installdeb
    dh_shlibdeps
    dh_gencontrol
    dh_md5sums
    dh_builddeb
    dpkg-deb: building package `ccbuild' in `../ccbuild_1.5.7-2_amd64.deb'.
    [...clip...]

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg-dev depends on:
ii  base-files        5.1                    Debian base system miscellaneous f
ii  binutils          2.20-6                 The GNU assembler, linker and bina
ii  bzip2             1.0.5-4                high-quality block-sorting file co
ii  dpkg              1.15.5.6               Debian package management system
ii  libtimedate-perl  1.2000-1               collection of modules to manipulat
ii  lzma              4.43-14                Compression method of 7z format in
ii  make              3.81-7                 An utility for Directing compilati
ii  patch             2.6-2                  Apply a diff file to an original
ii  perl [perl5]      5.10.1-11              Larry Wall's Practical Extraction 
ii  perl-modules      5.10.1-11              Core Perl modules
ii  xz-utils          4.999.9beta+20091116-1 XZ-format compression utilities

Versions of packages dpkg-dev recommends:
ii  build-essential               11.4       Informational list of build-essent
ii  fakeroot                      1.14.4-1   Gives a fake root environment
ii  gcc [c-compiler]              4:4.4.2-3  The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.2-27   The GNU C compiler
ii  gcc-4.3 [c-compiler]          4.3.4-6    The GNU C compiler
ii  gcc-4.4 [c-compiler]          4.4.2-9    The GNU C compiler
ii  gnupg                         1.4.10-2   GNU privacy guard - a free PGP rep
ii  gpgv                          1.4.10-2   GNU privacy guard - signature veri

Versions of packages dpkg-dev suggests:
ii  debian-keyring [debian-mainta 2009.11.04 GnuPG (and obsolete PGP) keys of D

-- no debconf information



-- 
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