in reply to Re^3: Building a local 'ppm' repository (Windows)
in thread Building a local 'ppm' repository (Windows)

Ditto that last. Please, people, do kindly share your solutions after having gotten help here. Thus do I find myself two years ex-post-facto the above seekers assumed victory, having read through the entire thread only to find that he who assumably solved this vexing issue elected neither to share their final results nor to explain why they couldn't. Grrr.

Yes, of course I can exert a similar effort myself and put it together on my own...except for a pressing time constraint within which narrow window I must either effect this solution or else do without.

My own such howtos, few though they may be, are all posted here link and here link...both of which lists, do admittedly, need updating and some broken links fixed (I just last week moved some domains). But at least I bothered in the first place.

  • Comment on Re^4: Building a local 'ppm' repository (Windows)

Replies are listed 'Best First'.
Re^5: Building a local 'ppm' repository (Windows)
by LittleGreyCat (Scribe) on Feb 15, 2014 at 22:30 UTC

    Just returning to the Monastery for a fleeting visit.

    I will have a look in my historical bits to see if I still have the code (although as it was built and tested on XP may have a limited shelf life).

    IIRC there were issues about me posting code developed in work time.

    However, that was long ago and in another country.
    And besides, the wench is dead.

    Cheers

    Dave R

    Nothing succeeds like a budgie with no teeth.

      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.