Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1589 lines
55 KiB

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