]> git.donarmstrong.com Git - debhelper.git/commitdiff
r108: Initial Import
authorjoey <joey>
Tue, 17 Aug 1999 04:56:47 +0000 (04:56 +0000)
committerjoey <joey>
Tue, 17 Aug 1999 04:56:47 +0000 (04:56 +0000)
debian/changelog
debian/rules
dh_getopt.pl
dh_installdocs
dh_installdocs.1
dh_lib
doc/TODO

index 63e04237bbcbbf759ab42d0d3aeb7e7040ab533a..9d4a6a4ec9efc0b921c31dd43d2f0682b01522a2 100644 (file)
@@ -1,3 +1,13 @@
+debhelper (1.1.2) unstable; urgency=low
+
+  * dh_strip: added -X to specify files to not strip (#25590).
+  * Added dh_installemacsen, for automatic registration with emacsen-common
+    (#21401).
+  * Preliminary thoughts in TODO about converting entire debhelper programs
+    to perl programs.
+
+ -- Joey Hess <joeyh@master.debian.org>  Mon, 10 Aug 1998 13:35:17 -0700
+
 debhelper (1.1.1) unstable; urgency=low
 
   * dh_movefiles: try to move all files specified, and only then bomb out if
index b2ea0bd0abbc7d0ab69208364e74d94054a37d00..8572498bcb1b106e3e0f748e5aeb98cc47c64f29 100755 (executable)
@@ -16,11 +16,6 @@ export DH_VERBOSE=1
 test_files=dh_lib
 
 build:
-       # Important symlinks.
-       cd autoscripts && ln -sf postinst-menu postrm-menu
-       cd debian && ln -sf ../dh_lib dh_lib
-       cd debian && ln -sf ../dh_getopt.pl dh_getopt.pl
-
        ./dh_testdir $(test_files)
        sed "s/#DEBHELPER_VERSION#/$(VERSION)/" < dh_testversion.in \
                > dh_testversion
@@ -44,7 +39,7 @@ binary-indep: build
 
        find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
                -exec install -p {} debian/tmp/usr/bin \;
-       cp -a dh_lib dh_getopt.pl debian/tmp/usr/lib/debhelper
+       cp -a dh_lib dh_getopt.pl *.pm debian/tmp/usr/lib/debhelper
        cp -a autoscripts debian/tmp/usr/lib/debhelper
 
        ./dh_installdocs doc/TODO doc/README doc/PROGRAMMING doc/from-debstd
index 9b97089ed9162437dc5bb39ca3403927ba35a5b5..4abe91605097641f61c538dc5e0b85d9d6281dbf 100755 (executable)
 #
 # Because the getopt() program is so horribly broken, I wrote my own argument
 # processer that uses the find Getopt::Long module. This is used by all
-# debhelper scripts.
+# debhelper shell scripts.
 #
 # Joey Hess, GPL copyright 1998.
 
-# Returns a list of packages in the control file.
-# Must pass "arch" or "indep" to specify arch-dependant or -independant
-# packages.
-sub GetPackages { $type=shift;
-       my $package;
-       my $arch;
-       my @list;
-       open (CONTROL,"<debian/control") || 
-               ( $parse_error="cannot read debian/control: $!\n" );
-       while (<CONTROL>) {
-               chomp;
-               s/\s+$//;
-               if (/^Package:\s+(.*)/) {
-                       $package=$1;
-               }
-               if (/^Architecture:\s+(.*)/) {
-                       $arch=$1;
-               }
-               if (!$_ or eof) { # end of stanza.
-                       if ($package &&
-                           (($type eq 'indep' && $arch eq 'all') ||
-                                  ($type eq 'arch' && $arch ne 'all'))) {
-                               push @list, $package;
-                               undef $package, $arch;
-                       }
-               }
-       }
-       close CONTROL;
-
-       return @list;
-}
-
-# Passed an option name and an option value, adds packages to the list
-# of packages. We need this so the list will be built up in the right
-# order.
-sub AddPackage { my($option,$value)=@_;
-       if ($option eq 'i' or $option eq 'indep') {
-               push @packages, GetPackages('indep');
-               $indep=1;
-       }
-       elsif ($option eq 'a' or $option eq 'arch') {
-               push @packages, GetPackages('arch');
-               $arch=1;
-       }
-       elsif ($option eq 'p' or $option eq 'package') {
-               push @packages, $value;
-       }
-       else {
-               $parse_error="bad option $option - should never happen!\n";
-       }
-}
-
-# Add a package to a list of packages that should not be acted on.
-sub ExcludePackage { my($option,$value)=@_;
-       $exclude_package{$value}=1;
-}
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Getopt;
 
-# Add another item to the exclude list.
-sub AddExclude { my($option,$value)=@_;
-       push @exclude,$value;
+# This is a tricky (and nasty) bit: override the error() function, which
+# comes from Dh_Lib, with one of our own so we print out the list of errors
+# to the shell, which can do what it wants with them.
+sub Dh_Getopt::error { my $message=shift;
+       print "DH_PARSE_ERROR='$message'\n";
+       exit 1;
 }
 
-use Getopt::Long;
-
-# Enable bundling of short command line options.
-Getopt::Long::config("bundling");
-
 # Parse options.
-$ret=GetOptions(
-       "v" => \$verbose,
-       "verbose" => \$verbose,
-
-       "i" => \&AddPackage,
-       "indep" => \&AddPackage,
-
-       "a" => \&AddPackage,
-       "arch" => \&AddPackage,
-
-       "p=s" => \&AddPackage,
-        "package=s" => \&AddPackage,
-
-       "N=s" => \&ExcludePackage,
-       "no-package=s" => \&ExcludePackage,
-
-       "n" => \$noscripts,
-       "noscripts" => \$noscripts,
-
-       "x" => \$include, # is -x for some unknown historical reason..
-       "include-conffiles" => \$include,
-
-       "X=s" => \&AddExclude,
-       "exclude=s" => \&AddExclude,
-
-       "d" => \$d_flag,
-       "remove-d" => \$d_flag,
-
-       "r" => \$r_flag,
-       "no-restart-on-upgrade" => \$r_flag,
-
-       "k" => \$k_flag,
-       "keep" => \$k_flag,
-
-       "P=s" => \$tmpdir,
-       "tmpdir=s" => \$tmpdir,
-
-       "u=s", => \$u_params,
-       "update-rcd-params=s", => \$u_params,
-        "dpkg-shlibdeps-params=s", => \$u_params,
-
-       "m=s", => \$major,
-       "major=s" => \$major,
-
-       "V:s", => \$version_info,
-       "version-info:s" => \$version_info,
-
-       "A" => \$all,
-       "all" => \$all,
-
-       "no-act" => \$no_act,
-
-       "init-script=s" => \$init_script,
-);
-
-if (!$ret) {
-       $parse_error="exiting with unknown option.";
-}
-
-# Check to see if -V was specified. If so, but no parameters were passed,
-# the variable will be defined but empty.
-if (defined($version_info)) {
-       $version_info_set=1;
-}
-
-# Check to see if DH_VERBOSE environment variable was set, if so, make sure
-# verbose is on.
-if ($ENV{DH_VERBOSE} ne undef) {
-       $verbose=1;
-}
-
-# Check to see if DH_NO_ACT was set, if so, make sure no act mode is on.
-if ($ENV{DH_NO_ACT} ne undef) {
-       $no_act=1;
-}
-
-$exclude=join ' ', @exclude;
-$exclude_grep=join '|', @exclude;
-foreach (@exclude) {
-       $exclude_find.="-regex .*".quotemeta($_).".* -or ";
-}
-$exclude_find=~s/ -or $//;
-
-$include=join ' ', @include;
-
-# Remove excluded packages from the list of packages to act on.
-undef @package_list;
-foreach $package (@packages) {
-       if (! $exclude_package{$package}) {
-               push @package_list, $package;   
+%options=Dh_Getopt::parseopts();
+
+# Change a few lists in %options into strings,
+# generate some options that only need to be visible to the
+# shell scripts so Dh_Getopt doesn't bother generating.
+$options{DOPACKAGES}=join " ",@{$options{DOPACKAGES}};
+if ($#{$options{EXCLUDE}} > -1) {
+       $options{EXCLUDE_GREP}=join '|', @{$options{EXCLUDE}};
+       foreach (@{$options{EXCLUDE}}) {
+               $options{EXCLUDE_FIND}.="-regex .*".quotemeta($_).".* -or ";
        }
+       $options{EXCLUDE_FIND}=~s/ -or $//;
 }
+$options{EXCLUDE}=join " ",@{$options{EXCLUDE}};
+
+# Now output everything, in a format suitable for a shell to eval it.
+foreach (keys(%options)) { print "DH_$_='$options{$_}'\n" };
 
-# Now output everything, in a format suitable for a shell to eval it. 
-# Note the last line sets $@ in the shell to whatever arguements remain.
-print qq{
-DH_VERBOSE='$verbose'
-DH_NO_ACT='$no_act'
-DH_DOPACKAGES='@package_list'
-DH_DOINDEP='$indep'
-DH_DOARCH='$arch'
-DH_NOSCRIPTS='$noscripts'
-DH_INCLUDE_CONFFILES='$include'
-DH_EXCLUDE='$exclude'
-DH_EXCLUDE_GREP='$exclude_grep'
-DH_EXCLUDE_FIND='$exclude_find'
-DH_D_FLAG='$d_flag'
-DH_R_FLAG='$r_flag'
-DH_K_FLAG='$k_flag'
-DH_TMPDIR='$tmpdir'
-DH_U_PARAMS='$u_params'
-DH_M_PARAMS='$major'
-DH_V_FLAG='$version_info'
-DH_V_FLAG_SET='$version_info_set'
-DH_PARAMS_ALL='$all'
-DH_INIT_SCRIPT='$init_script'
-DH_PARSE_ERROR='$parse_error'
-set -- @ARGV
-};
+# This sets $@ in the shell to whatever arguements remain.
+print "set -- @ARGV\n"
index fcdedc500fed9cd119d6d1adb7eeaebfd4a0af16..f466243130f4c6987f352482c3345c553824d55d 100755 (executable)
@@ -1,60 +1,61 @@
-#!/bin/sh -e
+#!/usr/bin/perl
 #
 # Reads debian/docs, installs all files listed there into /usr/doc/$PACKAGE
 # Also installs the debian/copyright and debian/README.debian and debian/TODO
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
-
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       file=`pkgfile $PACKAGE docs`
-
-       if [ ! -d $TMP/usr/doc/$PACKAGE ]; then
-               doit "install -d $TMP/usr/doc/$PACKAGE"
-       fi
-
-       docs=""
-
-       if [ "$file" ]; then
-               docs=`tr "\n" " " < $file`
-       fi
-
-       if [ \( "$PACKAGE" = "$DH_FIRSTPACKAGE" -o "$DH_PARAMS_ALL" \) \
-            -a "$*" ]; then
-               docs="$* $docs"
-       fi
-
-       if [ "$docs" ]; then
-               doit "cp -a $docs $TMP/usr/doc/$PACKAGE/"
-       fi
-
-       # .Debian is correct, according to policy.
-       readme_debian=`pkgfile $PACKAGE README.Debian`
-       if [ -z "$readme_debian" ]; then
-               readme_debian=`pkgfile $PACKAGE README.debian`
-       fi
-       if [ "$readme_debian" ]; then
-               doit "install -m 644 -p $readme_debian $TMP/usr/doc/$PACKAGE/README.Debian"
-       fi
-
-       todo=`pkgfile $PACKAGE TODO`
-       if [ "$todo" ]; then
-               if isnative; then
-                       doit "install -m 655 -p $todo $TMP/usr/doc/$PACKAGE/TODO"
-               else
-                       doit "install -m 644 -p $todo $TMP/usr/doc/$PACKAGE/TODO.Debian"
-               fi
-       fi
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
+
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $file=pkgfile($PACKAGE,"docs");
+
+       if ( ! -d "$TMP/usr/doc/$PACKAGE") {
+               doit("install","-d","$TMP/usr/doc/$PACKAGE");
+       }
+
+       undef @docs;
+
+       if ($file) {
+               @docs=filearray($file);
+       }
+
+       if (($PACKAGE = $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @docs, @ARGV;
+       }
+
+       if (@docs) {
+               doit("cp","-a",@docs,"$TMP/usr/doc/$PACKAGE/");
+       }
+
+       # .Debian is correct, according to policy, but I'm easy.
+       $readme_debian=pkgfile($PACKAGE,'README.Debian');
+       if (! $readme_debian) {
+               $readme_debian=pkgfile($PACKAGE,'README.debian');
+       }
+       if ($readme_debian) {
+               doit("install","-m","644","-p","$readme_debian","$TMP/usr/doc/$PACKAGE/README.Debian");
+       }
+
+       $todo=pkgfile($PACKAGE,'TODO');
+       if ($todo) {
+               if (isnative()) {
+                       doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO");
+               }
+               else {
+                       doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO.Debian");
+               }
+       }
 
        # Support debian/package.copyright, but if not present, fall back
        # on debian/copyright for all packages, not just the main binary
        # package.
-       copyright=`pkgfile $PACKAGE copyright`
-       if [ ! "$copyright" -a -e debian/copyright ]; then
-               copyright=debian/copyright
-       fi
-       if [ "$copyright" ]; then
-                       doit "install -m 644 -p $copyright $TMP/usr/doc/$PACKAGE/copyright"
-       fi
-done
+       $copyright=pkgfile($PACKAGE,'copyright');
+       if (! $copyright && -e "debian/copyright") {
+               $copyright="debian/copyright";
+       }
+       if ($copyright) {
+                       doit("install","-m","644","-p",$copyright,"$TMP/usr/doc/$PACKAGE/copyright");
+       }
+}
index ffae16236011c69bd00d1b62c8746c79ef82fcb6..72f80ecd0b34586346d64290aab05f2da1564f7b 100644 (file)
@@ -54,7 +54,8 @@ for a list of environment variables that affect all debhelper commands.
 .SH "SEE ALSO"
 .BR debhelper (1)
 .SH BUGS
-Filenames with spaces in them will not currently be installed.
+It's impossible to specify filenames with spaces or other whitespace in them
+in debian/docs file. This is more a historical design flaw than a bug.
 .SH "CONFORMS TO"
 Debian policy, version 2.3.0.0
 .SH AUTHOR
diff --git a/dh_lib b/dh_lib
index 7ebc8be179e5406c1caaacfeb4066ffd9287f819..41812b8f98b8cd54d384df56602f6ce0f470f7f5 100644 (file)
--- a/dh_lib
+++ b/dh_lib
@@ -134,42 +134,6 @@ autoscript() {
        complex_doit "echo '# End automatically added section' >> $autoscript_debscript"
 }
 
-# Sets 2 global variables, INDEP_PACKAGES is all the arch-independant
-# packages, ARCH_PACKAGES is the arch-dependant packages.
-get_arch_indep_packages() {
-       INDEP_PACKAGES=""
-       ARCH_PACKAGES=""
-       
-       # First, get the list of all binary packages.
-        # Notice we want the list in reverse order, thus the tac.
-       PACKAGES=`grep ^Package: debian/control | cut -d " " -f 2 | tac | tr "\n" " "`
-       # Remove trailing space.
-       PACKAGES=`expr "$PACKAGES" : '\(.*\) '`
-       # Loop on the list of architectures.
-       for ARCH in `grep ^Architecture: debian/control | cut -d " " -f 2` ; do
-               # Pull the last package off the list.
-               THISPKG=`expr "$PACKAGES" : '.* \(.*\)'` || true
-               if [ ! "$THISPKG" ]; then
-                       THISPKG=$PACKAGES
-               fi
-               PACKAGES=`expr "$PACKAGES" : '\(.*\) .*'` || true
-       
-               if [ ! "$THISPKG" ]; then
-                       error "debian/control invalid - too many Architecture lines or too few Package lines"
-               fi
-
-               if [ "$ARCH" = "all" ]; then
-                       INDEP_PACKAGES="$INDEP_PACKAGES $THISPKG"
-               else
-                       ARCH_PACKAGES="$ARCH_PACKAGES $THISPKG"
-               fi
-       done
-
-       if [ "$PACKAGES" ]; then
-               error "debian/control invalid - too many Architecure lines or too few Package lines"
-       fi
-}
-
 # Argument processing and global variable initialization is below.
 
 # Check to see if an argument on the command line starts with a dash.
index 83f38659445349769680ac0480f6c479cd2e782f..e3042fbcce9cf268aacae7ba59b0284c71fc481e 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -11,6 +11,7 @@ Bugs:
 
 Wishlist items:
 
+* update PROGRAMMING to cover new perl interface.
 * Make dh_movefiles remove emptied directories after it's moved all the
   files out of them (#17111).
 * info support for debhelper (currently implemented, but I hate how I did it,
@@ -61,19 +62,9 @@ Depricated:
 
 Long term goals:
 
-Convert selected and then selected debhelper commands (dh_installmanpages?)
-to be perl programs, for speed, ease of maintainence, and 8-bit cleanness.
-Tricky, because of the -v option -- they'd have to call external commands
-like install and cp, and log such calls if verbose was on. Maybe something
-like:
+Convert selected debhelper commands (dh_installmanpages?) to be perl
+programs, for speed, ease of maintainence, and 8-bit cleanness.
 
-doit {
-       system @_;
-       if ($DH_VERBOSE) {
-               print join " ", @_;
-       }
-}
+Fixes to backport to 1.0 tree:
 
-However, this will output commands that are incorrect if the filenames in
-them contain spaces or other weird characters. Hmm, maybe such things should
-just be escaped with \'s in the output?
+* dh_installdocs used -m 655 for a TODO file.