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.

1575 lines
54 KiB

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