Bläddra i källkod

Add support for '--admindir' in dpkg-buildpackage, dpkg-checkbuilddeps
and dpkg-shlibdeps. Closes: #162348

Guillem Jover 19 år sedan
förälder
incheckning
b4d9b94ef1

+ 13 - 0
ChangeLog

@@ -1,3 +1,16 @@
+2007-02-28  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-checkbuilddeps.pl: Make getopt parse '--admindir'.
+	($admindir): New variable.
+	(usage): Document '--admindir'.
+	(parse_status): The status argument is not optional anymore.
+	* scripts/dpkg-shlibdeps.pl: Parse '--admindir'.
+	($admindir): New variable.
+	($shlibsppdir): Initialize it after parsing the arguments.
+	(usage): Document '--admindir'.
+	* scripts/dpkg-buildpackage.sh: Parse '--admindir', and document it in
+	usage output. Pass it to dpkg-checkbuilddeps.
+
 2007-02-28  Guillem Jover  <guillem@debian.org>
 
 	* scripts/update-alternatives.pl (usage): Use '$altdir' instead of

+ 2 - 0
debian/changelog

@@ -39,6 +39,8 @@ dpkg (1.14.0) UNRELEASED; urgency=low
   * Fix regular expression special-casing Origin, Bugs and Maintainer fields
     which was making X[SBC]- fields containing such strings to propagate into
     the .deb control file unprocessed. Thanks to Colin Watson.
+  * Add support for '--admindir' in dpkg-buildpackage, dpkg-checkbuilddeps
+    and dpkg-shlibdeps. Closes: #162348
 
   [ Updated dpkg translations ]
   * Romanian (Eddy Petrișor).

+ 5 - 0
man/ChangeLog

@@ -1,3 +1,8 @@
+2007-02-28  Guillem Jover  <guillem@debian.org>
+
+	* dpkg-source.1: Document new option '--admindir'.
+	* dpkg-checkbuilddeps.1: Likewise.
+
 2007-01-24  Frank Lichtenheld  <djpig@debian.org>
 
 	* 822-date.1: 822-date is now deprecated. Document this fact in

+ 6 - 2
man/dpkg-checkbuilddeps.1

@@ -1,9 +1,9 @@
-.TH dpkg\-checkbuilddeps 1 "2006-05-23" "Debian Project" "dpkg utilities"
+.TH dpkg\-checkbuilddeps 1 "2007-02-28" "Debian Project" "dpkg utilities"
 .SH NAME
 dpkg\-checkbuilddeps - check build dependencies and conflicts
 .
 .SH SYNOPSIS
-\fBdpkg\-checkbuilddeps\fR \fB\-B\fR [\fIcontrol-file\fR]
+\fBdpkg\-checkbuilddeps\fR [\fIoptions\fR] [\fIcontrol-file\fR]
 .
 .SH DESCRIPTION
 This program checks the installed packages in the system against the build
@@ -15,6 +15,10 @@ may be specified on the command line.
 .
 .SH OPTIONS
 .TP
+\fB\-\-admindir=\fIdir\fP
+Change the location of the \fBdpkg\fR database. The default location is
+\fI/var/lib/dpkg\fP.
+.TP
 .B \-B
 Ignore \fIBuild\-Depends\-Indep\fR lines. Use when no arch-indep packages will
 be built.

+ 7 - 1
man/dpkg-source.1

@@ -1,5 +1,5 @@
 .\" Authors: Ian Jackson
-.TH dpkg\-source 1 "2006-05-23" "Debian Project" "dpkg utilities"
+.TH dpkg\-source 1 "2007-02-28" "Debian Project" "dpkg utilities"
 .SH NAME
 dpkg\-source, dpkg\-gencontrol, dpkg\-shlibdeps, dpkg\-genchanges,
 dpkg\-buildpackage, dpkg\-distaddfile, dpkg\-parsechangelog
@@ -104,6 +104,12 @@ Display the particular program's version, including copyright and license
 information.
 This option is understood by all the source package tools.
 .TP
+.BI \-\-admindir= dir
+In
+.BR dpkg\-buildpackage " and " dpkg\-shlibdeps
+change the location of the \fBdpkg\fR database. The default location is
+\fI/var/lib/dpkg\fP.
+.TP
 .BI \-v version
 In
 .BR dpkg\-buildpackage ", " dpkg\-genchanges " and " dpkg\-parsechangelog

+ 10 - 1
scripts/dpkg-buildpackage.sh

@@ -51,6 +51,8 @@ Options:
   -E             when -W is turned on, -E turned it off.  } dpkg-source
   -i[<regex>]    ignore diffs of files matching regex.    } only passed
   -I<filename>   filter out files when building tarballs. } to dpkg-source
