[Bio] / FigRelEngTools / build_release Repository:
ViewVC logotype

Annotation of /FigRelEngTools/build_release

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download)

1 : olson 1.1 #!/usr/bin/perl
2 :    
3 : olson 1.4 use Getopt::Long;
4 : olson 1.1 use File::Basename;
5 :     use File::Copy;
6 :     use strict;
7 :    
8 :     #
9 :     # build_release
10 :     #
11 :     # Builds a (skeleton of) a release directory, meant to be put on an FTP server
12 :     # or on a DVD release.
13 :     #
14 :    
15 :     my @install_scripts = qw(assemble_disk extract_transferred_data);
16 :    
17 :     #
18 :     # Directory containing other tarfiles to be included in release.
19 :     #
20 :    
21 : olson 1.5 my $distro_dir = "/Users/olson/FigRelEngTools/ReleaseBase-2004-0730";
22 : olson 1.4
23 :     my $readme_file;
24 :    
25 :     if (!GetOptions("readme|r=s" => \$readme_file))
26 :     {
27 :     usage();
28 :     }
29 : olson 1.1
30 :     if (@ARGV != 1)
31 :     {
32 : olson 1.4 usage();
33 :     }
34 :    
35 :     sub usage
36 :     {
37 :     die "Usage: $0 [--readme readme-file] relase-dir\n";
38 : olson 1.1 }
39 :    
40 :     my $release_dir = shift(@ARGV);
41 :    
42 :     if (-d $release_dir)
43 :     {
44 : olson 1.2 warn "Release directory $release_dir already exists, overwriting\n";
45 :     }
46 :     else
47 :     {
48 :     mkdir($release_dir, 0777) or die "Cannot mkdir $release_dir: $!\n";
49 : olson 1.1 }
50 :    
51 : olson 1.4 my @manifest_files = qw(InstallSEED scripts.tgz);
52 :    
53 :     if (defined($readme_file))
54 :     {
55 :     if (! -f $readme_file)
56 :     {
57 :     die "Specified readme file $readme_file not present\n";
58 :     }
59 :     copy($readme_file, "$release_dir/README");
60 :     push(@manifest_files, "README");
61 :     }
62 :    
63 : olson 1.1 copy("InstallSEED", "$release_dir/InstallSEED");
64 :     chmod(0775, "$release_dir/InstallSEED");
65 :    
66 :     my $tarcmd = "tar czf $release_dir/scripts.tgz @install_scripts";
67 :     print "Creating: $tarcmd\n";
68 :     (system($tarcmd) == 0) or die "Tar command \"$tarcmd\" failed: $!\n";
69 :    
70 : olson 1.2 if (-f "$release_dir/checksums")
71 :     {
72 :     push(@manifest_files, "checksums");
73 :     }
74 :    
75 : olson 1.1 for my $tarfile (glob("$distro_dir/*.tgz"))
76 :     {
77 :     my $base = basename($tarfile);
78 :     push(@manifest_files, $base);
79 : olson 1.2 print "Copying $tarfile\n";
80 : olson 1.1 copy($tarfile, $release_dir);
81 :     }
82 :    
83 :     (system("cd $release_dir; cksum @manifest_files > MANIFEST") == 0) or die "cksum failed: $!\n";
84 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3