]> git.donarmstrong.com Git - debhelper.git/commitdiff
r139: Initial Import
authorjoey <joey>
Tue, 17 Aug 1999 05:03:50 +0000 (05:03 +0000)
committerjoey <joey>
Tue, 17 Aug 1999 05:03:50 +0000 (05:03 +0000)
debian/changelog
debian/rules
dh_compress
dh_debstd
doc/PROGRAMMING
doc/README
doc/TODO

index 2c4e79a31a226058ba492014b765dcce8cdbb040..32baae863d1f4e71565e58e4b77dc24618379d93 100644 (file)
@@ -1,3 +1,16 @@
+debhelper (1.2.5) unstable; urgency=low
+
+  * The perl conversion is complete.
+  .
+  * dh_compress: perlized (yay, perl has readlink, no more ls -l | awk 
+    garbage!)
+  * dh_lib, dh_getopt.pl: deleted, nothing uses them anymore.
+  * debian/rules: don't install above 2 files.
+  * doc/PROGRAMMING: removed all documentation of the old shell library
+    interface.
+
+ -- Joey Hess <joeyh@master.debian.org>  Fri, 13 Nov 1998 15:36:57 -0800
+
 debhelper (1.2.4) unstable; urgency=low
 
   * dh_debstd, dh_movefiles: perlized.
index bb790cd38f5c7f80ac63e648800f18b54e003ace..482759799fa5df96c20d1eb3801f599b31c7fbcc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 # Note that I have to refer to debhelper programs with ./, to make sure
 # I run the most current ones. That's also why there is a symlink to the 
-# current dh_lib and the current dh_getopt.pl in this debian/ directory.
+# current Dh_lib.pm and the current Dh_getopt.pm in this debian/ directory.
 
 # If any automatic script generation is done in building this package, 
 # be sure to use the new templates from this package.
@@ -34,7 +34,7 @@ binary-indep: build
        echo -e "package Dh_Version;\n\$$version='$(VERSION)';" > debian/tmp/usr/lib/debhelper/Dh_Version.pm
        find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
                -exec install -p {} debian/tmp/usr/bin \;
-       cp -a dh_lib dh_getopt.pl *.pm debian/tmp/usr/lib/debhelper
+       cp -a *.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 76f7614d31105d2d60e20db9b58cec725ec6ad63..0cc79c785669aa05d060ce5ed239e27878fc369b 100755 (executable)
@@ -1,82 +1,74 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Compresses files and makes sure that symlinks pointing to the 
 # compressed files get fixed.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Cwd;
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
 
-# Returns a list of all the files that we want to compress,
-# (ignoring any files we were asked to exclude on the command
-# line). Assumes we are already in the temp directory.
-filelist () {
-       # First of all, deal with any files specified right on the command line.
-        if [ \( "$PACKAGE" = "$DH_FIRSTPACKAGE" -o "$DH_PARAMS_ALL" \) \
-             -a "$*" ]; then
-               # Convert to having each file on its own line
-               # so grep will work.
-               echo "$*" | tr " " "\n"
-       fi
-
-       if [ "$compress" ]; then
-               # The config file is a sh script that outputs the files to be compressed
-               # (typically using find).
-               sh $olddir/$compress 2>/dev/null || true
-       else
-               # By default fall back on what the policy manual says to compress.
-               find usr/info usr/man usr/X11*/man -type f ! -name "*.gz" 2>/dev/null || true
-               find usr/doc -type f \( -size +4k -or -name "changelog*" \) \
-                       ! -name "*.htm*" ! -name "*.gif" ! -name "*.gz" \
-                       ! -name "copyright" 2>/dev/null || true
-       fi
-}
-
-# Returns a list of all the files we want to compress,
-# after taking command line exclusions into account.
-# Call only if DH_EXCLUDE_GREP is non-empty.
-filelist_excluded () {
-       # Use grep -F so we don't have to worry about regexp's.
-       (filelist "$*" | grep -v -F \
-               "`echo "$DH_EXCLUDE_GREP" | tr "|" "\n"`") || true
-}
-
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       compress=`pkgfile $PACKAGE compress`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $compress=pkgfile($PACKAGE,"compress");
 
        # Run the file name gathering commands from within the directory
        # structure that will be effected.
