Leaked source code of windows server 2003
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.

425 lines
14 KiB

  1. #
  2. # PPM::XML::PPMConfig
  3. #
  4. # Definition of the PPMConfig file format; configuration options for the Perl
  5. # Package Manager.
  6. #
  7. ###############################################################################
  8. $PPM::XML::PPMConfig::revision = '$Id: PPMConfig.pm,v 1.1.1.1 2000/01/26 17:39:19 graham Exp $';
  9. $PPM::XML::PPMConfig::VERSION = '0.01';
  10. ###############################################################################
  11. # Import everything from PPM::XML::PPD into our own namespace.
  12. ###############################################################################
  13. package PPM::XML::PPMConfig;
  14. use PPM::XML::PPD ':elements';
  15. ###############################################################################
  16. # PPMConfig Element: Characters
  17. ###############################################################################
  18. package PPM::XML::PPMConfig::Characters;
  19. @ISA = qw( PPM::XML::Element );
  20. ###############################################################################
  21. # PPMConfig Element: PPMCONFIG
  22. ###############################################################################
  23. package PPM::XML::PPMConfig::PPMCONFIG;
  24. @ISA = qw( PPM::XML::ValidatingElement );
  25. @okids = qw( PPMVER PLATFORM REPOSITORY OPTIONS PPMPRECIOUS PACKAGE );
  26. ###############################################################################
  27. # PPMConfig Element: PPMVER
  28. ###############################################################################
  29. package PPM::XML::PPMConfig::PPMVER;
  30. @ISA = qw( PPM::XML::ValidatingElement );
  31. ###############################################################################
  32. # PPMConfig Element: PLATFORM
  33. ###############################################################################
  34. package PPM::XML::PPMConfig::PLATFORM;
  35. @ISA = qw( PPM::XML::ValidatingElement );
  36. @oattrs = qw( LANGUAGE );
  37. @rattrs = qw( OSVALUE OSVERSION CPU );
  38. ###############################################################################
  39. # PPMConfig Element: REPOSITORY
  40. ###############################################################################
  41. package PPM::XML::PPMConfig::REPOSITORY;
  42. @ISA = qw( PPM::XML::ValidatingElement );
  43. @oattrs = qw( USERNAME PASSWORD SUMMARYFILE);
  44. @rattrs = qw( NAME LOCATION );
  45. ###############################################################################
  46. # PPMConfig Element: OPTIONS
  47. ###############################################################################
  48. package PPM::XML::PPMConfig::OPTIONS;
  49. @ISA = qw( PPM::XML::ValidatingElement );
  50. @rattrs = qw( IGNORECASE CLEAN CONFIRM FORCEINSTALL ROOT BUILDDIR MORE );
  51. @oattrs = qw( TRACE TRACEFILE VERBOSE DOWNLOADSTATUS );
  52. ###############################################################################
  53. # PPMConfig Element: PPMPRECIOUS
  54. ###############################################################################
  55. package PPM::XML::PPMConfig::PPMPRECIOUS;
  56. @ISA = qw( PPM::XML::ValidatingElement );
  57. ###############################################################################
  58. # PPMConfig Element: PACKAGE
  59. ###############################################################################
  60. package PPM::XML::PPMConfig::PACKAGE;
  61. @ISA = qw( PPM::XML::ValidatingElement );
  62. @okids = qw( LOCATION INSTDATE INSTROOT INSTPACKLIST INSTPPD );
  63. @rattrs = qw( NAME );
  64. ###############################################################################
  65. # PPMConfig Element: LOCATION
  66. ###############################################################################
  67. package PPM::XML::PPMConfig::LOCATION;
  68. @ISA = qw( PPM::XML::ValidatingElement );
  69. ###############################################################################
  70. # PPMConfig Element: INSTDATE
  71. ###############################################################################
  72. package PPM::XML::PPMConfig::INSTDATE;
  73. @ISA = qw( PPM::XML::ValidatingElement );
  74. ###############################################################################
  75. # PPMConfig Element: INSTROOT
  76. ###############################################################################
  77. package PPM::XML::PPMConfig::INSTROOT;
  78. @ISA = qw( PPM::XML::ValidatingElement );
  79. ###############################################################################
  80. # PPMConfig Element: INSTPACKLIST
  81. ###############################################################################
  82. package PPM::XML::PPMConfig::INSTPACKLIST;
  83. @ISA = qw( PPM::XML::ValidatingElement );
  84. ###############################################################################
  85. # PPMConfig Element: INSTPPD
  86. ###############################################################################
  87. package PPM::XML::PPMConfig::INSTPPD;
  88. @ISA = qw( PPM::XML::ValidatingElement );
  89. @okids = qw( SOFTPKG ); # Allow for an PPM::XML::PPD::SOFTPKG
  90. __END__
  91. ###############################################################################
  92. # POD
  93. ###############################################################################
  94. =head1 NAME
  95. PPM::XML::PPMConfig - PPMConfig file format and XML parsing elements
  96. =head1 SYNOPSIS
  97. use XML::Parser;
  98. use PPM::XML::PPMConfig;
  99. $p = new PPM::XML::Parser( Style => 'Objects', Pkg => 'PPM::XML::PPMConfig' );
  100. ...
  101. =head1 DESCRIPTION
  102. This module provides a set of classes for parsing PPM configuration files
  103. using the C<XML::Parser> module. All of the elements unique to a PPM
  104. configuration file are derived from C<PPM::XML::ValidatingElement>.
  105. There are also several classes rebuilt here which are derived from
  106. elements in C<PPM::XML::PPD> as we can include a PPD file within our own
  107. INSTPPD element.
  108. =head1 MAJOR ELEMENTS
  109. =head2 PPMCONFIG
  110. Defines a PPM configuration file. The root of a PPMConfig document is
  111. B<always> a PPMCONFIG element.
  112. =head2 PACKAGE
  113. Child of PPMCONFIG, used to describe a Perl Package which has already been
  114. installed. Multiple instances are valid. The PACKAGE element allows for the
  115. following attributes:
  116. =over 4
  117. =item NAME
  118. Name of the package as given in it's PPD
  119. =back
  120. =head1 MINOR ELEMENTS
  121. =head2 PPMVER
  122. Child of PPMCONFIG, used to state the version of PPM for which this
  123. configuration file is valid. A single instance should be present.
  124. =head2 PLATFORM
  125. Child of PPMCONFIG, used to specify the platform of the target machine. A
  126. single instance should be present. The PLATFORM element allows for the
  127. following attributes:
  128. =over 4
  129. =item OSVALUE
  130. Description of the local operating system as defined in the Config.pm file
  131. under 'osname'.
  132. =item OSVERSION
  133. Version of the local operating system.
  134. =item CPU
  135. Description of the CPU in the local system. The following list of possible
  136. values was taken from the OSD Specification:
  137. x86 mips alpha ppc sparc 680x0
  138. =item LANGUAGE
  139. Description of the language used on the local system as specified by the
  140. language codes in ISO 639.
  141. =back
  142. =head2 REPOSITORY
  143. Child of PPMCONFIG, used to specify a repository where Perl Packages can be
  144. found. Multiple instances are valid. The REPOSITORY element allows for the
  145. following attributes:
  146. =over 4
  147. =item NAME
  148. Name by which the repository will be known (e.g. "ActiveState").
  149. =item LOCATION
  150. An URL or directory where the repository can be found.
  151. =item USERNAME
  152. Optional username for a repository requiring authenticated connection.
  153. =item PASSWORD
  154. Optional password for a repository requiring authenticated connection.
  155. =item SUMMARYFILE
  156. Optional package summary filename.
  157. If this file exists on the repository, its contents can be retrieved
  158. using PPM::RepositorySummary(). The contents are not strictly enforced
  159. by PPM.pm, however ppm expects this to be a file with the following
  160. format (for display with the 'summary' command):
  161. Agent [2.91]: supplies agentspace methods for perl5.
  162. Apache-OutputChain [0.06]: chain stacked Perl handlers
  163. [etc.]
  164. =back
  165. =head2 OPTIONS
  166. Child of PPMCONFIG, used to specify the current configuration options for PPM.
  167. A single instance should be present. The OPTIONS element allows for the
  168. following attributes:
  169. =over 4
  170. =item IGNORECASE
  171. Sets case-sensitive searching. Can be either '1' or '0'.
  172. =item CLEAN
  173. Sets removal of temporarily files. Can be either '1' or '0'.
  174. =item CONFIRM
  175. Sets confirmation of all installs/removals/upgrades. Can be either '1' or
  176. '0'.
  177. =item BUILDDIR
  178. Directory in which packages will be unpacked before their installation.
  179. =item ROOT
  180. Directory under which packages should be installed on the local system.
  181. =item TRACE
  182. Level of tracing (0 is no tracing, 4 is max tracing).
  183. =item TRACEFILE
  184. File to which trace information will be written.
  185. =item VERBOSE
  186. Controls whether query and search results are verbose (1 == verbose, 0 == no).
  187. =back
  188. =head2 PPMPRECIOUS
  189. Child of PPMCONFIG, used to specify the modules which PPM itself is dependant
  190. upon. A single instance should be present.
  191. =head2 LOCATION
  192. Child of PACKAGE, used to specify locations at which to search for updated
  193. versions of the PPD file for this package. Its value can be either a
  194. directory or an Internet address. A single instance should be present.
  195. =head2 INSTDATE
  196. Child of PACKAGE, used to specify the date on which the Perl Package was
  197. installed. A single instance should be present.
  198. =head2 INSTROOT
  199. Child of PACKAGE, used to specify the root directory that the Perl Package was
  200. installed into. A single instance should be present.
  201. =head2 INSTPACKLIST
  202. Child of PACKAGE, used to specify a reference to the packlist for this Perl
  203. Package; a file containing a list of all of the files which were installed. A
  204. single instance should be present.
  205. =head2 INSTPPD
  206. Child of PACKAGE, used to hold a copy of the PPD from which Perl Packages
  207. were installed. Multiple instances are valid.
  208. =head1 DOCUMENT TYPE DEFINITION
  209. The DTD for PPMConfig documents is available from the ActiveState website and
  210. the latest version can be found at:
  211. http://www.ActiveState.com/PPM/DTD/ppmconfig.dtd
  212. This revision of the C<PPM::XML::PPMConfig> module implements the following DTD:
  213. <!ELEMENT PPMCONFIG (PPMVER | PLATFORM | REPOSITORY | OPTIONS |
  214. PPMPRECIOUS | PACKAGE)*>
  215. <!ELEMENT PPMVER (#PCDATA)>
  216. <!ELEMENT PLATFORM EMPTY>
  217. <!ATTLIST PLATFORM OSVALUE CDATA #REQUIRED
  218. OSVERSION CDATA #REQUIRED
  219. CPU CDATA #REQUIRED
  220. LANGUAGE CDATA #IMPLIED>
  221. <!ELEMENT REPOSITORY EMPTY>
  222. <!ATTLIST REPOSITORY NAME CDATA #REQUIRED
  223. LOCATION CDATA #REQUIRED
  224. USERNAME CDATA #IMPLIED
  225. PASSWORD CDATA #IMPLIED
  226. SUMMARYFILE CDATA #IMPLIED>
  227. <!ELEMENT OPTIONS EMPTY>
  228. <!ATTLIST OPTIONS IGNORECASE CDATA #REQUIRED
  229. CLEAN CDATA #REQUIRED
  230. CONFIRM CDATA #REQUIRED
  231. FORCEINSTALL CDATA #REQUIRED
  232. ROOT CDATA #REQUIRED
  233. BUILDDIR CDATA #REQUIRED
  234. MORE CDATA #REQUIRED
  235. DOWNLOADSTATUS CDATA #IMPLIED
  236. TRACE CDATA #IMPLIED
  237. TRACEFILE CDATA #IMPLIED>
  238. <!ELEMENT PPMPRECIOUS (#PCDATA)>
  239. <!ELEMENT PACKAGE (LOCATION | INSTDATE | INSTROOT | INSTPACKLIST |
  240. INSTPPD)*>
  241. <!ATTLIST PACKAGE NAME CDATA #REQUIRED>
  242. <!ELEMENT LOCATION (#PCDATA)>
  243. <!ELEMENT INSTDATE (#PCDATA)>
  244. <!ELEMENT INSTROOT (#PCDATA)>
  245. <!ELEMENT INSTPACKLIST (#PCDATA)>
  246. <!ELEMENT INSTPPD (#PCDATA)>
  247. =head1 SAMPLE PPMConfig FILE
  248. The following is a sample PPMConfig file. Note that this may B<not> be a
  249. current description of this module and is for sample purposes only.
  250. <PPMCONFIG>
  251. <PPMVER>1,0,0,0</PPMVER>
  252. <PLATFORM CPU="x86" OSVALUE="MSWin32" OSVERSION="4,0,0,0" />
  253. <OPTIONS BUILDDIR="/tmp" CLEAN="1" CONFIRM="1" FORCEINSTALL="1"
  254. IGNORECASE="0" MORE="0" ROOT="/usr/local" TRACE="0" TRACEFILE="" DOWNLOADSTATUS="16384" />
  255. <REPOSITORY LOCATION="http://www.ActiveState.com/packages"
  256. NAME="ActiveState Package Repository" SUMMARYFILE="package.lst" />
  257. <PPMPRECIOUS>PPM;libnet;Archive-Tar;Compress-Zlib;libwww-perl</PPMPRECIOUS>
  258. <PACKAGE NAME="AtExit">
  259. <LOCATION>g:/packages</LOCATION>
  260. <INSTPACKLIST>c:/perllib/lib/site/MSWin32-x86/auto/AtExit/.packlist</INSTPACKLIST>
  261. <INSTROOT>c:/perllib</INSTROOT>
  262. <INSTDATE>Sun Mar 8 02:56:31 1998</INSTDATE>
  263. <INSTPPD>
  264. <SOFTPKG NAME="AtExit" VERSION="1,02,0,0">
  265. <TITLE>AtExit</TITLE>
  266. <ABSTRACT>Register a subroutine to be invoked at program -exit time.</ABSTRACT>
  267. <AUTHOR>Brad Appleton (Brad_Appleton-GBDA001@email.mot.com)</AUTHOR>
  268. <IMPLEMENTATION>
  269. <CODEBASE HREF="x86/AtExit.tar.gz" />
  270. </IMPLEMENTATION>
  271. </SOFTPKG>
  272. </INSTPPD>
  273. </PACKAGE>
  274. </PPMCONFIG>
  275. =head1 KNOWN BUGS/ISSUES
  276. Elements which are required to be empty (e.g. REPOSITORY) are not enforced as
  277. such.
  278. Notations above about elements for which "only one instance" or "multiple
  279. instances" are valid are not enforced; this primarily a guideline for
  280. generating your own PPD files.
  281. Currently, this module creates new classes within it's own namespace for all of
  282. the PPD elements which can be contained within the INSTPPD element. A suitable
  283. method for importing the entire PPM::XML::PPD:: namespace should be found
  284. in order to make this cleaner.
  285. =head1 AUTHORS
  286. Graham TerMarsch <[email protected]>
  287. Murray Nesbitt <[email protected]>
  288. Dick Hardt <[email protected]>
  289. =head1 HISTORY
  290. v0.1 - Initial release
  291. =head1 SEE ALSO
  292. L<PPM::XML::ValidatingElement>,
  293. L<XML::Parser>,
  294. L<PPM::XML::PPD>
  295. .
  296. =cut