From: Nicholas Clark Date: Sat, 12 Sep 2009 20:46:18 +0000 (+0100) Subject: Retire uupacktool.pl. We're not in Kansas^W(Perforce & APC)-land anymore. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e2cec711386bcf54fa61d6f91366e532eafcfc6;p=p5sagit%2Fp5-mst-13.2.git Retire uupacktool.pl. We're not in Kansas^W(Perforce & APC)-land anymore. --- diff --git a/Cross/Makefile-cross-SH b/Cross/Makefile-cross-SH index d5bbef5..1dc91a3 100755 --- a/Cross/Makefile-cross-SH +++ b/Cross/Makefile-cross-SH @@ -945,19 +945,18 @@ printconfig: .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \ realclean _realcleaner clobber _clobber \ - distclean veryclean _verycleaner \ - cleanup_unpacked_files unpack_files + distclean veryclean _verycleaner -clean: cleanup_unpacked_files _tidy _mopup +clean: _tidy _mopup -realclean: cleanup_unpacked_files _realcleaner _mopup +realclean: _realcleaner _mopup @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh" _clobber: -@rm -f Cross/run-* Cross/to-* Cross/from-* rm -f config.sh cppstdin Policy.sh extras.lst -clobber: cleanup_unpacked_files _realcleaner _mopup _clobber +clobber: _realcleaner _mopup _clobber distclean: clobber @@ -1093,7 +1092,7 @@ makedepend: makedepend.SH config.sh TESTFILE=TEST -_test_prep: unpack_files +_test_prep: cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT)) # Architecture-neutral stuff: @@ -1109,12 +1108,6 @@ _test_tty: _test_notty: cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) -unpack_files: - $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -u -m - -cleanup_unpacked_files: - -@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -c - # The second branch is for testing without a tty or controlling terminal, # see t/op/stat.t _test: diff --git a/MANIFEST b/MANIFEST index eba5649..52fe9bb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4539,7 +4539,6 @@ utils/splain.PL Stand-alone version of diagnostics.pm utils/xsubpp.PL External subroutine preprocessor uts/sprintf_wrap.c sprintf wrapper for UTS uts/strtol_wrap.c strtol wrapper for UTS -uupacktool.pl Pack/unpack files to the .packed format vmesa/Makefile VM/ESA Makefile vmesa/vmesa.c VM/ESA-specific C code for Perl core vmesa/vmesaish.h VM/ESA-specific C header for Perl core diff --git a/Makefile.SH b/Makefile.SH index 1249eee..a343d61 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -1160,12 +1160,11 @@ printconfig: .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \ realclean _realcleaner clobber _clobber \ - distclean veryclean _verycleaner \ - cleanup_unpacked_files unpack_files + distclean veryclean _verycleaner -clean: cleanup_unpacked_files _tidy _mopup +clean: _tidy _mopup -realclean: cleanup_unpacked_files _realcleaner _mopup +realclean: _realcleaner _mopup @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh" _clobber: @@ -1173,12 +1172,12 @@ _clobber: rm -f t/test_state rm -f config.sh cppstdin Policy.sh extras.lst -clobber: cleanup_unpacked_files _realcleaner _mopup _clobber +clobber: _realcleaner _mopup _clobber distclean: clobber # Like distclean but also removes emacs backups and *.orig. -veryclean: cleanup_unpacked_files _verycleaner _mopup _clobber +veryclean: _verycleaner _mopup _clobber -@rm -f Obsolete Wanted # Do not 'make _mopup' directly. @@ -1309,7 +1308,7 @@ makedepend: makedepend.SH config.sh TESTFILE=TEST -_test_prep: unpack_files +_test_prep: cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT)) # Architecture-neutral stuff: @@ -1325,12 +1324,6 @@ _test_tty: _test_notty: cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES) -unpack_files: - $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -u -m - -cleanup_unpacked_files: - -@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -c - # The second branch is for testing without a tty or controlling terminal, # see t/op/stat.t _test: diff --git a/Porting/add-package.pl b/Porting/add-package.pl index 6d40408..948f16e 100644 --- a/Porting/add-package.pl +++ b/Porting/add-package.pl @@ -371,49 +371,6 @@ my @ChangedFiles; } } -### binary files must be encoded! -### XXX use the new 'uupacktool.pl' -{ my $pack = "$Repo/uupacktool.pl"; - - ### pack.pl encodes binary files for us - -e $pack or die "Need $pack to encode binary files!"; - - ### chdir, so uupacktool writes relative files properly - ### into it's header... - my $curdir = cwd(); - chdir($Repo) or die "Could not chdir to '$Repo': $!"; - - for my $aref ( \@ModFiles, \@TestFiles, \@BinFiles ) { - for my $file ( @$aref ) { - my $full = -e $file ? $file : - -e "$RelTopDir/$file" ? "$RelTopDir/$file" : - die "Can not find $file in $Repo or $TopDir\n"; - - if( -f $full && -s _ && -B _ ) { - print "Binary file $file needs encoding\n" if $Verbose; - - my $out = $full . '.packed'; - - ### does the file exist already? - ### and doesn't have +w - if( -e $out && not -w _ ) { - system("chmod +w $out") - and die "Could not set chmod +w to '$out': $!"; - } - - ### -D to remove the original - system("$^X $pack -D -p $full $out") - and die "Could not encode $full to $out"; - - - $file .= '.packed'; - } - } - } - - chdir($curdir) or die "Could not chdir back to '$curdir': $!"; -} - ### update the manifest { my $file = $Repo . '/MANIFEST'; my @manifest; diff --git a/pod/perlrepository.pod b/pod/perlrepository.pod index 0ab8a71..ec0294a 100644 --- a/pod/perlrepository.pod +++ b/pod/perlrepository.pod @@ -350,24 +350,9 @@ $install_root/lib. If you are unsure about the proper location of a file that may have gotten copied while building the source distribution, consult the C. -=head2 A note on binary files +=for XXX -Since the patch(1) utility cannot deal with binary files, it's -important that you either avoid the use of binary files in your patch, -generate the files dynamically, or that you encode any binary files -using the F utility. - -Assuming you needed to include a gzip-encoded file for a module's test -suite, you might do this as follows using the F utility: - - $ perl uupacktool.pl -v -p -D lib/Some/Module/t/src/t.gz - Writing lib/Some/Module/t/src/t.gz into lib/Some/Module/t/src/t.gz.packed - -This will replace the C file with an encoded counterpart. During -C, before any tests are run, perl's Makefile will restore -all the C<.packed> files mentioned in the MANIFEST to their original -name. This means that the test suite does not need to be aware of this -packing scheme and will not need to be altered. +What should we recommend about binary files now? Do we need anything? =head2 Getting your patch accepted diff --git a/uupacktool.pl b/uupacktool.pl deleted file mode 100644 index bb4dc00..0000000 --- a/uupacktool.pl +++ /dev/null @@ -1,225 +0,0 @@ -#!perl - -use strict; -use warnings; -use Getopt::Long; -use File::Basename; -use File::Spec; - -BEGIN { - if ($^O eq 'VMS') { - require VMS::Filespec; - import VMS::Filespec; - } -} - -Getopt::Long::Configure('no_ignore_case'); - -our $LastUpdate = -M $0; - -sub handle_file { - my $opts = shift; - my $file = shift or die "Need file\n". usage(); - my $outfile = shift || ''; - $file = vms_check_name($file) if $^O eq 'VMS'; - my $mode = (stat($file))[2] & 07777; - - open my $fh, "<", $file - or do { warn "Could not open input file $file: $!"; exit 0 }; - my $str = do { local $/; <$fh> }; - - ### unpack? - my $outstr; - if( $opts->{u} ) { - if( !$outfile ) { - $outfile = $file; - $outfile =~ s/\.packed\z//; - } - my ($head, $body) = split /__UU__\n/, $str; - die "Can't unpack malformed data in '$file'\n" - if !$head; - $outstr = unpack 'u', $body; - - } else { - $outfile ||= $file . '.packed'; - - my $me = basename($0); - - $outstr = <<"EOFBLURB" . pack 'u', $str; -######################################################################### -This is a binary file that was packed with the 'uupacktool.pl' which -is included in the Perl distribution. - -To unpack this file use the following command: - - $me -u $outfile $file - -To recreate it use the following command: - - $me -p $file $outfile - -Created at @{[scalar localtime]} -######################################################################### -__UU__ -EOFBLURB - } - - ### output the file - if( $opts->{'s'} ) { - print STDOUT $outstr; - } else { - $outfile = VMS::Filespec::vmsify($outfile) if $^O eq 'VMS'; - print "Writing $file into $outfile\n" if $opts->{'v'}; - open my $outfh, ">", $outfile - or do { warn "Could not open $outfile for writing: $!"; exit 0 }; - binmode $outfh; - ### $outstr might be empty, if the file was empty - print $outfh $outstr if $outstr; - close $outfh; - - chmod $mode, $outfile; - } - - ### delete source file? - if( $opts->{'D'} and $file ne $outfile ) { - 1 while unlink $file; - } -} - -sub bulk_process { - my $opts = shift; - my $Manifest = $opts->{'m'}; - - open my $fh, "<", $Manifest or die "Could not open '$Manifest':$!"; - - print "Reading $Manifest\n" - if $opts->{'v'}; - - my $count = 0; - my $lines = 0; - while( my $line = <$fh> ) { - chomp $line; - my ($file) = split /\s+/, $line; - - $lines++; - - next unless $file =~ /\.packed/; - - $count++; - - my $out = $file; - $out =~ s/\.packed\z//; - $out = vms_check_name($out) if $^O eq 'VMS'; - - ### unpack - if( !$opts->{'c'} ) { - ( $out, $file ) = ( $file, $out ) if $opts->{'p'}; - if (-e $out) { - my $changed = -M _; - if ($changed < $LastUpdate and $changed < -M $file) { - print "Skipping '$file' as '$out' is up-to-date.\n" - if $opts->{'v'}; - next; - } - } - handle_file($opts, $file, $out); - print "Converted '$file' to '$out'\n" - if $opts->{'v'}; - - ### clean up - } else { - - ### file exists? - unless( -e $out ) { - print "File '$file' was not unpacked into '$out'. Can not remove.\n"; - - ### remove it - } else { - print "Removing '$out'\n"; - 1 while unlink $out; - } - } - } - print "Found $count files to process out of $lines in '$Manifest'\n" - if $opts->{'v'}; -} - -sub usage { - return qq[ -Usage: $^X $0 [-d dir] [-v] [-c] [-D] -p|-u [orig [packed|-s] | -m [manifest]] - - Handle binary files in source tree. Can be used to pack or - unpack files individiually or as specified by a manifest file. - -Options: - -u Unpack files (defaults to -u unless -p is specified) - -p Pack files - -c Clean up all unpacked files. Implies -m - - -D Delete source file after encoding/decoding - - -s Output to STDOUT rather than OUTPUT_FILE - -m Use manifest file, if none is explicitly provided defaults to 'MANIFEST' - - -d Change directory to dir before processing - - -v Run verbosely - -h Display this help message -]; -} - -sub vms_check_name { - -# Packed files tend to have multiple dots, which the CRTL may or may not handle -# properly, so convert to native format. And depending on how the archive was -# unpacked, foo.bar.baz may be foo_bar.baz or foo.bar_baz. N.B. This checks for -# existence, so is not suitable as-is to generate ODS-2-safe names in preparation -# for file creation. - - my $file = shift; - - $file = VMS::Filespec::vmsify($file); - return $file if -e $file; - - my ($vol,$dirs,$base) = File::Spec->splitpath($file); - my $tmp = $base; - 1 while $tmp =~ s/([^\.]+)\.(.+\..+)/$1_$2/; - my $try = File::Spec->catpath($vol, $dirs, $tmp); - return $try if -e $try; - - $tmp = $base; - 1 while $tmp =~ s/(.+\..+)\.([^\.]+)/$1_$2/; - $try = File::Spec->catpath($vol, $dirs, $tmp); - return $try if -e $try; - - return $file; -} - -my $opts = {}; -GetOptions($opts,'u','p','c', 'D', 'm:s','s','d=s','v','h'); - -die "Can't pack and unpack at the same time!\n", usage() - if $opts->{'u'} && $opts->{'p'}; -die usage() if $opts->{'h'}; - -if ( $opts->{'d'} ) { - chdir $opts->{'d'} - or die "Failed to chdir to '$opts->{'d'}':$!"; -} -$opts->{'u'} = 1 if !$opts->{'p'}; -binmode STDOUT if $opts->{'s'}; -if ( exists $opts->{'m'} or exists $opts->{'c'} ) { - $opts->{'m'} ||= "MANIFEST"; - bulk_process($opts); - exit(0); -} else { - if (@ARGV) { - handle_file($opts, @ARGV); - } else { - die "No file to process specified!\n", usage(); - } - exit(0); -} - - -die usage(); diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index c25fd0d..135b654 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -1454,21 +1454,15 @@ perly$(O) : perly.c, perly.h, $(h) [.t.lib]vmsfspec.t : [.vms.ext]filespec.t Copy/NoConfirm/Log $(MMS$SOURCE) $(MMS$TARGET) -unpack_files : - - $(MINIPERL) uupacktool.pl -u -m - -cleanup_unpacked_files : - - IF F$SEARCH("$(MINIPERL_EXE)") .NES. "" THEN $(MINIPERL) uupacktool.pl -c - check : test @ Continue -test : all [.t.lib]vmsfspec.t unpack_files +test : all [.t.lib]vmsfspec.t @ PERL_TEST_DRIVER == "TEST." - @[.vms]test.com "$(E)" "$(__DEBUG__)" @ $(MINIPERL) -e "print ""Ran tests"";" > [.t]rantests. -test_harness : all [.t.lib]vmsfspec.t unpack_files +test_harness : all [.t.lib]vmsfspec.t @ PERL_TEST_DRIVER == "harness." - @[.vms]test.com "$(E)" "$(__DEBUG__)" @ $(MINIPERL) -e "print ""Ran tests"";" > [.t]rantests. @@ -1847,7 +1841,7 @@ tidy : cleanlis - If F$Search("[.x2p]*.com;-1").nes."" Then Purge/NoConfirm/Log [.x2p]*.com - If F$Search("[.lib.pods]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib.pods]*.com -clean : tidy cleantest cleanup_unpacked_files +clean : tidy cleantest - $(MINIPERL) make_ext.pl "MAKE=$(MMS)" "--all" "--target=clean" - If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*/Exclude=PerlShr_*.Opt - If F$Search("[...]*$(O);*") .nes."" Then Delete/NoConfirm/Log [...]*$(O);* diff --git a/win32/Makefile b/win32/Makefile index 66eee96..9f6fa3d 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1272,7 +1272,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils $(UNIDATAFILES) cd ..\t && \ $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t -test-prep : all utils unpack_files +test-prep : all utils $(XCOPY) $(PERLEXE) ..\t\$(NULL) $(XCOPY) $(PERLDLL) ..\t\$(NULL) $(XCOPY) $(GLOBEXE) ..\t\$(NULL) @@ -1282,12 +1282,6 @@ test : test-prep $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES) cd ..\win32 -unpack_files: - $(MINIPERL) -I..\lib ..\uupacktool.pl -u -d .. -m - -cleanup_unpacked_files: - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\uupacktool.pl -c -d .. -m - test-reonly : reonly utils $(XCOPY) $(PERLEXE) ..\t\$(NULL) $(XCOPY) $(PERLDLL) ..\t\$(NULL) @@ -1346,11 +1340,9 @@ _clean : -@$(DEL) *.pdb -@$(DEL) Extensions_static -_preclean : cleanup_unpacked_files - -clean : _preclean Extensions_clean _clean +clean : Extensions_clean _clean -realclean : _preclean Extensions_realclean MakePPPort_clean _clean +realclean : Extensions_realclean MakePPPort_clean _clean # Handy way to run perlbug -ok without having to install and run the # installed perlbug. We don't re-run the tests here - we trust the user. diff --git a/win32/makefile.mk b/win32/makefile.mk index b96e511..e9f54ad 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1601,13 +1601,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils cd ..\t && \ $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t -unpack_files: - $(MINIPERL) -I..\lib ..\uupacktool.pl -u -d .. -m - -cleanup_unpacked_files: - -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\uupacktool.pl -c -d .. -m - -test-prep : all utils unpack_files +test-prep : all utils $(XCOPY) $(PERLEXE) ..\t\$(NULL) $(XCOPY) $(PERLDLL) ..\t\$(NULL) .IF "$(CCTYPE)" == "BORLAND" @@ -1678,11 +1672,9 @@ _clean : -_preclean : cleanup_unpacked_files - -clean : _preclean Extensions_clean _clean +clean : Extensions_clean _clean -realclean : _preclean Extensions_realclean MakePPPort_clean _clean +realclean : Extensions_realclean MakePPPort_clean _clean # Handy way to run perlbug -ok without having to install and run the # installed perlbug. We don't re-run the tests here - we trust the user.