-       olddir=`pwd`
-       # Can't use doit here, that breaks --no-act mode.
-       verbose_echo "cd $TMP"
-       cd "$TMP"
+       $olddir=getcwd();
+       chdir($TMP) || error("Can't cd to $TMP: $!");
+
+       # Figure out what files to compress.
+       @files=();
+       # First of all, deal with any files specified right on the command line.
+       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @files,#ARGV;
+       }
+       if ($compress) {
+               # The config file is a sh script that outputs the files to be compressed
+               # (typically using find).
+               push @files, split(/\n/,`sh $olddir/$compress 2>/dev/null`);
+       }
+       else {
+               # By default, fall back to what the policy manual says to compress.
+               push @files, split(/\n/,`
+                       find usr/info usr/man usr/X11*/man -type f ! -name "*.gz" 2>/dev/null || true;
+                       find usr/doc -type f \\( -size +4k -or -name "changelog*" \\) \\
+                               ! -name "*.htm*" ! -name "*.gif" ! -name "*.gz" \\
+                               ! -name "copyright" 2>/dev/null || true
+               `);
+       }
 
-       # Get the list of files to compress.
-       if [ "$DH_EXCLUDE_GREP" ]; then
-               files=`filelist_excluded $*`
-       else
-               files=`filelist $*`
-       fi
+       # Exclude files from compression.
+       if (@files && defined($dh{EXCLUDE}) && $dh{EXCLUDE}) {
+               @new=();
+               foreach (@files) {
+                       $ok=1;
+                       foreach $x (@{$dh{EXCLUDE}}) {
+                               if (/\Q$x\E/) {
+                                       $ok='';
+                                       last;
+                               }
+                       }
+                       push @new,$_ if $ok;
+               }
+               @files=@new;
+       }
 
-       if [ "$files" ]; then
-               # This is just a cosmetic fix.
-               files=`echo $files | tr "\n" " "`
-       
-               doit "gzip -f9 $files" || true
-       fi
+       if (@files) {
+               doit("gzip","-9f",@files);
+       }
 
-       # Change back to old pwd.
-       verbose_echo "cd $olddir"
-       cd "$olddir"
+       chdir($olddir);
 
        # Fix up symlinks that were pointing to the uncompressed files.
-       for file in `find $TMP -type l`; do
-               DIRECTORY=`expr $file : "\(.*\)/[^/]*"`
-               NAME=`expr $file : ".*/\([^/]*\)"`
-               LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'`
-               if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then
-                       doit "rm $DIRECTORY/$NAME"
-                       doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz"
-               fi
-       done
-done
+       open (FIND,"find $TMP -type l |");
+       while (<FIND>) {
+               chomp;
+               ($directory)=m:(.*)/:;
+               $linkval=readlink($_);
+               if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") {
+                       doit("rm","-f",$_);
+                       doit("ln","-sf","$linkval.gz","$_.gz");
+               }
+       }
+}
index e9e7b3cae7f6f987e1ff29b59b13599f44cf8319..2a557ec981cec0ecc8b0512146d75f0412348d39 100755 (executable)
--- a/dh_debstd
+++ b/dh_debstd
@@ -10,7 +10,7 @@
 # This has been gutted and extensively rewritten to function as a debhelper
 # command by Joey Hess. And then completly rewritten in perl.
 
