Subversion Repositories DevTools

Rev

Rev 255 | Rev 277 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 255 Rev 275
Line 22... Line 22...
22
use strict;
22
use strict;
23
use warnings;
23
use warnings;
24
use Cwd;
24
use Cwd;
25
use Getopt::Long;
25
use Getopt::Long;
26
use Pod::Usage;
26
use Pod::Usage;
27
use File::Basename;
-
 
28
use File::Find;
-
 
29
use File::Path;
-
 
30
use File::Copy;
27
 
31
use JatsError;
28
use JatsError;
32
use JatsSystem;
29
use JatsSystem;
-
 
30
use FileUtils;
-
 
31
use JatsCopy;
33
 
32
 
34
my $VERSION = "1.0.0";
33
my $VERSION = "1.0.0";
35
my $opt_help = 0;
34
my $opt_help = 0;
36
my $opt_manual = 0;
35
my $opt_manual = 0;
37
my $opt_buildname;
36
my $opt_buildname;
Line 77... Line 76...
77
#
76
#
78
Error ("Not expecting any command line arguments" )
77
Error ("Not expecting any command line arguments" )
79
    if ( $#ARGV >= 0);
78
    if ( $#ARGV >= 0);
80
 
79
 
81
#
80
#
-
 
81
#   Diagnostics
-
 
82
#
-
 
83
Verbose ( "BuildName: ", $opt_buildname );
-
 
84
Verbose ( "BuildVersion: ", $opt_buildversion );
-
 
85
Verbose ( "PackageDir: ", $opt_package );
-
 
86
Verbose ( "BuildRoot: ", $opt_root );
-
 
87
 
-
 
88
#
82
#   Ensure we have all required parameters
89
#   Ensure we have all required parameters
83
#
90
#
84
Error ("No build name provided" ) unless ( $opt_buildname );
91
Error ("No build name provided" ) unless ( $opt_buildname );
85
Error ("No build version provided" ) unless ( $opt_buildversion );
92
Error ("No build version provided" ) unless ( $opt_buildversion );
86
Error ("No package directory provided" ) unless ( $opt_package );
93
Error ("No package directory provided" ) unless ( $opt_package );
Line 92... Line 99...
92
#
99
#
93
my $GBE_PERL = $ENV{GBE_PERL} || Error ("Environment variable GBE_PERL not set");
100
my $GBE_PERL = $ENV{GBE_PERL} || Error ("Environment variable GBE_PERL not set");
94
my $GBE_CORE = $ENV{GBE_CORE} || Error ("Environment variable GBE_CORE not set");
101
my $GBE_CORE = $ENV{GBE_CORE} || Error ("Environment variable GBE_CORE not set");
95
 
102
 
96
#
103
#
-
 
104
#   Setup logging options for the copy functions
-
 
105
#
-
 
106
SetCopyDirDefaults ('Log' => 0 );
-
 
107
 
-
 
108
#
97
#   Remove any existing package directory
109
#   Remove any existing package directory
98
#
110
#
99
if ( -d $opt_package )
-
 
100
{
-
 
101
    Message ("Removing existing package image");
-
 
102
    rmtree( $opt_package);
-
 
103
}
-
 
104
 
111
 
105
Message "Create package image: $opt_package";
112
Message "Create package image: $opt_package";
106
mkpath($opt_package, 0, 0775);
113
CreateDir ($opt_package, 'DeleteFirst' => 1 );
107
 
-
 
108
 
114
 
109
for my $dir (glob ("$opt_root/BIN.*" ))
115
for my $dir (glob ("$opt_root/BIN.*" ))
110
{
116
{
111
    Message "Copy in: $dir";
117
    Message "Copy in: $dir";
112
    System ("cp -r $dir $opt_package")
118
    CopyDir ( $dir, $opt_package, 'KeepSrcTail' => 1 );
113
}
119
}
114
 
120
 
115
for my $dir qw(CFG TEMPLATES TOOLS)
121
for my $dir qw(CFG TEMPLATES TOOLS)
116
{
122
{
117
    Message "Copy in: $dir";
123
    Message "Copy in: $dir";
118
    System ("cp -r $opt_root/$dir $opt_package")
124
    CopyDir ( "$opt_root/$dir", $opt_package,
119
}
-
 
120
 
-
 
121
for my $dir qw(TOOLS/LOCAL)
-
 
122
{
-
 
123
    Message "Remove: $dir";
125
                'IgnoreDirs' => ['LOCAL'],
124
    rmtree( "$opt_package/$dir" );
126
                'KeepSrcTail' => 1);
125
}
127
}
126
 
128
 
127
for my $file qw(Readme.txt ChangeLog.txt)
129
for my $file qw(Readme.txt ChangeLog.txt)
128
{
130
{
129
    Message "Copy in: $file";
131
    Message "Copy in: $file";
130
    System ("cp -r $opt_root/$file $opt_package")
132
    CopyFile ( "$opt_root/$file", $opt_package );
131
}
133
}
132
 
134
 
133
for my $file qw(PostInstall.sh)
135
for my $file qw(PostInstall.sh)
134
{
136
{
135
    Message "Copy in: $file";
137
    Message "Copy in: $file";
136
    System ("cp -r $file $opt_package")
138
    CopyFile ( $file, $opt_package );
137
}
139
}
138
 
140
 
139
#
141
#
140
#   Update version info in some files
142
#   Update version info in some files
141
#
143
#
Line 143... Line 145...
143
{
145
{
144
    Message "Insert version into: $file";
146
    Message "Insert version into: $file";
145
    my @opts;
147
    my @opts;
146
    push @opts, ( $file =~ m~\.bat$~ ? '-dos' : '-unix' );
148
    push @opts, ( $file =~ m~\.bat$~ ? '-dos' : '-unix' );
147
    unlink "$opt_package/$file";
149
    unlink "$opt_package/$file";
148
    System ( "$GBE_PERL", "$GBE_CORE/TOOLS/jats_transform_file.pl",
150
    JatsTool ("jats_transform_file.pl",
149
             "-infile=$opt_root/$file",
151
                 "-infile=$opt_root/$file",
150
             "-outfile=$opt_package/$file",
152
                 "-outfile=$opt_package/$file",
151
             "-tag=VERSION_TAG,$opt_buildversion",
153
                 "-tag=VERSION_TAG,$opt_buildversion",
152
             "-tag=PACKAGE_TAG,$opt_buildname",
154
                 "-tag=PACKAGE_TAG,$opt_buildname",
153
             "-tag=RELEASE_TAG,",
155
                 "-tag=RELEASE_TAG,",
154
             @opts
156
                 @opts
155
            );
157
                );
156
}
158
}
157
 
159
 
158
#
160
#
159
#   Ensure that the jats.pl file has the correct version information
161
#   Ensure that the jats.pl file has the correct version information
160
#   inserted into it, by this tool
162
#   inserted into it, by this tool