Re: installperl feature request (was: Re: Upgrade 4.0x to 5.001m)
authorauthor scotth@sgi.com 842220273 +0000 <author scotth@sgi.com 842220273 +0000>
Sun, 8 Sep 1996 22:04:33 +0000 (22:04 +0000)
committerAndy Dougherty <doughera@lafcol.lafayette.edu>
Sun, 8 Sep 1996 22:04:33 +0000 (22:04 +0000)
Fix installperl so that the -n option really only prints commands.
(previously, it would still do the mkdirs.)

an "ignore installed" option, so that it doesn't bother to check
to see if the target already exists (an optimization that I
*don't* want it to do when I do #1 above)

installman
installperl

index 38bd0af..5e0b0cc 100644 (file)
@@ -66,6 +66,7 @@ sub runpod2man {
     }
 
     chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n";
+    print STDERR "chdir $poddir\n";
 
     # We insist on using the current version of pod2man in case there
     # are enhancements or changes from previous installed versions.
@@ -80,7 +81,7 @@ sub runpod2man {
     # installed by occult means.)
     $pod2man = "../perl -I ../lib ../pod/pod2man --section=$manext --official";
 
-    mkpath($mandir, 1, 0777);  # In File::Path
+    mkpath($mandir, 1, 0777) unless $notify;  # In File::Path
     # Make a list of all the .pm and .pod files in the directory.  We will
     # always run pod2man from the lib directory and feed it the full pathname
     # of the pod.  This might be useful for pod2man someday.
@@ -111,6 +112,7 @@ sub runpod2man {
        }
     }
     chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
+    print STDERR "chdir $builddir\n";
 }
 
 sub lsmodpods {
index 5632824..346e835 100755 (executable)
@@ -1,10 +1,16 @@
 #!./perl
 BEGIN { @INC=('./lib', '../lib') }
 use File::Find;
-use File::Path qw(mkpath);
+use File::Path ();
 use Config;
 use subs qw(unlink rename link chmod);
 
+# override the ones in the rest of the script
+sub mkpath
+{
+  File::Path::mkpath(@_) unless $nonono;
+}
+
 $mainperldir = "/usr/bin";
 $exe_ext = $Config{exe_ext};
 
@@ -57,8 +63,8 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
 
    $installbin         || die "No installbin directory in config.sh\n";
 -d $installbin         || mkpath($installbin, 1, 0777);
--d $installbin         || die "$installbin is not a directory\n";
--w $installbin         || die "$installbin is not writable by you\n"
+-d $installbin         || $nonono || die "$installbin is not a directory\n";
+-w $installbin         || $nonono || die "$installbin is not writable by you\n"
        unless $installbin =~ m#^/afs/# || $nonono;
 
 -x 'perl' . $exe_ext   || die "perl isn't executable!\n";
@@ -347,6 +353,7 @@ sub samepath {
 sub installlib {
     my $dir = $File::Find::dir;
     $dir =~ s#^\.(?![^/])/?##;
+    local($depth) = $dir ? "lib/$dir" : "lib";
 
     my $name = $_;
     
@@ -373,7 +380,7 @@ sub installlib {
            &unlink("$installarchlib/$name");
        }
        system "cmp", "-s", $_, "$installlib/$name";
-       if ($?) {
+       if ($? || $nonono) {
            &unlink("$installlib/$name");
            mkpath("$installlib/$dir", 1, 0777);
            cp_if_diff($_, "$installlib/$name");
@@ -403,9 +410,12 @@ sub cp_if_diff {
     my($from,$to)=@_;
     -f $from || die "$0: $from not found";
     system "cmp", "-s", $from, $to;
-    if ($?) {
+    if ($? || $nonono) {
        my ($atime, $mtime);
        unlink($to);   # In case we don't have write permissions.
+        if ($nonono) {
+            $from = $depth . "/" . $from if $depth;
+        }
        cmd("cp $from $to");
        # Restore timestamps if it's a .a library.
        if ($to =~ /\.a$/) {