ソースを参照

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

Guillem Jover 19 年 前
親
コミット
b4d9b94ef1
共有8 個のファイルを変更した、60 個の追加 と 8 個の削除を含む
  1. 13 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 5 0
      man/ChangeLog
  4. 6 2
      man/dpkg-checkbuilddeps.1
  5. 7 1
      man/dpkg-source.1
  6. 10 1
      scripts/dpkg-buildpackage.sh
  7. 7 3
      scripts/dpkg-checkbuilddeps.pl
  8. 10 1
      scripts/dpkg-shlibdeps.pl

+ 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>
 2007-02-28  Guillem Jover  <guillem@debian.org>
 
 
 	* scripts/update-alternatives.pl (usage): Use '$altdir' instead of
 	* 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
   * Fix regular expression special-casing Origin, Bugs and Maintainer fields
     which was making X[SBC]- fields containing such strings to propagate into
     which was making X[SBC]- fields containing such strings to propagate into
     the .deb control file unprocessed. Thanks to Colin Watson.
     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 ]
   [ Updated dpkg translations ]
   * Romanian (Eddy Petrișor).
   * 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>
 2007-01-24  Frank Lichtenheld  <djpig@debian.org>
 
 
 	* 822-date.1: 822-date is now deprecated. Document this fact in
 	* 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
 .SH NAME
 dpkg\-checkbuilddeps - check build dependencies and conflicts
 dpkg\-checkbuilddeps - check build dependencies and conflicts
 .
 .
 .SH SYNOPSIS
 .SH SYNOPSIS
-\fBdpkg\-checkbuilddeps\fR \fB\-B\fR [\fIcontrol-file\fR]
+\fBdpkg\-checkbuilddeps\fR [\fIoptions\fR] [\fIcontrol-file\fR]
 .
 .
 .SH DESCRIPTION
 .SH DESCRIPTION
 This program checks the installed packages in the system against the build
 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
 .SH OPTIONS
 .TP
 .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
 .B \-B
 Ignore \fIBuild\-Depends\-Indep\fR lines. Use when no arch-indep packages will
 Ignore \fIBuild\-Depends\-Indep\fR lines. Use when no arch-indep packages will
 be built.
 be built.

+ 7 - 1
man/dpkg-source.1

@@ -1,5 +1,5 @@
 .\" Authors: Ian Jackson
 .\" 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
 .SH NAME
 dpkg\-source, dpkg\-gencontrol, dpkg\-shlibdeps, dpkg\-genchanges,
 dpkg\-source, dpkg\-gencontrol, dpkg\-shlibdeps, dpkg\-genchanges,
 dpkg\-buildpackage, dpkg\-distaddfile, dpkg\-parsechangelog
 dpkg\-buildpackage, dpkg\-distaddfile, dpkg\-parsechangelog
@@ -104,6 +104,12 @@ Display the particular program's version, including copyright and license
 information.
 information.
 This option is understood by all the source package tools.
 This option is understood by all the source package tools.
 .TP
 .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
 .BI \-v version
 In
 In
 .BR dpkg\-buildpackage ", " dpkg\-genchanges " and " dpkg\-parsechangelog
 .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
   -E             when -W is turned on, -E turned it off.  } dpkg-source
   -i[<regex>]    ignore diffs of files matching regex.    } only passed
   -i[<regex>]    ignore diffs of files matching regex.    } only passed
   -I<filename>   filter out files when building tarballs. } to dpkg-source
   -I<filename>   filter out files when building tarballs. } to dpkg-source
+  --admindir=<directory>
+                 change the administrative directory.
   -h, --help     show this help message.
   -h, --help     show this help message.
       --version  show the version.
       --version  show the version.
 END
 END
@@ -80,15 +82,18 @@ noclean=false
 usepause=false
 usepause=false
 warnable_error=0
 warnable_error=0
 passopts=''
 passopts=''
+admindir=''
 
 
 while [ $# != 0 ]
 while [ $# != 0 ]
 do
 do
-	value="`echo x\"$1\" | sed -e 's/^x-.//'`"
+	value="`echo x\"$1\" | sed -e 's/x--.*=//;s/^x-.//'`"
 	case "$1" in
 	case "$1" in
 	-h|--help)
 	-h|--help)
 		usage; exit 0 ;;
 		usage; exit 0 ;;
 	--version)
 	--version)
 		showversion; exit 0 ;;
 		showversion; exit 0 ;;
+	--admindir=*)
+		admindir="$value" ;;
 	-r*)	rootcommand="$value" ;;
 	-r*)	rootcommand="$value" ;;
 	-p*)	signcommand="$value" ;;
 	-p*)	signcommand="$value" ;;
 	-k*)	signkey="$value" ;;
 	-k*)	signkey="$value" ;;
@@ -197,6 +202,10 @@ withecho () {
 }
 }
 
 
 if [ "$checkbuilddep" = "true" ]; then
 if [ "$checkbuilddep" = "true" ]; then
+	if [ -n "$admindir" ]; then
+		checkbuilddep_args="$checkbuilddep_args --admindir=$admindir"
+	fi
+
 	if ! dpkg-checkbuilddeps $checkbuilddep_args; then
 	if ! dpkg-checkbuilddeps $checkbuilddep_args; then
 		echo >&2 "$progname: Build dependencies/conflicts unsatisfied; aborting."
 		echo >&2 "$progname: Build dependencies/conflicts unsatisfied; aborting."
 		echo >&2 "$progname: (Use -d flag to override.)"
 		echo >&2 "$progname: (Use -d flag to override.)"

+ 7 - 3
scripts/dpkg-checkbuilddeps.pl

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

+ 10 - 1
scripts/dpkg-shlibdeps.pl

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