Found it! Fill yer boots. Please read the comments!!

#!/usr/bin/perl -w # This Perl script takes the individual '.zip' files downloaded from t +he ActiveState 'ppm' repository # and uses them to generate a local 'ppm' repository. # Perl scripting is required because the individual packages in the '. +zip' files have duplicate file names. # Each archive has a 'README' file which is discarded. # Each archive also has a 'ppd' file containing the package descriptio +n. # Where there are several versions of a package in the archive the '.t +ar.gz' files are uniquely named # but the 'ppd' files are not. This scrip therefore renames the 'ppd' +files to match the '.tar.gz' files. # The archives are unzipped to a work area using 7-zip (7z.exe) and th +e '.ppd' file is then copied to the # local repository, being renamed if necessary during the copy. The 'p +pd' file in the work area is then deleted. # The '.tar.gz' files should all go into the same subsidiary directory +. # Therefore this directory is only copied once, at the end of processi +ng. # In fact, all subsidiary directories are copied, but it is assumed th +at there will be only one. # Be warned that this code is dangerous! # There is only limited sanity checking so you could do all sorts of d +amage by careless use!!!! # Input parameters: # Filestore location of 'zip' files to be used to create the re +pository # Directory to be used for 'ppm' repository (created if not pre +sent) # Directory to be used as work area (a subsidiary directory wil +l be created, then deleted at end). print "\n"; print "Location of '.zip' files is $ARGV[0] \n"; print "Location of 'ppm' repository is $ARGV[1] \n"; print "Location of work directory is $ARGV[2] \n"; my $zippath = $ARGV[0]; my $ppmrep = $ARGV[1]; my $workdirtop = $ARGV[2]; my $workdir = "$workdirtop\\ppmwork"; # Clean out directory from previous cycle(s) if present $return = `rmdir /S /Q $workdir`; # Open directory, read list of '.zip' files, and close opendir(ZIPDIR, $zippath) or die "Failed to open $zippath: $!"; #@allzips = grep { /zip$/ && -f } map { "$zippath/$_" } readdir(ZIPDIR +); @allzips = grep { /zip$/ } readdir(ZIPDIR); closedir ZIPDIR; $zipcount = @allzips; print "\nNumber of files to process is $zipcount !\n"; ################################################################### # Code fragment to do the main work. # To be reworked into a loop for all files. ################################################################### foreach $zip_file (@allzips) { # Remember that there is no space between the flag and the value! # Use 7-zip to extract from the zip file into the work directory # -y option allows over-write of README file $return = `7z x -o$workdir -y $zippath\\$zip_file`; print $return; # Open work directory and find name of 'ppd' file opendir(WORKDIR, $workdir) or die "Failed to open $workdir: $!"; my @ppd_file = grep { /\.ppd$/ } readdir(WORKDIR); closedir WORKDIR; # Assume only one element in the array! my $ppd_name = $ppd_file[0]; # Strip off the '.zip' part of the input file name $_ = $zip_file; s/\.zip//; my $zip_name = $_; # Make new '.ppd' file name which matches the '.zip' file name. # We don't care if it is the same as the original name, so why tes +t? my $new_name = "$zip_name\.ppd"; # Move file from work directory to repository $return = `move /Y $workdir\\$ppd_name $ppmrep\\$new_name`; print $return; # All done for this time round! }

Please note I have just found this and have not validated it, tested it, nor confirmed that it is the final working version. However there is enough here to demonstrate the overall approach.

Nothing succeeds like a budgie with no teeth.

In reply to Re^6: Building a local 'ppm' repository (Windows) by LittleGreyCat
in thread Building a local 'ppm' repository (Windows) by LittleGreyCat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.