|
NAMEVCP::Maintenance - VCP code maintenance tips & tricksSYNOPSISVCPNODELETE=yes bin/hexdump.pl vcp revml: --dtd <dtd file name> --save_dtd <how> DESCRIPTIONThe distribution hierarchyAs untarred, the distribution hierarchy looks like (some files not shown for brevity):VCP-x.yy/ +--- Makefile.PL ## Generates the Makefile +--- MANIFEST ## what files to ship, built with `make manifest` +--- MANIFEST.SKIP ## what filenames `make manifest` should ignore +--- CHANGES ## A detailed summary of all edits +--- TODO ## Things we can't get to quite yet +--- LICENSE +--- README +--- revml.dtd ## Defines legal RevML +--+ bin/ ## Executable files | +---- vcp ## The command line interface | +---- gentrevml ## builds RevML files for the test suite | +---- hexdump.pl ## dumps files in hex, a debugging aid | +--+ lib/ ## All modules that comprise VCP itself | +--- VCP.pm ## Drives the VCP process | +--- *.pod ## Supplemental documentation | +--- Plugin.pm ## Base class for all sources & destinations | | | +--- Source.pm ## Base class for all sources | +--+ Source/ | | +--- foo.pm ## A backend to read from repo. type "foo" | | | +--- Dest.pm ## Base class for all destinations | +--+ Dest/ | | +--- foo.pm ## A backend to write to repo. type "foo" | | | +--+ Utils/ | | +--- foo.pm ## Routines shared by Source/ and Dest/ foo.pm's | | | +--- Rev.pm ## VCP's concept of a revision | +--- Revs.pm ## A collection of VCP::Rev instances | | | +--- RevML/ ## Files defining RevML | +--+ t/ ## The test suite +--- *.t ## Test scripts +--- test-*.revml ## Fodder for test scripts In addition, the following files are created: | +--- vcp_html ## By running the `vcp html` command +--- pod2htm* ## Gunk left over from `vcp html` +--- blib/ ## By running `make` Useful command line idioms
Environment VariablesSome environment variables that are useful in debugging:
In addition, both CVS and Perforce backends pay attention to the relevant environment variables. "hexdump.pl""bin/hexdump.pl" is useful for debugging issues involving line endings, embedded control code (esp. ^Z on Win32 and NULL on every platform, since most C programs die when encountering NULL in a text file).The testsThe t/*.t files in the source distribution contain a large number of tests. The tests begin with a two digit number that orders them so that more primitive tests run first, followed by higher level "end-to-end" tests in "t/90*.t".The more primitive tests are pretty standard fare for Perl test suites. Where things get interesting is the "t/90*.t" tests. These tests use the command-line "vcp" interface to move reasonably sized chunks of RevML (up to about 65k currently; pretty small in comparison to "real" exports) in to, out of, and between various repositories. The RevML extracted from the repositories is compared to the RevML that was fed in to them, after sanitizing both of data that is known to not make it through ok. The module VCP::TestUtils contains support routines for initializing repositories and shutting them down (when a server is needed). Existing repositories are not used in the test suite; they'd be useless and in danger if we did. The file "bin/gentrevml" is used to generate the RevML files ("t/test*.revml") from scratch using hand written code instead of VCP::Dest::revml in order to reduce the chances of a bug in VCP::Dest::revml causing false positives in the test results. It's highly likely that new back ends will require new test RevML files. "bin/gentrevml" should be hacked up to generate these and new rules should be added to the "Makefile" by editing "Makefile.PL". The structure of a test script. The t/*.t scripts generally all follow the same structure. First, they import all necessary modules and init themselves. Then they build a my @tests = ( sub { ... }, ); array that contain the actual tests. Each test is a single anonymous "sub {...}", every once in a while a single "sub {...}" will contain two tests; it is preceded by an empty (or nearly empty) "sub {}" in these cases. At the bottom, some final checks are run to see if all tests should be skipped, then plan tests => scalar @tests; emits how many tests are to be run, and $_->() for @tests; runs the tests. This structure is used for several reasons:
Developing a new backendIn general, backends are created in pairs so that a "t/90foo.t" can be written to import the RevML files in to the backend repository, extract new RevML from it, and compare the two.A backend usually consists of 3 Perl classes: VCP::Source::foo, VCP::Dest::foo, and VCP::Utils::foo. The reason for the lowercase final name is so that the "vcp" command can translate from the scheme name ("cvs:") to a source or destination module name trivially. The VCP::Source::foo generally contains a parser to extract metadata from repository log reports and a routine to drive the copying process. The VCP module ("/lib/VCP.pm") Updating the RevML DTDRun the command "compile_dtd", which by default will look for the file 'revml.dtd'. This should be done each time the dtd changes. Optionally you may pass in a dtd file name as the argument to "compile_dtd".The generated file is placed in "./lib/RevML/Doctype/" or "./RevML/Doctype/" or "./", whichever is found first. No directories will be created. This does not update the VCP::Source::revml or VCP::Dest::revml drivers to match the DTD, nor does it affect "bin/gentrevml", which is used by the test suite to build the RevML files used for testing. AUTHORBarrie Slaymaker <barries@slaysys.com>COPYRIGHTCopyright (c) 2000, 2001, Perforce Software, Inc. All rights reserved.See VCP::License ("vcp help license") for the terms of use. POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |