diff -Nru dpkg-repack-1.43/debian/changelog dpkg-repack-1.44/debian/changelog --- dpkg-repack-1.43/debian/changelog 2016-02-29 08:03:10.000000000 +0000 +++ dpkg-repack-1.44/debian/changelog 2018-07-21 11:20:21.000000000 +0000 @@ -1,3 +1,24 @@ +dpkg-repack (1.44) unstable; urgency=medium + + * Spelling fixes. Thanks to Josh Soref . + * Line-wrap dependency fields. + * Bump Standard-Version to 4.1.5 (no changed needed). + * Bump debhelper compatibility to level 10. + * Use the provided pkgname when calling dpkg commands, instead of partially + reconstructing it from metadata, as we might end up not matching the same + arch-qualifying the user specified. Closes: #870724 + * Use Dpkg::IPC instead of qx() or open() subcommand pipe support. This will + give more accurate error messages and will check all function return codes + involved. + * Namespace debhelper files with package names. + * Update Vcs URLs to point to the new hosting site. + * Move author information in man page from a dedicated section into a proper + copyright and license header. + * Rewrite man page from groff to POD. + * Set Rules-Requires-Root to no. + + -- Guillem Jover Sat, 21 Jul 2018 13:20:21 +0200 + dpkg-repack (1.43) unstable; urgency=medium * Fix variable name botched in a last-minute rebase. @@ -220,7 +241,7 @@ dpkg-repack (1.23) unstable; urgency=low * Man page typo. Closes: #362044 - * Patch from Tomas Pospisek to use cp -a whe copying a named pipe, + * Patch from Tomas Pospisek to use cp -a when copying a named pipe, as cp -pd will read from the pipe. Closes: #287319 -- Joey Hess Mon, 15 May 2006 17:15:11 -0500 @@ -262,7 +283,7 @@ dpkg-repack (1.17) unstable; urgency=low - * Swtich from build-depend-indep to build-depends. + * Switch from build-depend-indep to build-depends. -- Joey Hess Mon, 8 Sep 2003 20:45:07 -0400 @@ -283,7 +304,7 @@ dpkg-repack (1.14) unstable; urgency=low * fakeroot's new -u flag should be used if using dpkg-repack with fakeroot. - Otherwise permisions of non-root-owned files can be messed up. Warn about + Otherwise permissions of non-root-owned files can be messed up. Warn about this if -u is not used. * Other minor changes. @@ -330,7 +351,7 @@ dpkg-repack (1.7) unstable; urgency=low - * Fixed uninitalized value if the last item in a package's file list + * Fixed uninitialized value if the last item in a package's file list was a symlink to a directory that also exists in the package. Closes: #88978 * Removed the debstd-style output. @@ -442,10 +463,10 @@ dpkg-repack (0.18) unstable; urgency=low - * Removed some debugging output I accidentially put in the last version. - * Workes now for packages that have filenames with spaces in them (like + * Removed some debugging output I accidentally put in the last version. + * Works now for packages that have filenames with spaces in them (like maelstrom). - * Checged the descripton to remove the "attempts to". It should always + * Changed the description to remove the "attempts to". It should always work. (heh) -- Joey Hess Thu, 28 May 1998 06:14:27 -0400 @@ -454,13 +475,13 @@ * Uses dpkg for querying the status file and getting the file list, rather than doing it by hand. However, dpkg-repack still accesses the dpkg - database directly, becuase it copies maintainer scripts, etc, from + database directly, because it copies maintainer scripts, etc, from there. There is no way to get that information via dpkg. * Fixed bug #22603 - a failure when eg. /usr is a symlink. . If the package contains a file, that locally looks like a symlink pointing to a directory that is not in the package, then change it to a - real directory in the repacked package. This assummes that in this case, + real directory in the repacked package. This assumes that in this case, the symlink was a local change (eg, /usr is a symlink). . However, if the directory in question contains no files in the filelist diff -Nru dpkg-repack-1.43/debian/clean dpkg-repack-1.44/debian/clean --- dpkg-repack-1.43/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ dpkg-repack-1.44/debian/clean 2018-07-18 00:45:37.000000000 +0000 @@ -0,0 +1 @@ +dpkg-repack.1 diff -Nru dpkg-repack-1.43/debian/compat dpkg-repack-1.44/debian/compat --- dpkg-repack-1.43/debian/compat 2014-11-26 04:45:46.000000000 +0000 +++ dpkg-repack-1.44/debian/compat 2018-04-28 16:16:44.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru dpkg-repack-1.43/debian/control dpkg-repack-1.44/debian/control --- dpkg-repack-1.43/debian/control 2016-02-29 08:02:46.000000000 +0000 +++ dpkg-repack-1.44/debian/control 2018-07-21 11:20:21.000000000 +0000 @@ -3,19 +3,24 @@ Priority: optional Maintainer: Dpkg Developers Uploaders: Guillem Jover -Standards-Version: 3.9.7 -Vcs-Browser: https://anonscm.debian.org/cgit/dpkg/dpkg-repack.git -Vcs-Git: https://anonscm.debian.org/git/dpkg/dpkg-repack.git +Standards-Version: 4.1.5 +Vcs-Browser: https://git.dpkg.org/cgit/dpkg/dpkg-repack.git +Vcs-Git: https://git.dpkg.org/git/dpkg/dpkg-repack.git Homepage: https://wiki.debian.org/Teams/Dpkg +Rules-Requires-Root: no Build-Depends: dpkg-dev (>= 1.17.14), - debhelper (>= 9.20141010), + debhelper (>= 10), libtest-strict-perl , Package: dpkg-repack Architecture: all -Depends: ${misc:Depends}, ${perl:Depends}, libdpkg-perl -Suggests: fakeroot +Depends: + ${misc:Depends}, + ${perl:Depends}, + libdpkg-perl, +Suggests: + fakeroot, Description: Debian package archiving tool dpkg-repack creates a .deb file out of a package that has already been installed. If any changes have been made to the package while it was diff -Nru dpkg-repack-1.43/debian/copyright dpkg-repack-1.44/debian/copyright --- dpkg-repack-1.43/debian/copyright 2016-02-28 22:27:56.000000000 +0000 +++ dpkg-repack-1.44/debian/copyright 2018-04-28 16:18:24.000000000 +0000 @@ -3,7 +3,7 @@ Files: * Copyright: Copyright © 1996-2009 Joey Hess - Copyright © 2012,2014-2016 Guillem Jover + Copyright © 2012, 2014-2017 Guillem Jover License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru dpkg-repack-1.43/debian/docs dpkg-repack-1.44/debian/docs --- dpkg-repack-1.43/debian/docs 2012-09-10 19:12:46.000000000 +0000 +++ dpkg-repack-1.44/debian/docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -README diff -Nru dpkg-repack-1.43/debian/dpkg-repack.docs dpkg-repack-1.44/debian/dpkg-repack.docs --- dpkg-repack-1.43/debian/dpkg-repack.docs 1970-01-01 00:00:00.000000000 +0000 +++ dpkg-repack-1.44/debian/dpkg-repack.docs 2012-09-10 19:12:46.000000000 +0000 @@ -0,0 +1 @@ +README diff -Nru dpkg-repack-1.43/debian/dpkg-repack.install dpkg-repack-1.44/debian/dpkg-repack.install --- dpkg-repack-1.43/debian/dpkg-repack.install 1970-01-01 00:00:00.000000000 +0000 +++ dpkg-repack-1.44/debian/dpkg-repack.install 2012-09-10 19:12:46.000000000 +0000 @@ -0,0 +1 @@ +dpkg-repack usr/bin diff -Nru dpkg-repack-1.43/debian/dpkg-repack.manpages dpkg-repack-1.44/debian/dpkg-repack.manpages --- dpkg-repack-1.43/debian/dpkg-repack.manpages 1970-01-01 00:00:00.000000000 +0000 +++ dpkg-repack-1.44/debian/dpkg-repack.manpages 2012-09-10 19:12:46.000000000 +0000 @@ -0,0 +1 @@ +dpkg-repack.1 diff -Nru dpkg-repack-1.43/debian/install dpkg-repack-1.44/debian/install --- dpkg-repack-1.43/debian/install 2012-09-10 19:12:46.000000000 +0000 +++ dpkg-repack-1.44/debian/install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -dpkg-repack usr/bin diff -Nru dpkg-repack-1.43/debian/manpages dpkg-repack-1.44/debian/manpages --- dpkg-repack-1.43/debian/manpages 2012-09-10 19:12:46.000000000 +0000 +++ dpkg-repack-1.44/debian/manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -dpkg-repack.1 diff -Nru dpkg-repack-1.43/debian/rules dpkg-repack-1.44/debian/rules --- dpkg-repack-1.43/debian/rules 2016-02-29 08:02:46.000000000 +0000 +++ dpkg-repack-1.44/debian/rules 2018-07-18 00:45:37.000000000 +0000 @@ -1,16 +1,28 @@ #!/usr/bin/make -f +include /usr/share/dpkg/default.mk + +MANDATE := $(shell TZ=UTC0 LC_ALL=C date --date='@$(SOURCE_DATE_EPOCH)' '+%F') + clean: dh_testdir dh_clean -build-indep: +dpkg-repack.1: dpkg-repack.pod + pod2man \ + --section 1 \ + --center='dpkg suite' \ + --date='$(MANDATE)' \ + --release='$(DEB_VERSION)' \ + $< $@ + +build-indep: dpkg-repack.1 build-arch: build: build-indep build-arch .PHONY: clean build-indep build-arch build -binary-indep: +binary-indep: build-indep dh_testroot dh_prep diff -Nru dpkg-repack-1.43/dpkg-repack dpkg-repack-1.44/dpkg-repack --- dpkg-repack-1.43/dpkg-repack 2016-02-29 08:02:18.000000000 +0000 +++ dpkg-repack-1.44/dpkg-repack 2018-07-21 11:20:21.000000000 +0000 @@ -3,7 +3,7 @@ # dpkg-repack puts humpty-dumpty back together again. # # Copyright © 1996-2006 Joey Hess -# Copyright © 2012,2014-2016 Guillem Jover +# Copyright © 2012, 2014-2017 Guillem Jover # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,12 +23,14 @@ use File::stat; use File::Temp; +use List::Util qw(any none); use Dpkg::Path qw(find_command); +use Dpkg::IPC; use Dpkg::Control; use Dpkg::Control::Fields; use Getopt::Long; -my $VERSION = '1.43'; +my $VERSION = '1.44'; my $error_flag; my $rootdir; @@ -42,7 +44,7 @@ ); sub Syntax { - print { *STDERR } <new(type => CTRL_FILE_STATUS); - open my $fh, '-|', 'dpkg', "--root=$rootdir/", '-s', $pkgname - or Die "Unable to locate $pkgname in the package list."; + my $fh; + my @cmd = ('dpkg', "--root=$rootdir/", '-s', $pkgname); + my $pid = spawn(exec => \@cmd, to_pipe => \$fh); $inst->parse($fh, "dpkg status for $pkgname"); - close $fh; + wait_child($pid, cmdline => "@cmd"); if ($inst->{Status} !~ m/^\S+\s+\S+\s+installed$/) { Die "Package $pkgname not fully installed: $inst->{Status}"; @@ -180,16 +183,20 @@ # Install all the files in the DEBIAN directory. (Except control file and # file list file.) sub Install_DEBIAN { - my ($build_dir, $inst, @conffiles) = @_; + my ($pkgname, $build_dir, $inst, @conffiles) = @_; + + my $fh; + my @cmd = ('dpkg-query', "--admindir=$rootdir/var/lib/dpkg", + '--control-path', $pkgname); + my $pid = spawn(exec => \@cmd, to_pipe => \$fh); my @control_files; - open my $q_fh, '-|', "dpkg-query --admindir=$rootdir/var/lib/dpkg --control-path $inst->{Package} 2>/dev/null" - or Die "dpkg-query failed: $!"; - while (my $fn = <$q_fh>) { + while (my $fn = <$fh>) { chomp $fn; push @control_files, $fn; } - close $q_fh; + + wait_child($pid, cmdline => "@cmd"); foreach my $fn (@control_files) { my ($basename) = $fn =~ m/^.*\.(.*?)$/; @@ -208,12 +215,14 @@ close $out_fh; SafeSystem 'chown', '0:0', "$build_dir/DEBIAN/conffiles", ''; } + + Install_Control($build_dir, $inst); } # This looks at the list of files in this package, and places them # all on the directory tree. sub Install_Files { - my ($build_dir, $inst) = @_; + my ($pkgname, $build_dir, $inst) = @_; # There are two types of conffiles. Obsolete conffiles should be # skipped, while other conffiles should be included if present. @@ -231,10 +240,10 @@ # see where symlinks point to. Note that because we parse the output # of the command (for diversions, below) it's important to make sure # it runs with English language output. - my $lc_all = $ENV{LC_ALL}; - $ENV{LC_ALL} = 'C'; - my @filelist = split /\n/, qx{dpkg --root=$rootdir/ -L $inst->{Package}}; - $ENV{LC_ALL} = $lc_all if defined $lc_all; # important to reset it. + my $filelist; + spawn(exec => [ 'dpkg', "--root=$rootdir/", '-L', $pkgname ], + env => { LC_ALL => 'C' }, to_string => \$filelist, wait_child => 1); + my @filelist = split /\n/, $filelist; # Set up a hash for easy lookups. my %filelist = map { $_ => 1 } @filelist; @@ -259,19 +268,19 @@ $fn = $rootdir . $origfn; } - if (grep { $_ eq $fn } @obsolete_conffiles) { + if (any { $_ eq $fn } @obsolete_conffiles) { Warn("Skipping obsolete conffile $fn"); next; } if (!-e $fn && !-l $fn) { - Error "File not found: $fn" unless grep { $_ eq $fn } @conffiles; + Error "File not found: $fn" if none { $_ eq $fn } @conffiles; } elsif ((-d $fn and not -l $fn) or (-d $fn and -l $fn and not $filelist{readlink($fn)} and ($x + 1 <= $#filelist and $filelist[$x + 1] =~ m/^\Q$origfn\E\//))) { # If the package contains a file, that locally looks like a symlink # pointing to a directory that is not in the package, then change - # it to a real directory in the repacked package. This assummes + # it to a real directory in the repacked package. This assumes # that in this case, the symlink was a local change (e.g., /usr # is a symlink). # @@ -286,8 +295,8 @@ my $f = ''; foreach my $dir (split(m/\/+/, $origfn)) { $f .= "/$dir"; - next if -d $build_dir . $f; - my $st = stat($rootdir . $f); + next if -d "$build_dir/$f"; + my $st = stat "$rootdir/$f"; SafeMkdir "$build_dir/$f", $st->mode; chown($st->uid, $st->gid, "$build_dir/$f"); } @@ -353,9 +362,8 @@ # Generate the directory tree. my $build_dir = Make_Dirs($pkgname); - my @conffiles = Install_Files($build_dir, $inst); - Install_DEBIAN($build_dir, $inst, @conffiles); - Install_Control($build_dir, $inst); + my @conffiles = Install_Files($pkgname, $build_dir, $inst); + Install_DEBIAN($pkgname, $build_dir, $inst, @conffiles); # Do we need to create the binary packages? if ($generate) { diff -Nru dpkg-repack-1.43/dpkg-repack.1 dpkg-repack-1.44/dpkg-repack.1 --- dpkg-repack-1.43/dpkg-repack.1 2016-02-29 08:01:19.000000000 +0000 +++ dpkg-repack-1.44/dpkg-repack.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -.TH dpkg\-repack 1 "2016-02-29" 1.43 "dpkg suite" -.SH NAME -dpkg\-repack \- put an unpacked .deb file back together -. -.SH SYNOPSIS -\fBdpkg\-repack\fP [\fIoption\fP...] \fIpackage-name\fP... -. -.SH DESCRIPTION -.B dpkg\-repack -creates a .deb file out of a Debian package -that has already been installed on your system. - -If any changes have been made to the package while it was unpacked (e.g. -conffiles files in /etc modified), the new package will inherit the -changes. (There are exceptions to this, including changes to configuration -files that are not conffiles, including those managed by ucf.) - -This utility can make it easy to copy packages from one computer -to another, or to recreate packages that are installed on your -system, but no longer available elsewhere. - -Note: -.B dpkg\-repack -will place the created package in the current directory. -. -.SH OPTIONS -.TP -.BI \-\-root= dir -Take package from filesystem rooted on \fIdir\fP. This is useful if, for -example, you have another computer nfs mounted on /mnt, then you can use -\fB\-\-root=/mnt\fP to reassemble packages from that computer. -. -.TP -.BI \-\-arch= architecture -Make the package be for a specific \fIarchitecture\fP. -.B dpkg\-repack -might not be able to tell if an installed package is architecture \fBall\fP -or is specific to the system's architecture, in case it lacks the -.B Architecture -field. If you know the package architecture, you can use this option to force -.B dpkg\-repack -to use the right architecture. -. -.TP -.BR \-d ", " \-\-deb\-option "=\fIoption\fP" -Pass \fIoption\fP as build argument to \fBdpkg\-deb\fP. -This option can be specified multiple times. -. -.TP -.B \-\-generate -Generate a temporary directory suitable for building a package from, but do -not actually create the package. This is useful if you want to move files -around in the package before building it. The package can be built from -this temporary directory by running -"\fBdpkg\-deb \-\-build\fP \fIdir\fP \fB.\fP" as root (or by using -\fBfakroot \-u\fP), where \fIdir\fP is the generated directory. -. -.TP -.BR \-\-tag "=\fIthing\fP[,...]" -Specify a comma-separated list of things to tag in the package as having -been repackaged. -The current list of \fIthing\fPs to tag is: -.RS -.TP -.B none -Tag nothing. -This can be specified first to be augmented by more specific \fIthing\fPs. -.TP -.B description -Append a timestamped "Repackaged by dpkg-repack" tagline to the package's -control file \fBDescription\fP field. -This tag is enabled by default. -.TP -.B version -Append a "+repack" tag to the package version. -.TP -.B all -Tag everything. -.RE -. -.TP -.I package-name -The name of the package to attempt to repack. Multiple packages can be listed. -. -.SH BUGS -There is a tricky situation that can occur if you \fBdpkg\-repack\fP a package -that has modified conffiles. The modified conffiles are packed up. Now if -you install the package, \fBdpkg\fP(1) does not realize that the conffiles -in it are modified. So if you later upgrade to a new version of the package, -\fBdpkg\fP(1) will believe that the old (repacked) package has older conffiles -than the new version, and will silently replace the conffiles with those in -the package you are upgrading to. -.P -While \fBdpkg\-repack\fP can be run under \fBfakeroot\fP(1) and will work -most of the time, \fBfakeroot \-u\fP must be used if any of the files to be -repacked are owned by non-root users. Otherwise the package will have them -owned by root. -\fBdpkg\-repack\fP will warn if you run it under \fBfakeroot\fP(1) without -the \fB\-u\fP flag. -. -.SH SEE ALSO -.BR dpkg (1), -.BR dpkg-deb (1), -.BR fakeroot (1). -. -.SH AUTHOR -Joey Hess diff -Nru dpkg-repack-1.43/dpkg-repack.pod dpkg-repack-1.44/dpkg-repack.pod --- dpkg-repack-1.43/dpkg-repack.pod 1970-01-01 00:00:00.000000000 +0000 +++ dpkg-repack-1.44/dpkg-repack.pod 2018-07-18 00:45:37.000000000 +0000 @@ -0,0 +1,125 @@ +# Copyright © 1996-2006 Joey Hess +# Copyright © 2012, 2014-2016 Guillem Jover +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +=head1 NAME + +dpkg-repack - put an unpacked .deb file back together + +=head1 SYNOPSIS + +B [I