[Bio] / FigKernelScripts / Packager.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/Packager.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Wed Aug 17 02:37:07 2005 UTC revision 1.5, Mon Dec 5 18:56:37 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    #
3    # Copyright (c) 2003-2006 University of Chicago and Fellowship
4    # for Interpretations of Genomes. All Rights Reserved.
5    #
6    # This file is part of the SEED Toolkit.
7    #
8    # The SEED Toolkit is free software. You can redistribute
9    # it and/or modify it under the terms of the SEED Toolkit
10    # Public License.
11    #
12    # You should have received a copy of the SEED Toolkit Public License
13    # along with this program; if not write to the University of Chicago
14    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15    # Genomes at veronika@thefig.info or download a copy from
16    # http://www.theseed.org/LICENSE.TXT.
17    #
18    
19    
20  =head1 Packager  =head1 Packager
21    
22    C<Packager> [I<options>] C<scan>|C<pack>|C<unpack> I<directoryRoot> I<packageFile>
23    
24  Package all the files in a directory tree for transport or recreate the directory  Package all the files in a directory tree for transport or recreate the directory
25  tree from the packaged files.  tree from the packaged files.
26    
27  This method takes as input three positional parameters: a command, the name of the  This method takes as input three positional parameters.
28  root for the directory tree and the name of the package files. If the command is  
29  C<pack>, the files are packaged into one or more text files. If the command is  =over 4
30  C<unpack>, the files are unpackaged from the text files. If the command is  
31  C<scan>, the files are examined to determine the file types.  =item command
32    
33    C<pack> to package the files into a single package file, <unpack> to restore
34    the files from the package file, or C<scan> to scan the files to determine
35    file types.
36    
37    =item directoryRoot
38    
39    Root directory of the directory tree. If scanning or packing, all files in this
40    tree will be packaged. If unpacking, the files are unpacked into this tree.
41    
42    =item packageFile
43    
44    Name of the package file. If packing, this is the output file. If unpacking,
45    this is the input file.
46    
47    =back
48    
49  File and directory names should be specified using Unix conventions, with a  File and directory names should be specified using Unix conventions, with a
50  forward slash (C</>) instead of a backslash (C<\>).  forward slash (C</>) instead of a backslash (C<\>).
51    
 File names ending in a tilde (C<~>) or C<.bak> will be ignored when scanning or  
 packaging. These files are presumed to be temporary backups.  
   
52  The process of packaging is straightforward. We write out the name of the input file,  The process of packaging is straightforward. We write out the name of the input file,
53  its type (text or binary), the file data itself, and an MD5 digest. Each file is  its type (text or binary), the file data itself, and an MD5 digest. Each file is
54  compressed using the PERL C<Compress::Zlib> libary.  compressed using the PERL C<Compress::Zlib> libary.
# Line 725  Line 757 
757  one end record.  one end record.
758    
759  To prevent file system compatibility problems, the name is automatically cleaned  To prevent file system compatibility problems, the name is automatically cleaned
760  before the file is created: all spaces and colons are converted to underscores.  before the file is created: all spaces and colons are converted to underscores,
761    and question marks are converted to the double letter C<QQ>.
762    
763  Text files are open in text mode and binary files in binary mode. As a result, the  Text files are open in text mode and binary files in binary mode. As a result, the
764  line-end characters in a text file are automatically translated to the line-end  line-end characters in a text file are automatically translated to the line-end
# Line 930  Line 963 
963    
964  sub CreateFile {  sub CreateFile {
965      my ($fileName, $mode, $directory, $compObject) = @_;      my ($fileName, $mode, $directory, $compObject) = @_;
966      # Clear the file name.      # Clean the file name.
967      $fileName =~ tr/: /__/;      $fileName =~ tr/: /__/;
968        $fileName =~ s/\?/QQ/g;
969      # Add the file name to the directory to get the fully-qualified file name.      # Add the file name to the directory to get the fully-qualified file name.
970      my $fullName = "$directory/$fileName";      my $fullName = "$directory/$fileName";
971      # Extract the path.      # Extract the path.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3