home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 2000 Professional Resource Kit / W2KPRK.iso / apps / perl / ActivePerl.exe / data.z / ppm.pl < prev    next >
Encoding:
Perl Script  |  1999-10-14  |  56.0 KB  |  1,576 lines

  1. #!/usr/bin/perl
  2.  
  3. use Getopt::Long;
  4. use File::Basename;
  5. use Config;
  6. use strict;
  7.  
  8. use PPM;
  9.  
  10. $PPM::VERSION = "1.0.0";
  11.  
  12. my $usage = <<'EOT';
  13.     usage: ppm genconfig
  14.            ppm help [command]
  15.            ppm info [package1 ... packageN]
  16.            ppm install [--location=location] package1 [... packageN]
  17.            ppm query [--case|nocase] [--searchtag=abstract|author|title] PATTERN
  18.            ppm remove package1 [... packageN]
  19.            ppm search [--case|nocase] [--location=location] [--searchtag=abstract|author|title] PATTERN
  20.            ppm set [option]
  21.            ppm summary [--location=location] [package1 ... packageN]
  22.            ppm verify [--location=location] [--upgrade] [package1 ... packageN]
  23.            ppm version
  24.            ppm [--location=location]
  25.  
  26. EOT
  27.  
  28. my %help;
  29.  
  30. $help{'set'} = <<'EOT';
  31.     set
  32.         - Displays current settings.
  33.     set build DIRECTORY
  34.         - Changes the package build directory.
  35.     set case [Yes|No]
  36.         - Set case-sensitive searches.
  37.     set clean [Yes|No]
  38.         - Set removal of temporary files from package's build area
  39.           following successful installation.
  40.     set confirm [Yes|No]
  41.         - Sets confirmation of 'install', 'remove' and 'upgrade'.
  42.     set force_install [Yes|No]
  43.         - Continue installing a package if a dependency cannot be installed.
  44.     set more NUMBER
  45.         - Pause after displaying 'NUMBER' lines.  Specifying '0' turns
  46.           off paging capability.
  47.     set repository /remove NAME
  48.         - Removes the repository 'NAME' from the list of repositories.
  49.     set repository NAME LOCATION
  50.         - Adds a repository to the list of PPD repositories for this session.
  51.           'NAME' is the name by which this repository will be referred;
  52.           'LOCATION' is a URL or directory name.
  53.     set root DIRECTORY
  54.         - Changes install root directory for this session.
  55.     set save
  56.         - save current options as defaults.
  57.     set trace
  58.         - Tracing level--default is 1, maximum is 4, 0 indicates
  59.           no tracing.
  60.     set tracefile
  61.         - File to contain tracing information, default is 'PPM.LOG'.
  62.  
  63. EOT
  64.  
  65. # Need to do this here, because the user's config file is probably
  66. # hosed.
  67. if ($#ARGV == 0 && $ARGV[0] eq 'genconfig') {
  68.     &genconfig;
  69.     exit 0;
  70. }
  71.  
  72. my %options = PPM::GetPPMOptions();
  73. use vars qw ($location $Ignorecase $clean $confirm $force_install $root $build_dir $more $trace $tracefile);
  74. *Ignorecase = \$options{'IGNORECASE'};
  75. *clean = \$options{'CLEAN'};
  76. *confirm = \$options{'CONFIRM'};
  77. *force_install = \$options{'FORCE_INSTALL'};
  78. *root = \$options{'ROOT'};
  79. *build_dir = \$options{'BUILDDIR'};
  80. *more = \$options{'MORE'};
  81. *trace = \$options{'TRACE'};
  82. *tracefile = \$options{'TRACEFILE'};
  83.  
  84. my $moremsg = "[Press return to continue]";
  85. my $interactive = 0;
  86.  
  87. $help{'help'} = <<'EOT';
  88. Commands:
  89.     exit              - leave the program.
  90.     genconfig         - prints a valid PPM.XML file to STDOUT.
  91.     help [command]    - prints this screen, or help on 'command'.
  92.     info PACKAGES     - prints a summary of installed packages.
  93.     install PACKAGES  - installs specified PACKAGES.
  94.     quit              - leave the program.
  95.     query [options]   - query information about installed packages.
  96.     remove PACKAGES   - removes the specified PACKAGES from the system.
  97.     search [options]  - search information about available packages.
  98.     summary [options] - prints a summary of a package or repository
  99.     set [options]     - set/display current options.
  100.     verify [options]  - verifies current install is up to date.
  101.  
  102. EOT
  103.  
  104. $help{'search'} = <<'EOT';
  105.     search [PATTERN]
  106.     search /abstract [PATTERN]
  107.     search /author [PATTERN]
  108.     search /title [PATTERN]
  109.     search /location LOCATION [PATTERN]
  110.  
  111.     Searches for available packages.  With no arguments, will display
  112.     a list of all available packages. If a regular expression 'PATTERN'
  113.     is supplied, only packages matching the pattern will be displayed.
  114.     If the '/abstract', '/author' or '/title' argument is specified,
  115.     the respective field of the package will be searched.  If the
  116.     '/location' option is specified, matching packages from that
  117.     URL or directory will be listed.
  118.  
  119. EOT
  120.  
  121. $help{'install'} = <<'EOT';
  122.     install PACKAGE
  123.     install /location LOCATION PACKAGE
  124.  
  125.     Installs the specified 'PACKAGE' onto the system.  If the '/location'
  126.     option is specified, the package will be looked for at that URL
  127.     or directory.
  128.  
  129. EOT
  130.  
  131. $help{'remove'} = <<'EOT';
  132.     remove PACKAGE
  133.  
  134.     Removes the specified 'PACKAGE' from the system.
  135.  
  136. EOT
  137.  
  138. $help{'genconfig'} = <<'EOT';
  139.     genconfig
  140.  
  141.     This command will print a valid PPM config file (ppm.xml) to 
  142.     STDOUT.  This can be useful if the PPM config file ever gets 
  143.     damaged leaving PPM unusable.
  144.  
  145. EOT
  146.  
  147. $help{'query'} = <<'EOT';
  148.     query [PATTERN]
  149.     query /abstract [PATTERN]
  150.     query /author [PATTERN]
  151.     query /title [PATTERN]
  152.  
  153.     Queries information about installed packages. With no arguments, will
  154.     display a list of all installed packages. If a regular expression
  155.     'PATTERN' is supplied, only packages matching the pattern will be
  156.     displayed.  If the '/abstract', '/author' or '/title' argument is
  157.     specified, the respective field of the package will be searched.
  158.  
  159. EOT
  160.  
  161. $help{'verify'} = <<'EOT';
  162.     verify [packages]
  163.     verify /upgrade [packages]
  164.     verify /location LOCATION [packages]
  165.  
  166.     Verifies that the currently installed 'packages' are up to date.
  167.     If 'packages' is not specified, all installed packages are verified.
  168.     If the '/upgrade' option is specified, any packages for which an
  169.     upgrade is available will be upgraded.  If the '/location' option
  170.     is specified, upgrades will be looked for at the specified URL
  171.     or directory.
  172.  
  173. EOT
  174.  
  175. $help{'summary'} = <<'EOT';
  176.     summary [packages]
  177.     summary /location LOCATION [packages]
  178.  
  179.     Prints a summary (name, version and abstract) of the specified
  180.     package, or all packages available at a repository if no package
  181.     is specified.  If the '/location' option is specified, a summary
  182.     of packages at the specified repository (if available) will be 
  183.     printed.
  184.  
  185. EOT
  186.  
  187. $help{'info'} = <<'EOT';
  188.     info [packages]
  189.  
  190.     Prints a summary (name, version and abstract) of the specified
  191.     installed package, or all installed packages if no package is 
  192.     specified.
  193.  
  194. EOT
  195.  
  196. my %repositories = PPM::ListOfRepositories();
  197.  
  198. if ($#ARGV == -1 || ($#ARGV == 0 && $ARGV[0] =~ /^--location/)) {
  199.     my $prompt = 'PPM> ';
  200.     $interactive = 1;
  201.     GetOptions("location=s" => \$location);
  202.  
  203.     print "PPM interactive shell ($PPM::VERSION) - type 'help' for available commands.\n";
  204.     $| = 1;
  205.     while () {
  206.         print $prompt;
  207.         last unless defined ($_ = <> );
  208.         chomp;
  209.         s/^\s+//;
  210.         my @line = split(/\s+/, $_);
  211.         my $cmd = shift @line;
  212.         next if /^$/;
  213.  
  214.         if ($cmd  =~ /^(quit|exit)$/i) {
  215.             print "Quit!\n";
  216.             last;
  217.         }
  218.         elsif ($cmd =~ /^help$/i) {
  219.             if (defined $line[0] && $help{$line[0]}) {
  220.                 print $help{$line[0]};
  221.             }
  222.             else {
  223.                 print $help{'help'};
  224.             }
  225.         }
  226.         elsif ($cmd =~ /^install$/i) {
  227.             my $package;
  228.             local $location = $location;
  229.             if (defined $line[0]) {
  230.                 if ($line[0] =~ /^\/location$/i) {
  231.                     shift @line;
  232.                     $location = shift @line;
  233.                 }
  234.             }
  235.             if (!defined @line) {
  236.                 print "Package not specified.\n";
  237.                 next;
  238.             }
  239.             foreach $package (@line) {
  240.                 if ($confirm eq "Yes") {
  241.                     print "Install package \'$package?\' (y/N): ";
  242.                     my $response = <>;
  243.                     if ($response ne "y\n") {
  244.                         next;
  245.                     }
  246.                 }
  247.                 print "Retrieving package \'$package\'...\n";
  248.                 if(!InstallPackage("package" => $package, "location" => $location)) {
  249.                     print "Error installing package '$package': $PPM::PPMERR\n";
  250.                 }
  251.             }
  252.         }
  253.         elsif ($cmd =~ /^set$/i) {
  254.             set(@line);
  255.         }
  256.         elsif ($cmd =~ /^info$/i) {
  257.             my $package;
  258.             my %summary = InstalledPackageProperties();
  259.             if (defined %summary) {
  260.                 my $lines = 0;
  261.                 foreach $package (sort keys %summary) {
  262.                     if (defined $line[0]) {
  263.                         next unless ($Ignorecase eq "Yes" ? grep /^$package$/i, @line : grep /^$package$/, @line);
  264.                     }
  265.                     while ($summary{$package}{'VERSION'} =~ /,0$/) {
  266.                         $summary{$package}{'VERSION'} =~ s/,0$//;
  267.                     }
  268.                     $summary{$package}{'VERSION'} =~ tr/,/./;
  269.                     if ($more && ++$lines == $more) {
  270.                         print $moremsg;
  271.                         $_ = <>;
  272.                         $lines = 1;
  273.                     }
  274.                     print "$summary{$package}{'NAME'} [$summary{$package}{'VERSION'}]:\t$summary{$package}{'ABSTRACT'}\n";
  275.                 }
  276.             }
  277.         }
  278.         elsif ($cmd =~ /^remove$/i) {
  279.             my $package;
  280.             if (!defined @line) {
  281.                 print "Package not specified.\n";
  282.                 next;
  283.             }
  284.             foreach $package (@line) {
  285.                 if ($confirm eq "Yes") {
  286.                     print "Remove package \'$package?\' (y/N): ";
  287.                     my $response = <>;
  288.                     if ($response ne "y\n") {
  289.                         next;
  290.                     }
  291.                 }
  292.                 if (!RemovePackage("package" => $package)) {
  293.                     print "Error removing $package: $PPM::PPMERR\n";
  294.                 }
  295.             }
  296.         }
  297.         elsif ($cmd =~ /^summary$/i) {
  298.             my $package;
  299.             local $location = $location;
  300.             if (defined $line[0]) {
  301.                 if ($line[0] =~ /^\/location$/i) {
  302.                     shift @line;
  303.                     $location = shift @line;
  304.                 }
  305.             }
  306.             if (!defined $line[0]) {
  307.                 my %summary = RepositorySummary("location" => $location);
  308.                 foreach my $loc (keys %summary) {
  309.                     print "Summary of packages available from $loc:\n";
  310.                     my $lines = 1;
  311.                     foreach my $package (sort keys %{$summary{$loc}}) {
  312.                         my %details = %{$summary{$loc}{$package}};
  313.                         while ($details{'VERSION'} =~ /,0$/) {
  314.                             $details{'VERSION'} =~ s/,0$//;
  315.                         }
  316.                         $details{'VERSION'} =~ tr/,/./;
  317.                         if ($more && ++$lines == $more) {
  318.                             print $moremsg;
  319.                             $_ = <>;
  320.                             $lines = 1;
  321.                         }
  322.                         print "$details{NAME} [$details{VERSION}]:\t$details{ABSTRACT}\n";
  323.                     }
  324.                 }
  325.                 next;
  326.             }
  327.             foreach $package (@line) {
  328.                 my %summary = RepositoryPackageProperties("package" => $package, "location" => $location);
  329.                 if (defined %summary) {
  330.                     while ($summary{'VERSION'} =~ /,0$/) {
  331.                         $summary{'VERSION'} =~ s/,0$//;
  332.                     }
  333.                     $summary{'VERSION'} =~ tr/,/./;
  334.                     print "$summary{'NAME'} [$summary{'VERSION'}]:\t$summary{'ABSTRACT'}\n";
  335.                 }
  336.             }
  337.         }
  338.         elsif ($cmd =~ /^search$/i) {
  339.             my $searchtag;
  340.             local $location = $location;
  341.             while (defined $line[0]) {
  342.                 if ($line[0] =~ /^\/abstract$/i) {
  343.                     shift @line;
  344.                     $searchtag = 'abstract';
  345.                 }
  346.                 elsif ($line[0] =~ /^\/author$/i) {
  347.                     shift @line;
  348.                     $searchtag = 'author';
  349.                 }
  350.                 elsif ($line[0] =~ /^\/title$/i) {
  351.                     shift @line;
  352.                     $searchtag = 'title';
  353.                 }
  354.                 elsif ($line[0] =~ /^\/location$/i) {
  355.                     shift @line;
  356.                     $location = shift @line;
  357.                 }
  358.                 else { last; }
  359.             }
  360.             my $searchRE = $line[0];
  361.             search_PPDs("location" => $location, "searchtag" => $searchtag, 
  362.                         "searchRE" => $searchRE, "ignorecase" => $Ignorecase);
  363.         }
  364.         elsif ($cmd =~ /^query$/i) {
  365.             my $searchtag;
  366.             if (defined $line[0] && ($line[0] =~ /^\/abstract$/i || 
  367.                      $line[0] =~ /^\/author$/i || $line[0] =~ /^\/title$/i)) {
  368.                  $searchtag = shift @line;
  369.                  $searchtag = substr($searchtag, 1);
  370.             }
  371.             my $RE = shift @line;
  372.             my %packages = QueryInstalledPackages("searchtag" => $searchtag, "searchRE" => $RE);
  373.             if (!%packages && defined $PPM::PPMERR) {
  374.                 print "$PPM::PPMERR\n";
  375.                 next;
  376.             }
  377.             my $package;
  378.             my $lines = 1;
  379.             foreach $package (sort keys %packages) {
  380.                 print "\t$package" . (defined $searchtag ? ": $packages{$package}\n" : "\n");
  381.                 if ($more && ++$lines == $more) {
  382.                     print $moremsg;
  383.                     $_ = <>;
  384.                     $lines = 1;
  385.                 }
  386.             }
  387.         }
  388.         elsif ($cmd =~ /^verify$/i) {
  389.             my $upgrade;
  390.             local $location = $location;
  391.             while (defined $line[0]) {
  392.                 if ($line[0] =~ /^\/upgrade$/i) {
  393.                     $upgrade = 1;
  394.                     shift @line;
  395.                     next;
  396.                 }
  397.                 if ($line[0] =~ /^\/location$/i) {
  398.                     shift @line;
  399.                     $location = shift @line;
  400.                     next;
  401.                 }
  402.                 last;
  403.             }
  404.             if ($upgrade && $confirm eq "Yes") {
  405.                 if ($#line == 0) {
  406.                     print "Upgrade package $line[0]? (y/N): ";
  407.                 }
  408.                 else {
  409.                     print "Upgrade packages? (y/N): ";
  410.                 }
  411.                 my $response = <>;
  412.                 if ($response ne "y\n") {
  413.                     next;
  414.                 }
  415.             }
  416.             verify_packages("packages" => \@line, "location" => $location, "upgrade" => $upgrade);
  417.         }
  418.         else {
  419.             print "Unknown command '$cmd'; type 'help' for commands.\n";
  420.         }
  421.     }
  422. }
  423. elsif ($ARGV[0] eq 'help') {
  424. $help{'install'} = <<'EOT';
  425.     install [--location=location] PACKAGE
  426.  
  427.     Installs the specified 'PACKAGE' onto the system.  If 'location' is
  428.     not specified, the default locations in the PPM data file will be
  429.     used to locate the package.
  430.  
  431. EOT
  432.  
  433. $help{'search'} = <<'EOT';
  434.     search [--case|nocase] [--location=location] [PATTERN]
  435.     search [--case|nocase] [--location=location] --searchtag=abstract [PATTERN]
  436.     search [--case|nocase] [--location=location] --searchtag=author [PATTERN]
  437.     search [--case|nocase] [--location=location] --searchtag=title [PATTERN]
  438.  
  439.     Searches for available packages.  With no arguments, will display
  440.     a list of all available packages. If a regular expression 'PATTERN'
  441.     is supplied, only packages matching the pattern will be displayed.
  442.     If the 'abstract', 'author' or 'title' --searchtag argument is
  443.     specified, the respective field of the package will be searched.
  444.     If 'location' is not specified, the repository locations in the PPM
  445.     data file will be searched.  '--case' or '--nocase' may be used to
  446.     request case-sensitive or case-insensitive searches, respectively.
  447.  
  448. EOT
  449.  
  450. $help{'query'} = <<'EOT';
  451.     query [PATTERN]
  452.     query [--case|nocase] --searchtag=abstract [PATTERN]
  453.     query [--case|nocase] --searchtag=author [PATTERN]
  454.     query [--case|nocase] --searchtag=title [PATTERN]
  455.  
  456.     Queries information about installed packages. With no arguments, will
  457.     display a list of all installed packages. If a regular expression
  458.     'PATTERN' is supplied, only packages matching the pattern will
  459.     be displayed.  If the 'abstract', 'author' or 'title' --searchtag
  460.     argument is specified, the respective field of the package will
  461.     be searched.  '--case' or '--nocase' may be used to request
  462.     case-sensitive or case-insensitive searches, respectively.
  463.  
  464. EOT
  465.  
  466. $help{'verify'} = <<'EOT';
  467.     verify [--location=location] [packages]
  468.     verify --upgrade [--location=location] [packages]
  469.  
  470.     Verifies that the currently installed 'packages' are up to date.
  471.     If 'packages' is not specified, all installed packages are verified.
  472.     If the '--upgrade' option is specified, any packages for which
  473.     an upgrade is available will be upgraded.  If 'location' is not
  474.     specified, the repository locations in the PPM data file will be
  475.     searched.
  476.  
  477. EOT
  478.  
  479. $help{'summary'} = <<'EOT';
  480.     summary [--location=location] [packages]
  481.  
  482.     Prints a summary (name, version and abstract) of the specified
  483.     package, or all packages available at a repository if no package
  484.     is specified.  If the '--location' option is specified, a summary
  485.     of packages at the specified repository (if available) will be 
  486.     printed.
  487.  
  488. EOT
  489.     shift;
  490.     if (defined $ARGV[0] && $help{$ARGV[0]}) {
  491.         print $help{$ARGV[0]};
  492.     }
  493.     else {
  494.         print $usage;
  495.     }
  496. }
  497. elsif ($ARGV[0] eq 'version') {
  498.     print $PPM::VERSION;
  499. }
  500. elsif ($ARGV[0] eq 'set') {
  501.     shift;
  502.     if (set(@ARGV) == 0) {
  503.         PPM::SetPPMOptions("options" => \%options, "save" => 1);
  504.     }
  505. }
  506. elsif ($ARGV[0] eq 'info') {
  507.     shift;
  508.     my $package;
  509.     my %summary = InstalledPackageProperties();
  510.     if (defined %summary) {
  511.         foreach $package (sort keys %summary) {
  512.             if (defined $ARGV[0]) {
  513.                 next unless ($Ignorecase eq "Yes" ? grep /^$package$/i, @ARGV : grep /^$package$/, @ARGV);
  514.             }
  515.             while ($summary{$package}{'VERSION'} =~ /,0$/) {
  516.                 $summary{$package}{'VERSION'} =~ s/,0$//;
  517.             }
  518.             $summary{$package}{'VERSION'} =~ tr/,/./;
  519.             print "$summary{$package}{'NAME'} [$summary{$package}{'VERSION'}]:\t$summary{$package}{'ABSTRACT'}\n";
  520.         }
  521.     }
  522. }
  523. elsif ($ARGV[0] eq 'install') {
  524.     my ($package);
  525.  
  526.     shift;
  527.     GetOptions("location=s" => \$location);
  528.  
  529.     $package = shift;
  530.     if (!defined $package && -d "blib" && -f "Makefile") {
  531.         if(!InstallPackage("location" => $location)) {
  532.             print "Error installing blib: $PPM::PPMERR\n";
  533.         }
  534.     }
  535.     while ($package) {
  536.         if(!InstallPackage("package" => $package, "location" => $location)) {
  537.             print "Error installing package '$package': $PPM::PPMERR\n";
  538.         }
  539.         $package = shift;
  540.     }
  541. }
  542. elsif ($ARGV[0] eq 'remove') {
  543.     shift;
  544.  
  545.     my $package = shift;
  546.  
  547.     while ($package) {
  548.         if (!RemovePackage("package" => $package)) {
  549.             print "Error removing $package: $PPM::PPMERR\n";
  550.         }
  551.         $package = shift;
  552.     }
  553. }
  554. elsif ($ARGV[0] eq 'verify') {
  555.     my ($upgrade, $package, @packages);
  556.  
  557.     shift;
  558.     GetOptions("location=s" => \$location, "upgrade" => \$upgrade);
  559.  
  560.     verify_packages("packages" => \@ARGV, "location" => $location, "upgrade" => $upgrade);
  561. }
  562. elsif ($ARGV[0] eq 'query') {
  563.     my ($case, $nocase, $searchtag, $searchRE);
  564.     shift;
  565.     GetOptions("nocase" => \$nocase, "case" => \$case,
  566.                 "searchtag=s" => \$searchtag );
  567.     $searchRE = shift;
  568.     if (!defined $nocase) {
  569.         if (!defined $case) {
  570.             $nocase = $Ignorecase;  # use the default setting
  571.         }
  572.     }
  573.     if (defined $searchtag) {
  574.         if (!$searchtag =~ /(abstract|author|title)/i) {
  575.             print $usage;
  576.             exit 1;
  577.         }
  578.     }
  579.     my %packages = QueryInstalledPackages("ignorecase" => $nocase,
  580.                          "searchtag" => $searchtag, "searchRE" => $searchRE);
  581.     if (!%packages && defined $PPM::PPMERR) {
  582.         print "$PPM::PPMERR\n";
  583.         exit 1;
  584.     }
  585.     my $package;
  586.     foreach $package (sort keys %packages) {
  587.         print "\t$package" . (defined $searchtag ? ": $packages{$package}\n" : "\n");
  588.     }
  589. }
  590. elsif ($ARGV[0] eq 'search') {
  591.     my ($case, $nocase, $searchtag, %ppds, $searchRE);
  592.     shift;
  593.     GetOptions("nocase" => \$nocase, "case" => \$case,
  594.                 "location=s" => \$location, "searchtag=s" => \$searchtag );
  595.     $searchRE = shift;
  596.     if (defined $case) {
  597.         $nocase = "No";
  598.     }
  599.     elsif (defined $nocase) {
  600.         $nocase = "Yes";
  601.     }
  602.     else {
  603.         $nocase = $Ignorecase;
  604.     }
  605.     if (defined $searchtag && !($searchtag =~ /(abstract|author|title)/i)) {
  606.         print $usage;
  607.         exit 1;
  608.     }
  609.  
  610.     search_PPDs("location" => $location, "searchtag" => $searchtag, 
  611.                 "searchRE" => $searchRE, "ignorecase" => $nocase);
  612. }
  613. elsif ($ARGV[0] eq 'summary') {
  614.     shift;
  615.     GetOptions("location=s" => \$location);
  616.     my $package = shift;
  617.     if (!defined $package) {
  618.         my %summary = RepositorySummary("location" => $location);
  619.         foreach my $loc (keys %summary) {
  620.             print "Summary of packages available from $loc:\n";
  621.             foreach my $package (sort keys %{$summary{$loc}}) {
  622.                 my %details = %{$summary{$loc}{$package}};
  623.                 while ($details{'VERSION'} =~ /,0$/) {
  624.                     $details{'VERSION'} =~ s/,0$//;
  625.                 }
  626.                 $details{'VERSION'} =~ tr/,/./;
  627.                 print "$details{NAME} [$details{VERSION}]:\t$details{ABSTRACT}\n";
  628.             }
  629.         }
  630.     }
  631.     else {
  632.         while (defined $package) {
  633.             my %summary = RepositoryPackageProperties("package" => $package, "location" => $location);
  634.             if (defined %summary) {
  635.                 while ($summary{'VERSION'} =~ /,0$/) {
  636.                     $summary{'VERSION'} =~ s/,0$//;
  637.                 }
  638.                 $summary{'VERSION'} =~ tr/,/./;
  639.                 print "$summary{'NAME'} [$summary{'VERSION'}]:\t$summary{'ABSTRACT'}\n";
  640.             }
  641.             $package = shift;
  642.         }
  643.     }
  644. }
  645. else {
  646.     print $usage;
  647.     exit 1;
  648. }
  649.  
  650. exit 0;
  651.  
  652. sub set
  653. {
  654.     my ($option) = shift @_;
  655.     my $rc = 0;
  656.     if (defined $option) {
  657.         my ($value) = shift @_;
  658.         if ($option =~ /^repository$/i) {
  659.             if ($value =~ /\/remove/i) {
  660.                 $value = shift @_;
  661.                 while (@_) {
  662.                     $value .= " " . shift @_;
  663.                 }
  664.                 if (!defined $value) {
  665.                     print "Location not specified.\n";
  666.                     $rc = 1;
  667.                 }
  668.                 else {
  669.                     PPM::RemoveRepository("repository" => $value);
  670.                     %repositories = PPM::ListOfRepositories();
  671.                 }
  672.             }
  673.             else {
  674.                 my $location = shift @_;
  675.                 if (!defined $value || !defined $location) {
  676.                     print "Repository not specified.\n";
  677.                     $rc = 1;
  678.                 }
  679.                 else {
  680.                     PPM::AddRepository("repository" => $value,
  681.                                        "location" => $location);
  682.                     %repositories = PPM::ListOfRepositories();
  683.                 }
  684.             }
  685.         }
  686.         else {
  687.             if ($option =~ /^confirm$/i) {
  688.                 if (defined $value) {
  689.                     if ($value =~ /^Yes$/) { $confirm = $value; }
  690.                     elsif ($value =~ /^No$/) { $confirm = $value; }
  691.                     else {
  692.                         print "Value must be 'Yes' or 'No'.\n";
  693.                         $rc = 1;
  694.                         return $rc;
  695.                     }
  696.                 }
  697.                 else { $confirm = $confirm eq "Yes" ? "No" : "Yes"; }
  698.                 print "Commands will " . ($confirm eq "Yes" ? "" : "not ") . "be confirmed.\n";
  699.             }
  700.             elsif ($option =~ /^save$/i) {
  701.                 PPM::SetPPMOptions("options" => \%options, "save" => 1);
  702.                 return $rc;
  703.             }
  704.             elsif ($option =~ /^case$/i) {
  705.                 if (defined $value) {
  706.                     # N.B. These are reversed.
  707.                     if ($value =~ /^Yes$/) { $Ignorecase = "No"; }
  708.                     elsif ($value =~ /^No$/) { $Ignorecase = "Yes"; }
  709.                     else {
  710.                         print "Value must be 'Yes' or 'No'.\n";
  711.                         $rc = 1;
  712.                         return $rc;
  713.                     }
  714.                 }
  715.                 else { $Ignorecase = $Ignorecase eq "Yes" ? "No" : "Yes"; }
  716.                 print "Case-" . ($Ignorecase eq "Yes" ? "in" : "") . "sensitive searches will be performed.\n";
  717.             }
  718.             elsif ($option =~ /^root$/i) {
  719.                 my $old_root;
  720.                 if (!defined $value) {
  721.                     print "Directory not specified.\n";
  722.                     $rc = 1;
  723.                 }
  724.                 elsif(!($old_root = PPM::chroot("location" => $value))) {
  725.                     print "$PPM::PPMERR";
  726.                     $rc = 1;
  727.                 }
  728.                 else {
  729.                     $root = $value;
  730.                     print "Root is now $value [was $old_root].\n";
  731.                 }
  732.             }
  733.             elsif ($option =~ /^build$/i) {
  734.                 if (!defined $value) {
  735.                     print "Directory not specified.\n";
  736.                     $rc = 1;
  737.                 }
  738.                 elsif (-d $value) {
  739.                     $build_dir = $value;
  740.                     print "Build directory is now $value.\n";
  741.                 }
  742.                 else {
  743.                     print "Directory '$value' does not exist.\n";
  744.                     $rc = 1;
  745.                 }
  746.             }
  747.             elsif ($option =~ /^force_install$/i) {
  748.                 if (defined $value) {
  749.                     if ($value =~ /^Yes$/) { $force_install = $value; }
  750.                     elsif ($value =~ /^No$/) { $force_install = $value; }
  751.                     else {
  752.                         print "Value must be 'Yes' or 'No'.\n";
  753.                         $rc = 1;
  754.                         return $rc;
  755.                     }
  756.                 }
  757.                 else { $force_install = $force_install eq "Yes" ? "No" : "Yes"; }
  758.                 print "Package installations will " .
  759.                       ($force_install eq "Yes" ? "" : "not ") .
  760.                       "continue if a dependency cannot be installed.\n";
  761.             }
  762.             elsif ($option =~ /^clean$/i) {
  763.                 if (defined $value) {
  764.                     if ($value =~ /^Yes$/) { $clean = $value; }
  765.                     elsif ($value =~ /^No$/) { $clean = $value; }
  766.                     else {
  767.                         print "Value must be 'Yes' or 'No'.\n";
  768.                         $rc = 1;
  769.                         return $rc;
  770.                     }
  771.                 }
  772.                 else { $clean = $clean eq "Yes" ? "No" : "Yes"; }
  773.                 print "Temporary files will " . ($clean eq "Yes" ? "" : "not ") . "be deleted.\n";
  774.             }
  775.             elsif ($option =~ /^more$/i) {
  776.                 if (defined $value && $value =~ /^\d+$/) {
  777.                     $more = $value;
  778.                 }
  779.                 else {
  780.                     print "Numeric value must be given.\n";
  781.                     $rc = 1;
  782.                     return $rc;
  783.                 }
  784.                 print "Screens will " . ($more > 0 ? "pause after $more lines.\n" : "not pause.\n");
  785.             }
  786.             elsif ($option =~ /^trace$/i) {
  787.                 if (defined $value && $value =~ /^\d+$/ && $value >= 0 && $value <= 4) {
  788.                     $trace = $value;
  789.                 }
  790.                 else {
  791.                     print "Numeric value between 0 and 4 must be given.\n";
  792.                     $rc = 1;
  793.                     return $rc;
  794.                 }
  795.                 print "Tracing info will " . ($trace > 0 ? "be written to $tracefile.\n" : "not be written.\n");
  796.             }
  797.             elsif ($option =~ /^tracefile$/i) {
  798.                 if (!defined $value) {
  799.                     print "Filename not specified.\n";
  800.                     $rc = 1;
  801.                 }
  802.                 $tracefile = $value;
  803.                 print "Tracing info will be written to $tracefile.\n";
  804.             }
  805.             else {
  806.                 print "Unknown option '$option'; see 'help set' for available options.\n";
  807.                 $rc = 1;
  808.             }
  809.             if (!$rc) {
  810.                 PPM::SetPPMOptions("options" => \%options);
  811.             }
  812.         }
  813.     }
  814.     else {
  815.         print "Commands will " . ($confirm eq "Yes" ? "" : "not ") . "be confirmed.\n";
  816.         print "Temporary files will " . ($clean eq "Yes" ? "" : "not ") . "be deleted.\n";
  817.         print "Case-" . ($Ignorecase eq "Yes" ? "in" : "") . "sensitive searches will be performed.\n";
  818.         print "Package installations will " . ($force_install eq "Yes" ? "" : "not ") . "continue if a dependency cannot be installed.\n";
  819.         print "Tracing info will " . (($trace && $trace > 0 )? "be written to '$tracefile'.\n" : "not be written.\n");
  820.         print "Screens will " . ($more > 0 ? "pause after $more lines.\n" : "not pause.\n");
  821.         if (defined $location) { print "Current PPD repository: $location\n"; }
  822.         else {
  823.             print "Current PPD repository paths:\n";
  824.             my $location;
  825.             foreach $_ (keys %repositories) {
  826.                 print "\t$_: $repositories{$_}\n";
  827.             }
  828.         }
  829.         if (defined $root) { print "Packages will be installed under: $root\n"; }
  830.         if (defined $build_dir) { print "Packages will be built under: $build_dir\n"; }
  831.     }
  832.     return $rc;
  833. }
  834.  
  835. sub search_PPDs
  836. {
  837.     my (%argv) = @_;
  838.     my ($arg, $ignorecase, $searchtag, $searchRE, $oldfh);
  839.     local $location = $location;
  840.     foreach $arg (keys %argv) {
  841.         if ($arg eq 'location') { $location = $argv{$arg}; }
  842.         if ($arg eq 'searchtag') { $searchtag = $argv{$arg}; }
  843.         if ($arg eq 'ignorecase') { $ignorecase = $argv{$arg}; }
  844.         if ($arg eq 'searchRE' && defined $argv{$arg}) {
  845.             $searchRE = $argv{$arg};
  846.             eval { $searchRE =~ /$searchRE/ };
  847.             if ($@) {
  848.                 print "'$searchRE': invalid regular expression.\n";
  849.                 return;
  850.             }
  851.         }
  852.     }
  853.     if (!defined $ignorecase) {
  854.         $ignorecase = $Ignorecase;
  855.     }
  856.     my (%ppds, $loc, $package);
  857.     %ppds = PPM::RepositoryPackages("location" => $location);
  858.     my $lines = 1;
  859.     foreach $loc (keys %ppds) {
  860.         if (!defined $searchtag) {
  861.             print "Packages available from $loc:\n";
  862.             $lines++;
  863.             foreach $package (@{$ppds{$loc}}) {
  864.                 if ($interactive && $more && $lines == $more) {
  865.                     print $moremsg;
  866.                     $_ = <>;
  867.                     $lines = 1;
  868.                 }
  869.                 if (defined $searchRE) {
  870.                     if ($ignorecase eq "Yes" && $package =~ /$searchRE/i) {
  871.                         print "\t" . $package . "\n";
  872.                         $lines++;
  873.                     }
  874.                     elsif ($package =~ /$searchRE/) {
  875.                         print "\t" . $package . "\n";
  876.                         $lines++;
  877.                     }
  878.                 }
  879.                 else {
  880.                     print "\t" . $package . "\n";
  881.                     $lines++;
  882.                 }
  883.             }
  884.         }
  885.         else {
  886.             print "Matching packages found at $loc:\n";
  887.             $lines++;
  888.             foreach $package (@{$ppds{$loc}}) {
  889.                 my ($string);
  890.                 if ($string = QueryPPD("package" => $package, "location" => $loc,
  891.                            "ignorecase" => $ignorecase, "searchtag" => $searchtag,
  892.                            "searchRE" => $searchRE)) {
  893.                     print "\t $package: $string\n";
  894.                     if ($interactive && $more && ++$lines == $more) {
  895.                         print $moremsg;
  896.                         $_ = <>;
  897.                         $lines = 1;
  898.                     }
  899.                 }
  900.             }
  901.         }
  902.     }
  903. }
  904.  
  905. sub verify_packages
  906. {
  907.     my (%argv) = @_;
  908.     my ($arg, @packages, $upgrade);
  909.     local $location = $location;
  910.     foreach $arg (keys %argv) {
  911.         if ($arg eq 'packages') { @packages = @{$argv{$arg}}; }
  912.         if ($arg eq 'location') { $location = $argv{$arg}; }
  913.         if ($arg eq 'upgrade') { $upgrade = $argv{$arg}; }
  914.     }
  915.     my ($package);
  916.  
  917.     if (!defined $packages[0]) {
  918.         my ($i, %info);
  919.  
  920.         @packages = ();
  921.         %info = QueryInstalledPackages();
  922.         foreach $i (keys %info) {
  923.             push @packages, $i;
  924.         }
  925.     }
  926.  
  927.     $package = shift @packages;
  928.  
  929.     # for each specified package
  930.     while ($package) {
  931.         my $status = VerifyPackage("package" => $package, "location" => $location, "upgrade" => $upgrade);
  932.         if (defined $status) {
  933.             if ($status eq "0") {
  934.                 print "Package \'$package\' is up to date.\n";
  935.             }
  936.             elsif ($upgrade) {
  937.                 print "Package $package upgraded to version $status\n";
  938.             }
  939.             else {
  940.                 print "An upgrade to package \'$package\' is available.\n";
  941.             }
  942.         }
  943.         else {
  944.             print "Error verifying $package: $PPM::PPMERR\n";
  945.         }
  946.         $package = shift @packages;
  947.     }
  948. }
  949.  
  950. sub genconfig
  951. {
  952. my $PerlDir = $Config{'prefix'};
  953. print <<"EOF";
  954. <PPMCONFIG>
  955.     <PPMVER>1,0,0,0</PPMVER>
  956.     <PLATFORM CPU="x86" OSVALUE="MSWin32" OSVERSION="4,0,0,0" />
  957.     <OPTIONS BUILDDIR="$ENV{'TEMP'}" CLEAN="Yes" CONFIRM="Yes" FORCEINSTALL="Yes" IGNORECASE="No" MORE="0" ROOT="$PerlDir" TRACE="1" TRACEFILE="PPM.LOG" />
  958.     <REPOSITORY LOCATION="http://www.activestate.com/packages/" NAME="ActiveState Package Repository" SUMMARYFILE="package.lst" />
  959.     <PPMPRECIOUS>PPM;Archive-Tar;Compress-Zlib;libwww-perl;XML-Parser;XML-Element;MIME-Base64;HTML-Parser;libwin32</PPMPRECIOUS>
  960.  
  961. <PACKAGE NAME="PPM">
  962. <LOCATION>http://www.activestate.com/packages</LOCATION>
  963. <INSTPACKLIST>$PerlDir/lib/auto/PPM/.packlist</INSTPACKLIST>
  964. <INSTROOT>$PerlDir</INSTROOT>
  965. <INSTDATE>Fri Oct  2 16:14:32 1998</INSTDATE>
  966. <INSTPPD>
  967. <SOFTPKG NAME="PPM" VERSION="0,9,6,0">
  968. <TITLE>PPM</TITLE>
  969. <ABSTRACT>Perl Package Manager: locate, install, upgrade software packages.</ABSTRACT>
  970. <AUTHOR>ActiveState Tool Corp.</AUTHOR>
  971. <IMPLEMENTATION>
  972. <DEPENDENCY NAME="Compress-Zlib" VERSION="" />
  973. <DEPENDENCY NAME="libwww-perl" VERSION="" />
  974. <DEPENDENCY NAME="Archive-Tar" VERSION="" />
  975. <DEPENDENCY NAME="MIME-Base64" VERSION="" />
  976. <DEPENDENCY NAME="XML-Parser" VERSION="" />
  977. <DEPENDENCY NAME="XML-Element" VERSION="" />
  978. <CODEBASE HREF="x86/PPM.tar.gz" />
  979. <INSTALL />
  980. <UNINSTALL />
  981. </IMPLEMENTATION>
  982. </SOFTPKG>
  983. </INSTPPD>
  984. </PACKAGE>
  985.  
  986. <PACKAGE NAME="Archive-Tar">
  987. <LOCATION>http://www.activestate.com/packages</LOCATION>
  988. <INSTPACKLIST>$PerlDir/site/lib/auto/Archive/Tar/.packlist</INSTPACKLIST>
  989. <INSTROOT>$PerlDir</INSTROOT>
  990. <INSTDATE>Fri Oct  2 16:14:37 1998</INSTDATE>
  991. <INSTPPD>
  992. <SOFTPKG NAME="Archive-Tar" VERSION="0,072,0,0">
  993. <TITLE>Archive-Tar</TITLE>
  994. <ABSTRACT>module for manipulation of tar archives.</ABSTRACT>
  995. <AUTHOR>Stephen Zander <gibreel\@pobox.com></AUTHOR>
  996. <IMPLEMENTATION>
  997. <CODEBASE HREF="x86/Archive-Tar.tar.gz" />
  998. <INSTALL />
  999. <UNINSTALL />
  1000. </IMPLEMENTATION>
  1001. </SOFTPKG>
  1002. </INSTPPD>
  1003. </PACKAGE>
  1004.  
  1005. <PACKAGE NAME="MIME-Base64">
  1006. <LOCATION>http://www.ActiveState.com/packages</LOCATION>
  1007. <INSTPACKLIST>$PerlDir/site/lib/auto/MIME/Base64/.packlist</INSTPACKLIST>
  1008. <INSTROOT>$PerlDir</INSTROOT>
  1009. <INSTDATE>Fri Nov 13 14:05:30 1998</INSTDATE>
  1010. <INSTPPD>
  1011. <SOFTPKG NAME="MIME-Base64" VERSION="2,11,0,0">
  1012. <TITLE>MIME-Base64</TITLE>
  1013. <ABSTRACT>Encoding and decoding of base64 strings</ABSTRACT>
  1014. <AUTHOR>Gisle Aas <gisle\@aas.no></AUTHOR>
  1015. <IMPLEMENTATION>
  1016. <CODEBASE HREF="x86/MIME-Base64.tar.gz" />
  1017. <INSTALL />
  1018. <UNINSTALL />
  1019. </IMPLEMENTATION>
  1020. </SOFTPKG>
  1021. </INSTPPD>
  1022. </PACKAGE>
  1023.  
  1024. <PACKAGE NAME="URI">
  1025. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1026. <INSTPACKLIST>$PerlDir/site/lib/auto/URI/.packlist</INSTPACKLIST>
  1027. <INSTROOT>$PerlDir</INSTROOT>
  1028. <INSTDATE>Fri Oct  2 16:15:15 1998</INSTDATE>
  1029. <INSTPPD>
  1030. <SOFTPKG NAME="URI" VERSION="5,42,0,0">
  1031. <TITLE>URI</TITLE>
  1032. <ABSTRACT>Uniform Resource Identifiers (absolute and relative)</ABSTRACT>
  1033. <AUTHOR>Gisle Aas <gisle\@aas.no></AUTHOR>
  1034. <IMPLEMENTATION>
  1035. <DEPENDENCY NAME="MIME-Base64" VERSION="" />
  1036. <CODEBASE HREF="x86/URI.tar.gz" />
  1037. <INSTALL />
  1038. <UNINSTALL />
  1039. </IMPLEMENTATION>
  1040. </SOFTPKG>
  1041. </INSTPPD>
  1042. </PACKAGE>
  1043.  
  1044. <PACKAGE NAME="HTML-Parser">
  1045. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1046. <INSTPACKLIST>$PerlDir/site/lib/auto/HTML/Parser/.packlist</INSTPACKLIST>
  1047. <INSTROOT>$PerlDir</INSTROOT>
  1048. <INSTDATE>Fri Oct  2 16:15:15 1998</INSTDATE>
  1049. <INSTPPD>
  1050. <SOFTPKG NAME="HTML-Parser" VERSION="5,42,0,0">
  1051. <TITLE>HTML-Parser</TITLE>
  1052. <ABSTRACT>SGML parser class</ABSTRACT>
  1053. <AUTHOR>Gisle Aas <gisle\@aas.no></AUTHOR>
  1054. <IMPLEMENTATION>
  1055. <CODEBASE HREF="x86/HTML-Parser.tar.gz" />
  1056. <INSTALL />
  1057. <UNINSTALL />
  1058. </IMPLEMENTATION>
  1059. </SOFTPKG>
  1060. </INSTPPD>
  1061. </PACKAGE>
  1062.  
  1063. <PACKAGE NAME="libwww-perl">
  1064. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1065. <INSTPACKLIST>$PerlDir/site/lib/auto/LWP/.packlist</INSTPACKLIST>
  1066. <INSTROOT>$PerlDir</INSTROOT>
  1067. <INSTDATE>Fri Oct  2 16:15:15 1998</INSTDATE>
  1068. <INSTPPD>
  1069. <SOFTPKG NAME="libwww-perl" VERSION="5,42,0,0">
  1070. <TITLE>libwww-perl</TITLE>
  1071. <ABSTRACT>Library for WWW access in Perl</ABSTRACT>
  1072. <AUTHOR>Gisle Aas  <gisle\@aas.no></AUTHOR>
  1073. <IMPLEMENTATION>
  1074. <DEPENDENCY NAME="URI" VERSION="" />
  1075. <DEPENDENCY NAME="HTML-Parser" VERSION="" />
  1076. <CODEBASE HREF="x86/libwww-perl.tar.gz" />
  1077. <INSTALL />
  1078. <UNINSTALL />
  1079. </IMPLEMENTATION>
  1080. </SOFTPKG>
  1081. </INSTPPD>
  1082. </PACKAGE>
  1083.  
  1084. <PACKAGE NAME="XML-Element">
  1085. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1086. <INSTPACKLIST>$PerlDir/site/lib/auto/XML/Element/.packlist</INSTPACKLIST>
  1087. <INSTROOT>$PerlDir</INSTROOT>
  1088. <INSTDATE>Fri Oct  2 16:16:03 1998</INSTDATE>
  1089. <INSTPPD>
  1090. <SOFTPKG NAME="XML-Element" VERSION="0,10,0,0">
  1091. <TITLE>XML-Element</TITLE>
  1092. <ABSTRACT>Base element class for XML elements</ABSTRACT>
  1093. <AUTHOR>ActiveState Tool Corporation</AUTHOR>
  1094. <IMPLEMENTATION>
  1095. <DEPENDENCY NAME="XML-Parser" VERSION="" />
  1096. <CODEBASE HREF="x86/XML-Element.tar.gz" />
  1097. <INSTALL />
  1098. <UNINSTALL />
  1099. </IMPLEMENTATION>
  1100. </SOFTPKG>
  1101. </INSTPPD>
  1102. </PACKAGE>
  1103.  
  1104. <PACKAGE NAME="XML-Parser">
  1105. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1106. <INSTPACKLIST>$PerlDir/site/lib/auto/XML/Parser/.packlist</INSTPACKLIST>
  1107. <INSTROOT>$PerlDir</INSTROOT>
  1108. <INSTDATE>Fri Oct  2 16:16:03 1998</INSTDATE>
  1109. <INSTPPD>
  1110. <SOFTPKG NAME="XML-Parser" VERSION="2,22,0,0">
  1111. <TITLE>XML-Parser</TITLE>
  1112. <ABSTRACT>A Perl module for parsing XML documents</ABSTRACT>
  1113. <AUTHOR>Clark Cooper <coopercl\@sch.ge.com></AUTHOR>
  1114. <IMPLEMENTATION>
  1115. <CODEBASE HREF="x86/XML-Parser.tar.gz" />
  1116. <INSTALL />
  1117. <UNINSTALL />
  1118. </IMPLEMENTATION>
  1119. </SOFTPKG>
  1120. </INSTPPD>
  1121. </PACKAGE>
  1122.  
  1123. <PACKAGE NAME="Compress-Zlib">
  1124. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1125. <INSTPACKLIST>$PerlDir/site/lib/auto/Compress/Zlib/.packlist</INSTPACKLIST>
  1126. <INSTROOT>$PerlDir</INSTROOT>
  1127. <INSTDATE>Fri Oct  2 16:16:03 1998</INSTDATE>
  1128. <INSTPPD>
  1129. <SOFTPKG NAME="Compress-Zlib" VERSION="1,03,0,0">
  1130. <TITLE>Compress-Zlib</TITLE>
  1131. <ABSTRACT>Interface to zlib compression library</ABSTRACT>
  1132. <AUTHOR>Paul Marquess <pmarquess\@bfsec.bt.co.uk></AUTHOR>
  1133. <IMPLEMENTATION>
  1134. <CODEBASE HREF="x86/Compress-Zlib.tar.gz" />
  1135. <INSTALL />
  1136. <UNINSTALL />
  1137. </IMPLEMENTATION>
  1138. </SOFTPKG>
  1139. </INSTPPD>
  1140. </PACKAGE>
  1141.  
  1142. <PACKAGE NAME="libwin32">
  1143. <LOCATION>http://www.activestate.com/packages</LOCATION>
  1144. <INSTPACKLIST>$PerlDir/site/lib/auto/Win32/.packlist</INSTPACKLIST>
  1145. <INSTROOT>$PerlDir</INSTROOT>
  1146. <INSTDATE>Fri Oct  2 16:16:03 1998</INSTDATE>
  1147. <INSTPPD>
  1148. <SOFTPKG NAME="libwin32" VERSION="0,14,1,0">
  1149. <TITLE>libwin32</TITLE>
  1150. <ABSTRACT>Win32-only extensions that provides a quick migration path for people wanting to use the core support for win32 in perl 5.004 and later.</ABSTRACT>
  1151. <AUTHOR>Gurusamy Sarathy <gsar\@umich.edu></AUTHOR>
  1152. <IMPLEMENTATION>
  1153. <CODEBASE HREF="x86/libwin32.tar.gz" />
  1154. <INSTALL />
  1155. <UNINSTALL />
  1156. </IMPLEMENTATION>
  1157. </SOFTPKG>
  1158. </INSTPPD>
  1159. </PACKAGE>
  1160.  
  1161. </PPMCONFIG>
  1162. EOF
  1163. }
  1164.  
  1165. __END__
  1166.  
  1167. =head1 NAME
  1168.  
  1169. PPM - Perl Package Manager: locate, install, upgrade software packages.
  1170.  
  1171. =head1 SYNOPSIS
  1172.  
  1173.  ppm genconfig
  1174.  ppm help [command]
  1175.  ppm info [package1 .. packageN]
  1176.  ppm install [--location=location] package1 [... packageN]
  1177.  ppm query [--case|nocase] [--searchtag=abstract|author|title] PATTERN
  1178.  ppm remove package1 [... packageN]
  1179.  ppm search [--case|nocase] [--location=location] [--searchtag=abstract|author|title] PATTERN
  1180.  ppm set [option]
  1181.  ppm summary [--location=location] package1 [... packageN]
  1182.  ppm verify [--location=location] [--upgrade] [package1 ... packageN]
  1183.  ppm version
  1184.  ppm [--location=location]
  1185.  
  1186. =head1 DESCRIPTION
  1187.  
  1188. ppm is a utility intended to simplify the tasks of locating, installing,
  1189. upgrading and removing software packages.  It is a front-end to the
  1190. functionality provided in PPM.pm.  It can determine if the most recent
  1191. version of a software package is installed on a system, and can install
  1192. or upgrade that package from a local or remote host.
  1193.  
  1194. ppm runs in one of two modes: an interactive shell from which commands
  1195. may be entered; and command-line mode, in which one specific action is
  1196. performed per invocation of the program.
  1197.  
  1198. ppm uses files containing an extended form of the Open Software
  1199. Description (OSD) specification for information about software packages.
  1200. These description files, which are written in Extensible Markup
  1201. Language (XML) code, are referred to as 'PPD' files.  Information about
  1202. OSD can be found at the W3C web site (at the time of this writing,
  1203. http://www.w3.org/TR/NOTE-OSD.html).  The extensions to OSD used by ppm
  1204. are documented in PPM.ppd.
  1205.  
  1206. =head1 COMMAND-LINE MODE
  1207.  
  1208. =over 4
  1209.  
  1210. =item Installing
  1211.  
  1212. ppm install [--location=location] package1 [... packageN]
  1213.  
  1214. Reads information from the PPD file (See the 'Files' section
  1215. below) for the named software package and performs an
  1216. installation.  The 'package' arguments may be either package
  1217. names ('foo'), or pathnames (P:\PACKAGES\FOO.PPD) or URLs
  1218. (HTTP://www.ActiveState.com/packages/foo.ppd) to specific PPD files.
  1219.  
  1220. In the case where a package name is specified, and the '--location'
  1221. option is not used, the function will refer to repository locations stored
  1222. in the PPM data file (see 'Files' section below) to locate the PPD file
  1223. for the requested package.
  1224.  
  1225. =item Removing
  1226.  
  1227. ppm remove package1 [... packageN]
  1228.  
  1229. Reads information from the PPD file for the named software package and
  1230. removes the package from the system.
  1231.  
  1232. =item Verifying
  1233.  
  1234. ppm verify [--location=location] [--upgrade] [package1 ... packageN]
  1235.  
  1236. Reads a PPD file for the specified package and compares the currently
  1237. installed version of the package to the version available according to
  1238. the PPD.  The PPD file is expected to be on a local directory or remote
  1239. site specified either in the PPM data file or on the command
  1240. line using the '--location' option.  The --location' argument may be
  1241. a directory location or an Internet address.  The '--upgrade' option
  1242. forces an upgrade if the installed package is not up-to-date.
  1243.  
  1244. If no packages are specified, all packages currently installed on the
  1245. system will be verified (and updated if desired).  The PPD file for each
  1246. package will initially be searched for at the location specified with the
  1247. '--location' argument, and if not found will then be searched for using
  1248. the location specified in the PPM data file.
  1249.  
  1250. =item Querying
  1251.  
  1252. ppm query [--case|nocase] PATTERN
  1253.  
  1254. Reports currently installed packages matching 'PATTERN' or all installed
  1255. packages if no 'PATTERN' is specified.
  1256.  
  1257. ppm query [--case|nocase] [--searchtag=abstract|author|title] PATTERN
  1258.  
  1259. Searches for 'PATTERN' (a regular expression) in the <ABSTRACT>, <AUTHOR>
  1260. or <TITLE> tags of all installed packages, according to the value of
  1261. the '--searchtag' option.  If a '--searchtag' value of 'abstract',
  1262. 'author' or 'title' is not provided, any occurence of 'PATTERN' in the
  1263. package name will match successfully.  A case-sensitive search will be
  1264. conducted by default, but this may be overridden by the options set in
  1265. the PPM data file, which may in turn be overridden by the '--nocase' or
  1266. '--case' option.  If a search is successful, the name of the package
  1267. and the matching string are displayed.
  1268.  
  1269. ppm info [packages]
  1270.  
  1271. Prints a summary (name, version and abstract) of the specified installed 
  1272. package, or all installed packages if no package is specified.
  1273.  
  1274. =item Searching
  1275.  
  1276. ppm search [--case|nocase] [--location=location] PATTERN
  1277.  
  1278. Displays a list of all packages matching 'PATTERN', with package
  1279. description (PPD) files available at the specified location.  'location'
  1280. may be either a remote address or a directory path.  If a location is
  1281. not specified, the repository location as specified in the PPM data file
  1282. will be used.
  1283.  
  1284. ppm search [--case|nocase] [--location=location] [--searchtag=abstract|author|title] PATTERN
  1285.  
  1286. Searches for 'PATTERN' (a regular expression) in the <ABSTRACT>, <AUTHOR>
  1287. or <TITLE> tags of all PPD files at 'location', according to the value
  1288. of the '--searchtag' option.  If a '--searchtag' value of 'abstract',
  1289. 'author' or 'title' is not provided, any occurence of 'PATTERN' in
  1290. the package name will match successfully.  'location' may be either a
  1291. remote address or a directory path, and if it is not provided, repository
  1292. locations specified in the PPM data file will be used.  A case-sensitive
  1293. search will be conducted by default, but this may be overridden by the
  1294. options set in the PPM data file, which may in turn be overridden by the
  1295. '--nocase' or '--case' option.  If a search is successful, the name of
  1296. the package and the matching string are displayed.
  1297.  
  1298. =item Summarizing
  1299.  
  1300. ppm summary [--location=location] [package1 ... packageN]
  1301.  
  1302. Prints a summary (name, version and abstract) of the specified packages.
  1303. If no package is specified, a complete summary of all packages available 
  1304. at a repository will be displayed (if available).
  1305.  
  1306. =item Error Recovery
  1307.  
  1308. ppm genconfig
  1309.  
  1310. This command will print a valid PPM config file (ppm.xml) to STDOUT.  This 
  1311. can be useful if the PPM config file ever gets damaged leaving PPM
  1312. unusable.
  1313.  
  1314. =back
  1315.  
  1316. =head1 INTERACTIVE MODE
  1317.  
  1318. If ppm is invoked with no command specified, it is started in interactive
  1319. mode.  If the '--location' argument is specified, it is used as the
  1320. search location, otherwise the repositories specified in the PPM data file are 
  1321. used. The available commands, which may be displayed at any time by entering
  1322. 'help', are:
  1323.  
  1324.     exit
  1325.         - Exits the program.
  1326.  
  1327.     help [command]
  1328.         - Prints a screen of available commands, or help on a specific command.
  1329.  
  1330.     info PACKAGES
  1331.  
  1332.         - Prints a summary (name, version and abstract) of the specified
  1333.           installed packages, or all installed packages if no package is 
  1334.           specified.
  1335.  
  1336.     install [/location LOCATION] PACKAGES
  1337.         - Installs the specified software PACKAGES.  Attempts to install
  1338.           from the URL or directory 'LOCATION' if the '/location' option
  1339.           is specfied.  See 'Installing' in the 'Command-line mode' 
  1340.           section for details.  See also: 'confirm' option.
  1341.  
  1342.     query [options] PATTERN
  1343.         - Queries information about currently installed packages.
  1344.  
  1345.         Available options:
  1346.         /abstract PATTERN
  1347.             - Searches for the regular expression 'PATTERN' in the 'abstract' section
  1348.               of all installed packages.  See also: 'case' option.
  1349.         /author PATTERN
  1350.             - Searches for the regular expression 'PATTERN' in the 'author' section
  1351.               of all installed packages.  See also: 'case' option.
  1352.         /title PATTERN
  1353.             - Searches for the regular expression 'PATTERN' in the 'title' section
  1354.               of all installed packages.  See also: 'case' option.
  1355.  
  1356.     remove PACKAGES
  1357.         - Removes the specified 'PACKAGES'.  See 'Removing' in the 'Command-line 
  1358.           mode' section for details.  See also: 'confirm' option.
  1359.  
  1360.     search [options] PATTERN
  1361.         - Searches for information about available packages.
  1362.  
  1363.         Available options:
  1364.         /abstract PATTERN
  1365.             - Searches for the regular expression 'PATTERN' in the 'abstract' section
  1366.               of all available PPD files.  See also: 'case' option.
  1367.         /author PATTERN
  1368.             - Searches for the regular expression 'PATTERN' in the 'author' section
  1369.               of all available PPD files.  See also: 'case' option.
  1370.         /title PATTERN
  1371.             - Searches for the regular expression 'PATTERN' in the 'title' section
  1372.               of all available PPD files.  See also: 'case' option.
  1373.         /location LOCATION
  1374.             - Searches for packages available from the URL or directory
  1375.               'LOCATION'.
  1376.  
  1377.     summary [options] PACKAGES
  1378.         - Prints a summary (name, version and abstract) of the specified 
  1379.           packages.  If 'PACKAGES' is not specified, a complete summary of 
  1380.           all packages available at a repository will be displayed (if
  1381.           available).
  1382.  
  1383.         /location LOCATION
  1384.             - Prints a summary of all packages available from the URL or 
  1385.               directory 'LOCATION'.
  1386.  
  1387.     set [option value]
  1388.         - Sets or displays current options.  With no arguments, options are
  1389.           displayed.
  1390.  
  1391.           Available options:
  1392.               build DIRECTORY
  1393.                   - Changes the package build directory.
  1394.               case [Yes|No]
  1395.                   - Sets case-sensitive searches.  If one of 'Yes' or 'No is
  1396.                     not specified, the current setting is toggled.
  1397.               clean [Yes|No]
  1398.                   - Sets removal of temporary files from package's build 
  1399.                     area, on successful installation of a package.  If one of
  1400.                     'Yes' or 'No is not specified, the current setting is
  1401.                     toggled.
  1402.               confirm [Yes|No]
  1403.                   - Sets confirmation of 'install', 'remove' and 'upgrade'.
  1404.                     If one of 'Yes' or 'No is not specified, the current
  1405.                     setting is toggled.
  1406.               force_install [Yes|No]
  1407.                   - Continue installing a package even if a dependency cannot
  1408.                     be installed.
  1409.               more NUMBER
  1410.                   - Causes output to pause after NUMBER lines have been
  1411.                     displayed.  Specifying '0' turns off this capability.
  1412.               set repository /remove NAME
  1413.                   - Removes the repository 'NAME' from the list of repositories.
  1414.               set repository NAME LOCATION
  1415.                   - Adds a repository to the list of PPD repositories for this
  1416.                     session.  'NAME' is the name by which this repository will
  1417.                     be referred; 'LOCATION' is a URL or directory name.
  1418.               root DIRECTORY
  1419.                   - Changes the install root directory.  Packages will be
  1420.                     installed under this new root.
  1421.               save
  1422.                   - Saves the current options as default options for future
  1423.                     sessions.
  1424.               trace
  1425.                   - Tracing level--default is 1, maximum is 4, 0 indicates
  1426.                     no tracing.
  1427.               tracefile
  1428.                   - File to contain tracing information, default is 'PPM.LOG'.
  1429.  
  1430.     quit
  1431.         - Exits the program.
  1432.  
  1433.     verify [/upgrade] [/location LOCATION] PACKAGE
  1434.         - Verifies that currently installed 'PACKAGE' is up to date.  If
  1435.           'PACKAGE' is not specified, all installed packages are verified.  If
  1436.           the /upgrade option is specified, any out-dated packages will be
  1437.           upgraded.  If the /location option is specified, upgrades will
  1438.           be looked for at the URL or directory 'LOCATION'.  See also: 'confirm'
  1439.           option.
  1440.  
  1441. =over 4
  1442.  
  1443. =back
  1444.  
  1445. =head1 EXAMPLES
  1446.  
  1447. =over 4
  1448.  
  1449. =item ppm
  1450.  
  1451. Starts ppm in interactive mode, using the repository locations specified
  1452. in the PPM data file.  A session might look like this:
  1453.  
  1454.     [show all available packages]
  1455.     PPM> search
  1456.     Packages available from P:\PACKAGES:
  1457.             bar
  1458.             bax
  1459.             baz
  1460.             foo
  1461.     [list what has already been installed]
  1462.     PPM> query
  1463.             bax
  1464.             baz
  1465.     [install a package]
  1466.     PPM> install foo
  1467.     Install package foo? (y/N): y
  1468.     [...]
  1469.     [toggle confirmations]
  1470.     PPM> set confirm
  1471.     Commands will not be confirmed.
  1472.     [see if 'baz' is up-to-date]
  1473.     PPM> verify baz
  1474.     An upgrade to package 'baz' is available.
  1475.     [upgrade 'baz']
  1476.     PPM> verify /upgrade baz
  1477.     [...]
  1478.     [toggle case-sensitive searches]
  1479.     PPM> set case
  1480.     Case-sensitive searches will be performed.
  1481.     [display the abstract for all available packages]
  1482.     PPM> query /abstract
  1483.             bar: Bars foos
  1484.             baz: Tool for bazing and cleaning BAZs.
  1485.             [...]
  1486.     [search for packages containing a certain regex in the /ABSTRACT tag]
  1487.     PPM> query /abstract clean.*baz
  1488.     Matching packages found at P:\PACKAGES:
  1489.              baz: Tool for bazing and cleaning BAZs.
  1490.     [find what version of 'bax' is available]
  1491.     PPM> summary bax
  1492.     Bax [1.014]:   Bax implementation 
  1493.     [see what version of 'bax' is installed]
  1494.     PPM> info bax
  1495.     Bax [1.014]:   Bax implementation 
  1496.     PPM> quit
  1497.  
  1498. =item ppm install http://www.ActiveState.com/packages/foo.ppd
  1499.  
  1500. Installs the software package 'foo' based on the information in the PPD
  1501. obtained from the specified URL.
  1502.  
  1503. =item ppm verify --upgrade foo
  1504.  
  1505. Compares the currently installed version of the software package 'foo'
  1506. to the one available according to the PPD obtained from the location
  1507. specified for this package in the PPM data file, and upgrades
  1508. to a newer version if available.
  1509.  
  1510. =item ppm verify --location=P:\PACKAGES --upgrade foo
  1511.  
  1512. Compares the currently installed version of the software package 'foo'
  1513. to the one available according to the PPD obtained from the specified
  1514. directory, and upgrades to a newer version if available.
  1515.  
  1516. =item ppm verify --upgrade
  1517.  
  1518. Verifies and updates every installed package on the system, using upgrade
  1519. locations specified in the PPM data file.
  1520.  
  1521. =item ppm search --location=http://www.ActiveState.com/packages
  1522.  
  1523. Displays the packages with PPD files available at the specified location.
  1524.  
  1525. =item ppm search --location=P:\PACKAGES --searchtag=author ActiveState
  1526.  
  1527. Searches the specified location for any package with an <AUTHOR> tag
  1528. containing the string 'ActiveState'.  On a successful search, the package
  1529. name and the matching string are displayed.
  1530.  
  1531. =back
  1532.  
  1533. =head1 ENVIRONMENT VARIABLES
  1534.  
  1535. =over 4
  1536.  
  1537. =item HTTP_proxy
  1538.  
  1539. If the environment variable 'HTTP_proxy' is set, then it will
  1540. be used as the address of a proxy server for accessing the Internet.
  1541.  
  1542. The value should be of the form: 'http://proxy:port'.
  1543.  
  1544. =back
  1545.  
  1546. =head1 FILES
  1547.  
  1548. These files are fully described in the 'Files' section of PPM:ppm.
  1549.  
  1550. =over 4
  1551.  
  1552. =item package.ppd
  1553.  
  1554. A description of a software package, in extended Open Software Description
  1555. (OSD) format.  More information on this file format can be found in
  1556. PPM::ppd.
  1557.  
  1558. =item ppm.xml - PPM data file.
  1559.  
  1560. This file is specified using the environment variable 'PPM_DAT';  if this
  1561. is not set, the file 'ppm.xml' is expected to be located in the same 
  1562. directory as this script.
  1563.  
  1564. An XML format file containing information about the local system,
  1565. specifics regarding the locations from which PPM obtains PPD files, and
  1566. the installation details for any package installed by ppm.
  1567.  
  1568. =back
  1569.  
  1570. =head1 AUTHOR
  1571.  
  1572. Murray Nesbitt, E<lt>F<murray@activestate.com>E<gt>
  1573.  
  1574. =cut
  1575.  
  1576.