[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 28ca2d0e5c8d47abf2907b697a7711e6a7689293 Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 06:07:41 2010 +0200 dpkg-deb: Use new dpkg_ar library functions instead of ad-hoc code diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index ccaae00..40d6c0f 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -31,7 +31,6 @@ #include limits.h #include ctype.h #include string.h -#include time.h #include dirent.h #include unistd.h #include stdbool.h @@ -218,9 +217,8 @@ void do_build(const char *const *argv) { FILE *ar, *cf; int p1[2], p2[2], p3[2], warns, n, c, subdir, gzfd; pid_t c1,c2,c3; - struct stat controlstab, datastab, mscriptstab, debarstab; + struct stat controlstab, mscriptstab, debarstab; char conffilename[MAXCONFFILENAME+1]; - time_t thetime= 0; struct file_info *fi; struct file_info *symlist = NULL; struct file_info *symlist_end = NULL; @@ -419,33 +417,27 @@ void do_build(const char *const *argv) { close(p1[0]); subproc_wait_check(c2, gzip -9c, 0); subproc_wait_check(c1, tar -cf, 0); - if (fstat(gzfd,controlstab)) ohshite(_(failed to fstat tmpfile (control))); + + if (lseek(gzfd, 0, SEEK_SET)) +ohshite(_(failed to rewind tmpfile (control))); + /* We have our first file for the ar-archive. Write a header for it to the * package and insert it. */ if (oldformatflag) { +if (fstat(gzfd, controlstab)) + ohshite(_(failed to fstat tmpfile (control))); if (fprintf(ar, %-8s\n%ld\n, OLDARCHIVEVERSION, (long)controlstab.st_size) == EOF) werr(debar); +fd_fd_copy(gzfd, fileno(ar), -1, _(control)); } else { -thetime = time(NULL); -if (fprintf(ar, -DPKG_AR_MAGIC -%-16s%-12lu0 0 100644 %-10ld`\n -ARCHIVEVERSION \n -%s -%-16s%-12lu0 0 100644 %-10ld`\n, -DEBMAGIC, -thetime, -(long)sizeof(ARCHIVEVERSION), -(sizeof(ARCHIVEVERSION)1) ? \n : , -ADMINMEMBER, -(unsigned long)thetime, -(long)controlstab.st_size) == EOF) - werr(debar); +const char deb_magic[] = ARCHIVEVERSION \n; + +dpkg_ar_put_magic(debar, fileno(ar)); +dpkg_ar_member_put_mem(debar, fileno(ar), DEBMAGIC, + deb_magic, strlen(deb_magic)); +dpkg_ar_member_put_file(debar, fileno(ar), ADMINMEMBER, gzfd); } - - if (lseek(gzfd,0,SEEK_SET)) ohshite(_(failed to rewind tmpfile (control))); - fd_fd_copy(gzfd, fileno(ar), -1, _(control)); /* Control is done, now we need to archive the data. Start by creating * a new temporary file. Immediately unlink the temporary file so others @@ -524,23 +516,9 @@ void do_build(const char *const *argv) { sprintf(datamember, %s%s, DATAMEMBER, compressor-extension); -if (fstat(gzfd, datastab)) - ohshite(_(failed to fstat tmpfile (data))); -if (fprintf(ar, -%s -%-16s%-12lu0 0 100644 %-10ld`\n, -(controlstab.st_size 1) ? \n : , -datamember, -(unsigned long)thetime, -(long)datastab.st_size) == EOF) - werr(debar); - if (lseek(gzfd,0,SEEK_SET)) ohshite(_(failed to rewind tmpfile (data))); -fd_fd_copy(gzfd, fileno(ar), -1, _(cat (data))); -if (datastab.st_size 1) - if (putc('\n',ar) == EOF) -werr(debar); +dpkg_ar_member_put_file(debar, fileno(ar), datamember, gzfd); } if (fflush(ar)) ohshite(_(unable to flush file '%s'), debar); -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit f2115151c19ff37b305296c23225807b0832086b Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 06:15:26 2010 +0200 dpkg-split: Rewrite mksplit in C diff --git a/debian/changelog b/debian/changelog index ff780b7..7bedacf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -60,6 +60,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low stat_halfconfigured and “removal-failed” for stat_halfinstalled. * Check version syntax when parsing it from libdpkg based programs. Closes: #574704 + * Rewrite mksplit in C, and merge it into dpkg-split. [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/debian/dpkg.install b/debian/dpkg.install index 1b1b998..c3106d6 100644 --- a/debian/dpkg.install +++ b/debian/dpkg.install @@ -12,7 +12,6 @@ usr/bin/dpkg-split usr/bin/dpkg-statoverride usr/bin/dpkg-trigger usr/bin/update-alternatives -usr/lib/dpkg/mksplit usr/sbin usr/share/dpkg usr/share/locale/*/LC_MESSAGES/dpkg.mo diff --git a/dpkg-split/.gitignore b/dpkg-split/.gitignore index dedc3fc..26aab39 100644 --- a/dpkg-split/.gitignore +++ b/dpkg-split/.gitignore @@ -1,2 +1 @@ dpkg-split -mksplit diff --git a/dpkg-split/Makefile.am b/dpkg-split/Makefile.am index 6f6043c..64a1d27 100644 --- a/dpkg-split/Makefile.am +++ b/dpkg-split/Makefile.am @@ -24,20 +24,5 @@ dpkg_split_LDADD = \ ../lib/compat/libcompat.a \ $(LIBINTL) - -pkglib_SCRIPTS = mksplit -EXTRA_DIST = mksplit.pl -CLEANFILES = $(pkglib_SCRIPTS) - - -do_perl_subst = $(AM_V_GEN) sed -e s:^\#![:space:]*/usr/bin/perl:\#!$(PERL): - - -%: %.pl Makefile - @test -d `dirname $...@` || $(mkdir_p) `dirname $...@` - $(do_perl_subst) $ $@ - $(AM_V_at) chmod +x $@ - - install-data-local: $(mkdir_p) $(DESTDIR)$(admindir)/parts diff --git a/dpkg-split/mksplit.pl b/dpkg-split/mksplit.pl deleted file mode 100644 index 2950b1e..000 --- a/dpkg-split/mksplit.pl +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/perl -- -# This script is only supposed to be called by dpkg-split. -# Its arguments are: -# sourcefile partsize prefix totalsize partsizeallow msdostruncyesno -# Stdin is also redirected from the source archive by dpkg-split. - -# Copyright © 1995 Ian Jackson i...@chiark.greenend.org.uk -# -# This 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 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 http://www.gnu.org/licenses/. - -...@argv == 6 || die mksplit: bad invocation\n; - -($sourcefile,$partsize,$prefix,$orgsize,$partsizeallow,$msdos) = @ARGV; - -sub output { -$!=0; $rv= `$_[0]`; $? die mksplit $_[0]: $! $?\n; -$rv =~ s/\n$//; $rv =~ s/\s+$//; $rv =~ s/^\s+//; -$rv; -} - -$myversion='2.1'; -$csum= output(md5sum \$sourcefile\); -$csum =~ s/\s.*//; -$package= output(dpkg-deb --field \$sourcefile\ Package); -$version= output(dpkg-deb --field \$sourcefile\ Version); -$revision= output(dpkg-deb --field \$sourcefile\ Package_Revision); -$version.= -$revision if length($revision); -$nparts=int(($orgsize+$partsize-1)/$partsize); -$startat=0; -$showpartnum=1; - -$|=1; -print(Splitting package $package into $nparts parts: ); - -$msdos= ($msdos eq 'yes'); -if ($msdos) { -$prefixdir= $prefix; $prefixdir =~ s:(/?)/*[^/]+$:$1:; -$cleanprefix= $prefix; $cleanprefix =~ s:^.*/+::; -$cleanprefix =~ y/A-Za-z0-9+/a-za-z0-9x/; -$cleanprefix =~ y/a-z0-9//cd; -} - -sub add { -$data .= -sprintf(%-16s%-12d0 0 100644 %-10d%c\n%s%s, -$_[0], time, length($_[1]), 0140, $_[1], -(length($_[1]) 1) ? \n : ); -} - -while ($startat $orgsize) { -$dsp= $myversion\n$package\n$version\n$csum\n$orgsize\n$partsize\n. - $showpartnum/$nparts\n; -defined($thispartreallen= read(STDIN,$pd,$partsize)) || die mksplit: read: $!\n; -$data= !arch\n; -print($showpartnum ); -add('debian-split',$dsp); -add(data.$showpartnum,$pd); -if ($thispartreallen $partsizeallow) { -die Header is too long, making part too long. Your package name or version\n. -numbers must be extraordinarily long, or something. Giving up.\n; -} -if ($msdos) { -$basename= ${showpartnum}of$nparts.$cleanprefix; -$basename= substr($basename,0,9); -$basename =~ s/^([^.]*)\.(.*)$/$2$1/; -$basename= $prefixdir$basename; -} else { -$basename= $prefix.${showpartnum}of$nparts; -} -open(O, $basename.deb) ||
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit b7b59ee6ff98188627346998829f1df51a9bbb12 Author: Mikhail Gusarov dotted...@dottedmag.net Date: Wed Oct 14 02:36:44 2009 +0700 dpkg-divert: Add new test-case Devel::Cover reports 97% coverage. Remaining branches are hard-to-test without root privilege error handling. [guil...@debian.org: - Add new test into test_cases. - Run program from builddir. - Do not check for usage output on badusage. - Use note() instead of diag(). - Sort database and list output. - Skip some tests when under fakeroot. ] Signed-off-by: Guillem Jover guil...@debian.org diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c019619..718f77f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -179,7 +179,8 @@ test_cases = \ t/750_Dpkg_Substvars.t \ t/800_Dpkg_IPC.t \ t/850_Dpkg_Compression.t \ - t/910_merge_changelogs.t + t/910_merge_changelogs.t \ + t/950_dpkg_divert.t check_DATA = \ $(test_tmpdir)/200_Dpkg_Shlibs/objdump.basictags-amd64 \ diff --git a/scripts/t/950_dpkg_divert.t b/scripts/t/950_dpkg_divert.t new file mode 100644 index 000..f65d1e5 --- /dev/null +++ b/scripts/t/950_dpkg_divert.t @@ -0,0 +1,555 @@ +# -*- mode: cperl;-*- +# +# 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 http://www.gnu.org/licenses/. + +use Test::More; +use File::Spec; +use Dpkg::IPC; + +use strict; +use warnings; + +my $srcdir = $ENV{srcdir} || '.'; +my $builddir = $ENV{builddir} || '.'; +my $tmpdir = 't.tmp/950_dpkg_divert'; +my $admindir = File::Spec-rel2abs($tmpdir/admindir); +my $testdir = File::Spec-rel2abs($tmpdir/testdir); + +my @dd = ($builddir/dpkg-divert); + +plan tests = 235; + +sub cleanup { +system(rm -rf $tmpdir mkdir -p $testdir mkdir -p $admindir); +} + +sub install_diversions { +my ($txt) = @_; +open(O, $admindir/diversions); +print O $txt; +close(O); +} + +sub call { +my ($prog, $args, %opts) = @_; + +my ($output, $error); +spawn(exec = [...@$prog, @$args], wait_child = 1, nocheck = 1, + to_pipe = \$output, error_to_pipe = \$error, %opts); + +if ($opts{'expect_failure'}) { +ok($? != 0, @$args should fail); +} else { +ok($? == 0, @$args should not fail); +} + +if (defined $opts{'expect_stdout'}) { +my (@output) = $output; +my (@expect) = split(/^/, $opts{'expect_stdout'}); +if (defined $opts{'expect_sorted_stdout'}) { +@output = sort @output; +@expect = sort @expect; +} +is(join('', @output), join('', @expect), @$args stdout); +} +if (defined $opts{'expect_stdout_like'}) { +like(join('', $output), $opts{'expect_stdout_like'}, @$args stdout); +} +if (defined $opts{'expect_stderr'}) { +is(join('', $error), $opts{'expect_stderr'}, @$args stderr); +} +if (defined $opts{'expect_stderr_like'}) { +like(join('', $error), $opts{'expect_stderr_like'}, @$args stderr); +} + +close($output); +close($error); +} + +sub call_divert { +my ($params, %opts) = @_; +call([...@dd, '--admindir', $admindir], $params, %opts); +} + +sub call_divert_sort { +my ($params, %opts) = @_; +$opts{expect_sorted_stdout} = 1; +call_divert($params, %opts); +} + +sub diversions_pack { +my (@data) = @_; +my @data_packed; + +for (my ($i) = 0; $i $#data; $i += 3) { +push @data_packed, [ @data[$i .. $i + 2] ]; +} + +return sort { $a-[0] cmp $b-[0] } @data_packed; +} + +sub diversions_eq { +my (@expected) = split /^/, shift; +open(O, $admindir/diversions); +my (@contents) = O; +close(O); + +my (@expected_pack) = diversions_pack(@expected); +my (@contents_pack) = diversions_pack(@contents); + +is_deeply(\...@contents_pack, \...@expected_pack, diversions contents); +} + +### Tests + +cleanup(); + +note(Command line parsing testing); + +my $usagere = qr/.*Usage.*dpkg-divert.*Commands.*Options.*/s; + +sub call_divert_badusage { +my ($args, $err) = @_; +call_divert($args, expect_failure = 1, expect_stderr_like = $err); +} + +call_divert(['--help'], expect_stdout_like = $usagere, +expect_stderr = ''); +call_divert(['--version'], expect_stdout_like = qr/.*dpkg-divert.*Copyright.*free software.*/s, +expect_stderr = '');
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea Author: Guillem Jover guil...@debian.org Date: Fri Feb 19 05:57:29 2010 +0100 dpkg-divert: Rewrite in C diff --git a/debian/changelog b/debian/changelog index 7bedacf..eafdc9f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -61,6 +61,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low * Check version syntax when parsing it from libdpkg based programs. Closes: #574704 * Rewrite mksplit in C, and merge it into dpkg-split. + * Rewrite dpkg-divert in C. [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/po/POTFILES.in b/po/POTFILES.in index d73536c..f04bfd4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -38,6 +38,7 @@ src/archives.c src/cleanup.c src/configure.c src/depcon.c +src/divertcmd.c src/divertdb.c src/enquiry.c src/errors.c @@ -69,5 +70,3 @@ dpkg-split/split.c utils/start-stop-daemon.c utils/update-alternatives.c - -scripts/dpkg-divert.pl diff --git a/scripts/.gitignore b/scripts/.gitignore index 403beff..d12947c 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -3,7 +3,6 @@ dpkg-buildflags dpkg-buildpackage dpkg-checkbuilddeps dpkg-distaddfile -dpkg-divert dpkg-genchanges dpkg-gencontrol dpkg-gensymbols diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 718f77f..4589fa9 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -8,7 +8,6 @@ bin_SCRIPTS = \ dpkg-buildpackage \ dpkg-checkbuilddeps \ dpkg-distaddfile \ - dpkg-divert \ dpkg-genchanges \ dpkg-gencontrol \ dpkg-gensymbols \ @@ -43,7 +42,6 @@ EXTRA_DIST = \ dpkg-scansources.pl \ dpkg-shlibdeps.pl \ dpkg-source.pl \ - dpkg-divert.pl \ dpkg-vendor.pl \ changelog/debian.pl \ $(test_cases) \ diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl deleted file mode 100755 index 949a215..000 --- a/scripts/dpkg-divert.pl +++ /dev/null @@ -1,369 +0,0 @@ -#!/usr/bin/perl -# -# dpkg-divert -# -# 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 http://www.gnu.org/licenses/. - -BEGIN { # Work-around for bug #479711 in perl -$ENV{PERL_DL_NONLAZY} = 1; -} - -use strict; -use warnings; - -use POSIX qw(:errno_h); -use Dpkg; -use Dpkg::Gettext; - -textdomain(dpkg); - -sub version { -printf _g(Debian %s version %s.\n), $progname, $version; - -printf _g( -Copyright (C) 1995 Ian Jackson. -Copyright (C) 2000,2001 Wichert Akkerman.); - -printf \n . _g( -This is free software; see the GNU General Public License version 2 or -later for copying conditions. There is NO warranty. -); -} - -sub usage { -printf(_g( -Usage: %s [option ...] command - -Commands: - [--add] file add a diversion. - --remove file remove the diversion. - --list [glob-pattern] show file diversions. - --listpackage file show what package diverts the file. - --truename filereturn the diverted file. - -Options: - --package package name of the package whose copy of file will not - be diverted. - --local all packages' versions are diverted. - --divert divert-to the name used by other packages' versions. - --rename actually move the file aside (or back). - --admindir directory set the directory with the diversions file. - --test don't do anything, just demonstrate. - --quiet quiet operation, minimal output. - --help show this help message. - --versionshow the version. - -When adding, default is --local and --divert original.distrib. -When removing, --package or --local and --divert must match if specified. -Package preinst/postrm scripts should always specify --package and --divert. -), $progname); -} - -my $testmode = 0; -my $dorename = 0; -my $verbose = 1; -my $mode = ''; -my $package = undef; -my $divertto = undef; -my @contest; -my @altname; -my @package; -my $file; -$|=1; - - -# FIXME: those should be local. -my ($rsrc, $rdest); -my (@ssrc, @sdest); - -sub checkmanymodes { -return unless $mode; -badusage(sprintf(_g(two commands specified: %s and --%s), $_, $mode)); -} - -while (@ARGV) { -$_= shift(@ARGV); -last if m/^--$/; -if (!m/^-/) { -unshift(@ARGV,$_); last; -} elsif (m/^--help$/) { -
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 3b8074a91047c3308309f93f1bf344c339044e98 Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 06:14:04 2010 +0200 Use linux-any wildcard for libselinux1-dev Build-Depends Instead of using a list of negated architectures. This will make the job easier for new ports. And it's just more correct. diff --git a/debian/changelog b/debian/changelog index eafdc9f..fad8943 100644 --- a/debian/changelog +++ b/debian/changelog @@ -62,6 +62,8 @@ dpkg (1.15.8) UNRELEASED; urgency=low Closes: #574704 * Rewrite mksplit in C, and merge it into dpkg-split. * Rewrite dpkg-divert in C. + * Use linux-any wildcard for libselinux1-dev Build-Depends instead of +using a list of negated architectures. [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/debian/control b/debian/control index 191c8c6..b2bb177 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Standards-Version: 3.8.4 Build-Depends: debhelper (= 6.0.7), pkg-config, gettext (= 0.18), po4a (= 0.33.1), libncursesw5-dev, zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev, flex, - libselinux1-dev (= 1.28-4) [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64], + libselinux1-dev (= 1.28-4) [linux-any], libtimedate-perl, libio-string-perl Package: libdpkg-dev -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 0309242811c39aedda81521019ece0b3ffa16cc7 Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 12:36:06 2010 +0200 Bump Standards-Version to 3.9.0 diff --git a/debian/changelog b/debian/changelog index 7887666..ae1c951 100644 --- a/debian/changelog +++ b/debian/changelog @@ -67,6 +67,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low * Use Breaks instead of Conflicts in dpkg, dpkg-dev and libdpkg-perl binary packages. * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl. + * Bump Standards-Version to 3.9.0. [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/debian/control b/debian/control index 5be2306..ae0da12 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Bugs: debbugs://bugs.debian.org Homepage: http://wiki.debian.org/Teams/Dpkg Vcs-Browser: http://git.debian.org/?p=dpkg/dpkg.git Vcs-Git: git://git.debian.org/git/dpkg/dpkg.git -Standards-Version: 3.8.4 +Standards-Version: 3.9.0 Build-Depends: debhelper (= 6.0.7), pkg-config, gettext (= 0.18), po4a (= 0.33.1), libncursesw5-dev, zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev, flex, -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 2a2c2ef9188d718c914000fc6ab48f33acc54ddb Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 11:56:47 2010 +0200 Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl diff --git a/debian/changelog b/debian/changelog index 8e58318..7887666 100644 --- a/debian/changelog +++ b/debian/changelog @@ -66,6 +66,7 @@ dpkg (1.15.8) UNRELEASED; urgency=low using a list of negated architectures. * Use Breaks instead of Conflicts in dpkg, dpkg-dev and libdpkg-perl binary packages. + * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl. [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/debian/control b/debian/control index dca09ba..5be2306 100644 --- a/debian/control +++ b/debian/control @@ -32,7 +32,8 @@ Architecture: any Essential: yes Pre-Depends: ${shlibs:Depends}, coreutils (= 5.93-1), xz-utils Depends: ${misc:Depends} -Breaks: dpkg-dev ( 1.14.16), apt ( 0.7.7), aptitude ( 0.4.7-1), +Breaks: dpkg-dev ( 1.14.16), libdpkg-perl ( 1.15.8), + apt ( 0.7.7), aptitude ( 0.4.7-1), # install-info transition # see http://wiki.debian.org/Transitions/DpkgToGnuInstallInfo jed ( 1:0.99.18+dfsg.1-13), xjed ( 1:0.99.18+dfsg.1-13), @@ -71,7 +72,7 @@ Depends: dpkg (= 1.15.4), perl, libtimedate-perl, ${misc:Depends} Recommends: bzip2, xz-utils Suggests: debian-keyring, gnupg, gpgv, binutils, patch Breaks: dpkg-dev ( 1.15.6) -Replaces: dpkg-dev ( 1.15.6) +Replaces: dpkg ( 1.15.8), dpkg-dev ( 1.15.6) Description: Dpkg perl modules This package provides the perl modules used by the scripts in dpkg-dev. They cover a wide range of functionalities. Among them diff --git a/debian/dpkg.install b/debian/dpkg.install index c3106d6..511effd 100644 --- a/debian/dpkg.install +++ b/debian/dpkg.install @@ -26,8 +26,6 @@ usr/share/man/{*/*,*}/dpkg.cfg.5 usr/share/man/{*/*,*}/dpkg.1 usr/share/man/{*/*,*}/start-stop-daemon.8 usr/share/man/{*/*,*}/update-alternatives.8 -usr/share/perl5/Dpkg.pm -usr/share/perl5/Dpkg/Gettext.pm var/lib/dpkg/alternatives var/lib/dpkg/info var/lib/dpkg/parts diff --git a/debian/libdpkg-perl.install b/debian/libdpkg-perl.install index 72438e4..4d4c23d 100644 --- a/debian/libdpkg-perl.install +++ b/debian/libdpkg-perl.install @@ -1,4 +1,4 @@ usr/lib/dpkg/parsechangelog usr/share/locale/*/LC_MESSAGES/dpkg-dev.mo usr/share/man/man3/Dpkg*.3 -usr/share/perl5/Dpkg +usr/share/perl5/Dpkg* diff --git a/debian/rules b/debian/rules index b362a76..b4b70b8 100755 --- a/debian/rules +++ b/debian/rules @@ -108,7 +108,7 @@ binary-arch: install binary-indep: install dh_testdir -i dh_testroot -i - dh_install --sourcedir=debian/tmp -i -XDpkg/Gettext.pm + dh_install --sourcedir=debian/tmp -i dh_installcron -i dh_installchangelogs -i ChangeLog* dh_installdocs -i diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm index b6ba75d..283f041 100644 --- a/scripts/Dpkg.pm +++ b/scripts/Dpkg.pm @@ -18,12 +18,6 @@ use warnings; our $VERSION = 1.00; -# This module is the only one provided by dpkg and not dpkg-dev -# -# Don't add things here if you don't need them in dpkg itself. -# If you do, and also use the new stuff in dpkg-dev, you'll have to bump -# the dependency of dpkg-dev on dpkg. - use base qw(Exporter); our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir); -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit 0238821c66112e5403dd8abbf6eca0962866d944 Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 13:03:44 2010 +0200 libdpkg: Refactor file lock setup into file_lock_setup() diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c index f46d8e7..12a67f2 100644 --- a/lib/dpkg/file.c +++ b/lib/dpkg/file.c @@ -54,16 +54,25 @@ file_copy_perms(const char *src, const char *dst) } static void +file_lock_setup(struct flock *fl, short type) +{ + fl-l_type = type; + fl-l_whence = SEEK_SET; + fl-l_start = 0; + fl-l_len = 0; + fl-l_pid = 0; +} + +static void file_unlock_cleanup(int argc, void **argv) { int lockfd = *(int*)argv[0]; struct flock fl; assert(lockfd = 0); - fl.l_type = F_UNLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 0; - fl.l_len = 0; + + file_lock_setup(fl, F_UNLCK); + if (fcntl(lockfd, F_SETLK, fl) == -1) ohshite(_(unable to unlock dpkg status database)); } @@ -84,10 +93,7 @@ file_lock(int *lockfd, const char *filename, setcloexec(*lockfd, filename); - fl.l_type = F_WRLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 0; - fl.l_len = 0; + file_lock_setup(fl, F_WRLCK); if (fcntl(*lockfd, emsg_eagain ? F_SETLK : F_SETLKW, fl) == -1) { if (emsg_eagain (errno == EACCES || errno == EAGAIN)) -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit c3d9eea8d03d93eed6e2d87a97acfca5562b2b32 Author: Guillem Jover guil...@debian.org Date: Fri Jul 2 13:13:01 2010 +0200 dpkg: Detect locked databases on --audit Detect when another process has locked the database, and mention that problematic dpkg --audit results might be due to ongoing operations. Closes: #80252 diff --git a/debian/changelog b/debian/changelog index ae1c951..a2d130e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -68,6 +68,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low packages. * Move Dpkg.pm and Dpkg/Gettext.pm from dpkg to libdpkg-perl. * Bump Standards-Version to 3.9.0. + * Detect when another process has locked the database, and mention that +problematic dpkg --audit results might be due to ongoing operations. +Closes: #80252 [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c index 02c1c35..bc39448 100644 --- a/lib/dpkg/dbmodify.c +++ b/lib/dpkg/dbmodify.c @@ -142,10 +142,40 @@ static const struct fni { { NULL, NULL } }; +static int dblockfd = -1; + +bool +modstatdb_is_locked(const char *admindir) +{ + struct varbuf lockfile = VARBUF_INIT; + int lockfd; + bool locked; + + varbufprintf(lockfile, %s/%s, admindir, LOCKFILE); + + if (dblockfd == -1) { +lockfd = open(lockfile.buf, O_RDONLY); +if (lockfd == -1) + ohshite(_(unable to open lock file %s for testing), lockfile.buf); + } else { +lockfd = dblockfd; + } + + locked = file_is_locked(lockfd, lockfile.buf); + + /* We only close the file if there was no lock open, otherwise we would + * release the existing lock on close. */ + if (dblockfd == -1) +close(lockfd); + + varbuf_destroy(lockfile); + + return locked; +} + void modstatdb_lock(const char *admindir) { - static int dblockfd = -1; int n; char *dblockfile = NULL; diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h index c2e57a4..3590d42 100644 --- a/lib/dpkg/dpkg-db.h +++ b/lib/dpkg/dpkg-db.h @@ -199,6 +199,7 @@ enum modstatdb_rw { msdbrw_noavail= 0100, }; +bool modstatdb_is_locked(const char *admindir); void modstatdb_lock(const char *admindir); void modstatdb_unlock(void); enum modstatdb_rw modstatdb_init(const char *admindir, enum modstatdb_rw reqrwflags); diff --git a/lib/dpkg/file.c b/lib/dpkg/file.c index 12a67f2..40fbbea 100644 --- a/lib/dpkg/file.c +++ b/lib/dpkg/file.c @@ -83,6 +83,28 @@ file_unlock(void) pop_cleanup(ehflag_normaltidy); /* Calls file_unlock_cleanup. */ } +/** + * Check if a file has a lock acquired. + * + * @param lockfd The file descriptor for the lock. + * @param filename The file name associated to the file descriptor. + */ +bool +file_is_locked(int lockfd, const char *filename) +{ + struct flock fl; + + file_lock_setup(fl, F_WRLCK); + + if (fcntl(lockfd, F_GETLK, fl) == -1) + ohshit(_(unable to check file '%s' lock status), filename); + + if (fl.l_type == F_WRLCK fl.l_pid != getpid()) + return true; + else + return false; +} + /* lockfd must be allocated statically as its addresses is passed to * a cleanup handler. */ void diff --git a/lib/dpkg/file.h b/lib/dpkg/file.h index ee14206..24dca2c 100644 --- a/lib/dpkg/file.h +++ b/lib/dpkg/file.h @@ -21,6 +21,8 @@ #ifndef LIBDPKG_FILE_H #define LIBDPKG_FILE_H +#include stdbool.h + #include dpkg/macros.h DPKG_BEGIN_DECLS @@ -30,6 +32,7 @@ DPKG_BEGIN_DECLS */ void file_copy_perms(const char *src, const char *dst); +bool file_is_locked(int lockfd, const char *filename); void file_lock(int *lockfd, const char *filename, const char *emsg, const char *emsg_eagain); void file_unlock(void); diff --git a/src/enquiry.c b/src/enquiry.c index af45426..d8e1a4f 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -124,6 +124,7 @@ static void describebriefly(struct pkginfo *pkg) { void audit(const char *const *argv) { const struct badstatinfo *bsi; + bool head_running = false; if (*argv) badusage(_(--%s takes no arguments), cipaction-olong); @@ -138,6 +139,13 @@ void audit(const char *const *argv) { it= iterpkgstart(); while ((pkg= iterpkgnext(it))) { if (!bsi-yesno(pkg,bsi)) continue; + if (!head_running) { +if (modstatdb_is_locked(admindir)) + puts(_( +Another process has locked the database for writing, and might currently be\n +modifying it, some of the following problems might just be due to that.\n)); +head_running = true; + } if (!head) { fputs(gettext(bsi-explanation),stdout); head = true; -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-132-gbd0ae9a
The following commit has been merged in the master branch: commit bd0ae9a42b06f09223383e67edb262041e2bd98d Author: Henning Makholm henn...@makholm.net Date: Sat Jul 3 04:30:04 2010 +0200 Add new dpkg --force-confask option The option forces a conffile prompt when the conffile from the new package does not differ from the previous one version. Closes: #102609 Signed-off-by: Guillem Jover guil...@debian.org diff --git a/debian/changelog b/debian/changelog index a2d130e..acf3793 100644 --- a/debian/changelog +++ b/debian/changelog @@ -71,6 +71,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low * Detect when another process has locked the database, and mention that problematic dpkg --audit results might be due to ongoing operations. Closes: #80252 + * Add new dpkg --force-confask option that forces a conffile prompt when +the conffile from the new package does not differ from the previous one. +Thanks to Henning Makholm henn...@makholm.net. Closes: #102609 [ Updated programs translations ] * Catalan (Guillem Jover). diff --git a/man/dpkg.1 b/man/dpkg.1 index d0d6326..d550d11 100644 --- a/man/dpkg.1 +++ b/man/dpkg.1 @@ -427,6 +427,13 @@ there is no default action it will stop to ask the user unless \fB\-\-force\-confnew\fP or \fB\-\-force\-confold\fP is also been given, in which case it will use that to decide the final action. +\fBconfask\fP: +If a conffile has been modified always offer to replace it with the +version in the package, even if the version in the package did not +change. If one of \fB\-\-force\-confnew\fP, \fB\-\-force\-confold\fP, +or \fB\-\-force\-confdef\fP is also given, it will be used to decide +the final action. + \fBoverwrite\fP: Overwrite one package's file with another's file. diff --git a/src/configure.c b/src/configure.c index aa2fad5..f0a7053 100644 --- a/src/configure.c +++ b/src/configure.c @@ -141,7 +141,12 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) } else { useredited = strcmp(conff-hash, currenthash) != 0; distedited = strcmp(conff-hash, newdisthash) != 0; - what = conffoptcells[useredited][distedited]; + + if (fc_conff_ask useredited) + what = cfo_prompt_keep; + else + what = conffoptcells[useredited][distedited]; + if (!strcmp(currenthash, NONEXISTENTFLAG)) what |= cfof_userrmd; } diff --git a/src/main.c b/src/main.c index c933f24..e1fdebb 100644 --- a/src/main.c +++ b/src/main.c @@ -183,6 +183,7 @@ int fc_removeessential=0, fc_conflicts=0, fc_depends=0, fc_dependsversion=0; int fc_breaks=0, fc_badpath=0, fc_overwritediverted=0, fc_architecture=0; int fc_nonroot=0, fc_overwritedir=0, fc_conff_new=0, fc_conff_miss=0; int fc_conff_old=0, fc_conff_def=0; +int fc_conff_ask = 0; int fc_badverify = 0; int errabort = 50; @@ -204,6 +205,7 @@ static const struct forceinfo { { confold, fc_conff_old}, { confdef, fc_conff_def}, { confmiss,fc_conff_miss }, + { confask, fc_conff_ask}, { depends, fc_depends }, { depends-version, fc_dependsversion }, { breaks, fc_breaks }, @@ -417,6 +419,7 @@ static void setforce(const struct cmdinfo *cip, const char *value) { you will be prompted unless one of the confold or\n confnew options is also given\n confmiss [!] Always install missing config files\n + confask [!]Offer to replace config files with no new versions\n breaks [!] Install even if it would break another package\n conflicts [!] Allow installation of conflicting packages\n architecture [!] Process even packages with wrong architecture\n diff --git a/src/main.h b/src/main.h index 388febe..17ba2d4 100644 --- a/src/main.h +++ b/src/main.h @@ -129,6 +129,7 @@ extern int fc_removeessential, fc_conflicts, fc_depends, fc_dependsversion; extern int fc_breaks, fc_badpath, fc_overwritediverted, fc_architecture; extern int fc_nonroot, fc_overwritedir, fc_conff_new, fc_conff_miss; extern int fc_conff_old, fc_conff_def; +extern int fc_conff_ask; extern int fc_badverify; extern bool abort_processing; -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org