+  --admindir=<directory>
+                 change the administrative directory.
   -h, --help     show this help message.
       --version  show the version.
 END
@@ -80,15 +82,18 @@ noclean=false
 usepause=false
 warnable_error=0
 passopts=''
+admindir=''
 
 while [ $# != 0 ]
 do
-	value="`echo x\"$1\" | sed -e 's/^x-.//'`"
+	value="`echo x\"$1\" | sed -e 's/x--.*=//;s/^x-.//'`"
 	case "$1" in
 	-h|--help)
 		usage; exit 0 ;;
 	--version)
 		showversion; exit 0 ;;
+	--admindir=*)
+		admindir="$value" ;;
 	-r*)	rootcommand="$value" ;;
 	-p*)	signcommand="$value" ;;
 	-k*)	signkey="$value" ;;
@@ -197,6 +202,10 @@ withecho () {
 }
 
 if [ "$checkbuilddep" = "true" ]; then
+	if [ -n "$admindir" ]; then
+		checkbuilddep_args="$checkbuilddep_args --admindir=$admindir"
+	fi
+
 	if ! dpkg-checkbuilddeps $checkbuilddep_args; then
 		echo >&2 "$progname: Build dependencies/conflicts unsatisfied; aborting."
 		echo >&2 "$progname: (Use -d flag to override.)"

+ 7 - 3
scripts/dpkg-checkbuilddeps.pl

@@ -5,6 +5,7 @@
 use Getopt::Long;
 
 my $dpkglibdir="/usr/lib/dpkg";
+my $admindir = "/var/lib/dpkg";
 push(@INC,$dpkglibdir);
 #my $controlfile;
 require 'controllib.pl';
@@ -19,6 +20,8 @@ sub usage {
 Options:
   control-file   control file to process (default: debian/control).
   -B             binary-only, ignore -Indep.
+  --admindir=<directory>
+                 change the administrative directory.
   -h             show this help message.
 "), $progname;
 }
@@ -26,7 +29,8 @@ Options:
 my $binary_only=0;
 my $want_help=0;
 if (! GetOptions('-B' => \$binary_only,
-		 '-h' => \$want_help)) {
+		 '-h' => \$want_help,
+		 '--admindir=s' => \$admindir)) {
 	usage();
 	exit(2);
 }
@@ -40,7 +44,7 @@ $controlfile=$control;
 
 parsecontrolfile($controlfile);
 
-my @status=parse_status();
+my @status = parse_status("$admindir/status");
 my (@unmet, @conflicts);
 local $/='';
 
@@ -80,7 +84,7 @@ exit 1 if @unmet || @conflicts;
 # thanks to Matt Zimmerman. Returns two hash references that
 # are exactly what the other functions need...
 sub parse_status {
-	my $status=shift || "/var/lib/dpkg/status";
+	my $status = shift;
 	
 	my %providers;
 	my %version;

+ 10 - 1
scripts/dpkg-shlibdeps.pl

@@ -4,6 +4,7 @@
 # $Id$
 
 my $dpkglibdir="/usr/lib/dpkg";
+my $admindir = "/var/lib/dpkg";
 my $version="1.4.1.19"; # This line modified by Makefile
 
 use English;
@@ -12,7 +13,7 @@ use POSIX qw(:errno_h :signal_h);
 my $shlibsoverride= '/etc/dpkg/shlibs.override';
 my $shlibsdefault= '/etc/dpkg/shlibs.default';
 my $shlibslocal= 'debian/shlibs.local';
-my $shlibsppdir= '/var/lib/dpkg/info';
+my $shlibsppdir;
 my $shlibsppext= '.shlibs';
 my $varnameprefix= 'shlibs';
 my $dependencyfield= 'Depends';
@@ -61,6 +62,7 @@ Options:
   -L<localshlibsfile>      shlibs override file, not debian/shlibs.local.
   -T<varlistfile>          update variables here, not debian/substvars.
   -t<type>                 set package type (default is deb).
+  --admindir=<directory>   change the administrative directory.
   -h, --help               show this help message.
       --version            show the version.
 
@@ -83,6 +85,11 @@ foreach (@ARGV) {
 	usage; exit(0);
     } elsif (m/^--version$/) {
 	version; exit(0);
+    } elsif (m/^--admindir=/) {
+	$admindir = $POSTMATCH;
+	-d $admindir ||
+	    error(sprintf(_g("administrative directory '%s' does not exist"),
+			     $admindir));
     } elsif (m/^-d/) {
 	$dependencyfield= capit($POSTMATCH);
 	defined($depstrength{$dependencyfield}) ||
@@ -98,6 +105,8 @@ foreach (@ARGV) {
     }
 }
 
+$shlibsppdir = "$admindir/info";
+
 @exec || usageerr(_g("need at least one executable"));
 
 sub isbin {