-# Pre-parse command line before we load dh_lib, becuase we use a
+# Pre-parse command line before we load Dh_lib, becuase we use a
 # different style of arguments.
 @argv=();
 foreach (@ARGV) {
index 67d25d005508b55315a1aeaa44d3a43a0b10598c..da21ea9da76795cd4061fb77cdb893a1a0f15049 100644 (file)
@@ -36,27 +36,20 @@ merge these modifications into the actual postinst scripts.
 
 There are always exceptions. Just ask me.
 
-Introducing dh_lib and Dh_Lib.pm:
---------------------------------
+Introducing Dh_Lib.pm:
+---------------------
 
-dh_lib/Dh_lib.pm is the library used by all debhelper programs to parse
-their arguments and set some useful variables. It's not mandatory that your
-program use dh_lib/Dh_lib.pm, but it will make it a lot easier to keep it in
-sync with the rest of debhelper if it does, so this is highly encouraged.
-There are two versions of this library - dh_lib is a shell library, while
-Dh_Lib.pm is a perl module.
+Dh_lib.pm is the library used by all debhelper programs to parse their
+arguments and set some useful variables. It's not mandatory that your
+program use Dh_lib.pm, but it will make it a lot easier to keep it in sync
+with the rest of debhelper if it does, so this is highly encouraged.
 
-Typically, you invoke dh_lib like this if your debhelper program is a shell
-script:
+(There used to be a version of Dh_lib.pm that was a library of functions for
+shell scripts. If you want to write a debhelper command that is a shell
+script, I can dig up that old library for you. Only the perl one is
+supported now, though.)
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
-
-The path statement is there to make your program look first in debian/ for
-dh_lib (so users can install a modified version there if necessary), then the
-rest of the path, then the canonical location of dh_lib, /usr/lib/debhelper.
-
-If you are writing a perl program instead, use Dh_lib.pm like this:
+Use Dh_lib.pm like this:
 
 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
 use Dh_Lib;
@@ -65,25 +58,19 @@ init();
 The BEGIN block is there to make perl look for the module in all the right
 places.
 
-Notice the init() function in the perl version. dh_lib automatically parses
-the command line and does some other initialization tasks. Dh_Lib.pm
-requires you to run init() to accomplish the same task.
+The init() function in the perl version. This causes Dh_lib to
+parse the command line and do some other initialization tasks.
 
 Argument processing:
 -------------------
 
 All debhelper programs should respond to certain arguments, such as -v, -i,
--a, and -p. To help you make this work right, dh_lib/Dh_Lib.pm handles 
-argument processing.
-
-As soon as dh_lib loads, it processes any arguments that have been passed to
-your program. On the other hand, you need to call init() in Dh_Lib.pm before
-it will parse arguments.
+-a, and -p. To help you make this work right, Dh_Lib.pm handles argument
+processing. Just call init().
 
 After argument processing, some global variables are used to hold the
-results; program can use them later. If using dh_lib, prefix DH_ to the name
-of each of these variables to get the name of the environment variable that
-is set. If using Dh_lib.pm, these variables are in the %dh hash.
+results; programs can use them later. These variables are elements of the
+%dh hash.
 
 switch         variable        description
 -v             VERBOSE         should the program verbosely output what it is
@@ -99,10 +86,7 @@ switch               variable        description
                                package's postinst, postrm, etc scripts.
 -X             EXCLUDE         exclude a something from processing (you
                                decide what this means for your program)
-                               (In Dh_Lib.pm, this is an array)
-               EXCLUDE_GREP    same as DH_EXCLUDE, except all items are
-                               separated by '|' characters, instead of spaces,
-                               handy for egrep -v (only available to dh_lib)
+                               (This is an array)
                 EXCLUDE_FIND   same as DH_EXCLUDE, except all items are put
                                into a string in a way that they will make
                                find find them. (Use ! in front to negate
@@ -117,7 +101,7 @@ switch              variable        description
                                package is being acted on)
 -u             U_PARAMS        will be set to a string, that is typically
                                parameters your program passes on to some
-                               other program. (In Dh_Lib.pm, this is an array)
+                               other program. (This is an array)
 -m             M_PARAMS        will be set to a string, you decide what it
                                means to your program
 -V             V_FLAG          will be set to a string, you decide what it
@@ -141,38 +125,32 @@ If you need a new command line option, just ask me, and I will add it.
 Global variables:
 ----------------
 
-If using dh_lib, the following variables are also set as soon as you load
-the library:
+The following keys are also set in the %dh hash when you call init():
 
 MAINPACKAGE    the name of the first binary package listed in
                debian/control
-DH_FIRSTPACKAGE        the first package we were instructed to act on. This package
+FIRSTPACKAGE   the first package we were instructed to act on. This package
                typically gets special treatment, additional arguments
                specified on the command line may effect it.
 
-If using Dh_Lib.pm, these are only set after init(), and they are named
-$dh{MAINPACKAGE} and $dh{FIRSTPACKAGE}, instead.
-
 Functions:
 ---------
 
-dh_lib/Dh_Lib.pm also contains a number of functions you may find useful.
-Note that the functions calling conventions are slightly different between
-the two versions of the library.
+Dh_Lib.pm also contains a number of functions you may find useful.
 
 doit()
-       Pass this function a string (dh_lib) or array (Dh_Lib.pm) that is a 
-       shell command. It will run the command (unless DH_NO_ACT is set), and
-       if DH_VERBOSE is set, it will also output the command to stdout. You
+       Pass this function an array that is a 
+       shell command. It will run the command (unless $dh{NO_ACT} is set), and
+       if $dh{VERBOSE} is set, it will also output the command to stdout. You
        should use this function for almost all commands your program performs
        that manipulate files in the package build directories.
 complex_doit()
        Pass this function a string that is a shell command, it will run it
        similarly to how doit() does. You can pass more complicated commands 
-       to this (ie, commands involving piping redirection)
-verbose_echo()   (dh_lib)
-verbose_print()  (Dh_Lib.pm)
-       Pass this command a string, and it will echo it if DH_VERBOSE is set.
+       to this (ie, commands involving piping redirection), however, you 
+       have to worry about things like escaping shell metacharacters.
+verbose_print()
+       Pass this command a string, and it will echo it if $dh{VERBOSE} is set.
 error()
        Pass this command a string, it will output it to standard error and
        exit.
@@ -191,20 +169,20 @@ pkgfile()
        debian/ directory, so there can be one config file per binary
        package. The convention is that the files are named
        debian/package.filename, and debian/filename is also allowable for
-       the MAINPACKAGE. If the file does not exist, nothing is returned.
+       the $dh{MAINPACKAGE}. If the file does not exist, nothing is returned.
 pkgext()
        Pass this command the name of a binary package, and it will return
        the name to prefix to files in debian/ for this package. For the
-       MAINPACKAGE, it returns nothing (there is no prefix), for the other
+       $dh{MAINPACKAGE}, it returns nothing (there is no prefix), for the other
        packages, it returns "package.".
 isnative()
        Pass this command the name of a package, it returns 1 if the package
        is a native debian package.
-       As a side effect, VERSION is set to the version number of the
+       As a side effect, $dh{VERSION} is set to the version number of the
        package.
 autoscript()
        Pass parameters:
-        - package to be affected (Dh_Lib.pm only)
+        - binary package to be affected
         - script to add to
         - filename of snippet
         - sed commands to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/
index 93b1687c6b985bf711622e25f7fc08cbf9a4ba28..d851966796793bd87c544f26411ad6208a39a9ec 100644 (file)
@@ -1,7 +1,7 @@
 Debhelper is a collection of programs that can be used in debian/rules files
 to automate common tasks related to building debian binary packages. For 
 further documentation, see the man pages for dh_* commands. For an overview 
-of debhelper, see the debhelper man page.
+of debhelper, see the debhelper(1) man page.
 
 To help you get started, I've included examples of debian/rules files
 that use debhelper commands extensively. See /usr/doc/debhelper/examples/ . 
index ac5c21270d5170b4e545184bc8c791fc1667968d..9a103358ed5f243efc81297d6ab5aff91b9f35e7 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -60,8 +60,3 @@ Depricated:
          on doing this after slink is released or one year after they were
          depricated, whichever comes first. Be sure to grep whole debian
          archive for alls to them before removing them, though!
-
-Long term goals:
-
-* Convert selected debhelper commands to be perl programs, for speed, ease
-  of maintainence, and 8-bit cleanness.