Subversion Repositories DevTools

Rev

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

Rev 369 Rev 379
Line 90... Line 90...
90
my $error = 0;
90
my $error = 0;
91
my $label_count = 0;                        # Number of labels to create the view
91
my $label_count = 0;                        # Number of labels to create the view
92
my @label_not_locked;                       # List of unlocked labels
92
my @label_not_locked;                       # List of unlocked labels
93
my @label_locked;                           # List of labels I locked
93
my @label_locked;                           # List of labels I locked
94
my @error_list;                             # ClearCmd detected errors
94
my @error_list;                             # ClearCmd detected errors
-
 
95
my $load_count;                             # Loaded files
95
 
96
 
96
my $UNIX_VOB_PREFIX = '/vobs';
97
my $UNIX_VOB_PREFIX = '/vobs';
97
my $VOB_PREFIX = $UNIX ? $UNIX_VOB_PREFIX : '';
98
my $VOB_PREFIX = $UNIX ? $UNIX_VOB_PREFIX : '';
98
 
99
 
99
my $UNIX_VIEW_PREFIX = '/view/';            # Don't know how to determine this value
100
my $UNIX_VIEW_PREFIX = '/view/';            # Don't know how to determine this value
Line 147... Line 148...
147
                "view=s"        => \$opt_viewname,          # String
148
                "view=s"        => \$opt_viewname,          # String
148
                "vob=s"         => \$opt_vob,               # String
149
                "vob=s"         => \$opt_vob,               # String
149
                "dpkg!"         => \$opt_dpkg,              # [no]flag
150
                "dpkg!"         => \$opt_dpkg,              # [no]flag
150
                "copy!"         => \$opt_copy,              # [no]flag
151
                "copy!"         => \$opt_copy,              # [no]flag
151
                "reuse!"        => \$opt_reuse,             # [no]flag
152
                "reuse!"        => \$opt_reuse,             # [no]flag
152
                "extract"       => \$opt_extract,           # flag
153
                "extract:+"     => \$opt_extract,           # flag
153
                "extractfiles"  => \$opt_extract_files,     # flag
154
                "extractfiles"  => \$opt_extract_files,     # flag
154
                "delete:+"      => \$opt_delete,            # flag
155
                "delete:+"      => \$opt_delete,            # flag
155
                "build=s"       => \@opt_build,             # An array of build
156
                "build=s"       => \@opt_build,             # An array of build
156
                "test!"         => \$opt_test,              # [no]flag
157
                "test!"         => \$opt_test,              # [no]flag
157
                "cache"         => \$opt_cache,             # flag
158
                "cache"         => \$opt_cache,             # flag
Line 185... Line 186...
185
InitFileUtils();
186
InitFileUtils();
186
 
187
 
187
#
188
#
188
#   Configure the error reporting process now that we have the user options
189
#   Configure the error reporting process now that we have the user options
189
#
190
#
190
ErrorConfig( 'name'    => 'RELEASE',
191
ErrorConfig( 'name'    => 'CCRELEASE',
191
             'verbose' => $opt_verbose );
192
             'verbose' => $opt_verbose );
192
 
193
 
193
#
194
#
194
#   Validate user options
195
#   Validate user options
195
#   Use either -label or one command line argument
196
#   Use either -label or one command line argument
Line 526... Line 527...
526
        Error ("Not all labels locked: @label_not_locked") if ( @label_not_locked  );
527
        Error ("Not all labels locked: @label_not_locked") if ( @label_not_locked  );
527
    }
528
    }
528
}
529
}
529
 
530
 
530
#
531
#
531
#   If we are only extracting files then ...
-
 
532
#
-
 
533
if ( $opt_extract_files )
-
 
534
{
-
 
535
    extract_files_from_view();
-
 
536
    exit (0);
-
 
537
}
-
 
538
 
-
 
539
#
-
 
540
#   Create a new (static) view
532
#   Create a new (static) view
541
#   Create a config spec and populate the view
533
#   Create a config spec and populate the view
542
#
534
#
543
if (! -d $VIEWDIR || ! $opt_reuse )
535
if (! -d $VIEWDIR || ! $opt_reuse )
544
{
536
{
Line 635... Line 627...
635
        TouchFile ( "$cpath/.jats.packageroot" );
627
        TouchFile ( "$cpath/.jats.packageroot" );
636
    }
628
    }
637
}
629
}
638
 
630
 
639
#
631
#
-
 
632
#   If we are only extracting files then ...
-
 
633
#       Remove the viewtag
-
 
634
#       Remove view-specific files
-
 
635
#       Eliminate 'vobs' subdirectory and move items up
-
 
636
#
-
 
637
if ( $opt_extract_files )
-
 
638
{
-
 
639
 
-
 
640
    chdir ( $user_cwd );
-
 
641
    ClearCmd ( 'rmview', '-force', '-tag', $VIEWTAG );
-
 
642
 
-
 
643
    #
-
 
644
    #   Remove view specific files
-
 
645
    #
-
 
646
    chdir ( $VIEWDIR );
-
 
647
    RmDirTree( 'local_dpkg_archive' );
-
 
648
    RmDirTree( '.view.dat' );
-
 
649
    foreach my $file ( glob ('update.*.updt') )
-
 
650
    {
-
 
651
        RmDirTree( $file );
-
 
652
    }
-
 
653
 
-
 
654
    #
-
 
655
    #   If Unix based view, then get rid of the VOBS directory
-
 
656
    #
-
 
657
    if ( $UNIX )
-
 
658
    {
-
 
659
        foreach my $file ( glob ('vobs/*') )
-
 
660
        {
-
 
661
            my $target = $file;
-
 
662
            $target =~ s~^vobs/~~;
-
 
663
            rename $file, $target || Error ("Renameing $file. $!");
-
 
664
        }
-
 
665
 
-
 
666
        rmdir 'vobs' || Error ("Removing vobs directory");
-
 
667
    }
-
 
668
 
-
 
669
    Message DisplayPath("View files in: $VIEWDIR, Files: $load_count" );
-
 
670
    exit (0);
-
 
671
}
-
 
672
 
-
 
673
 
-
 
674
#
640
#   Locate the JATS build files within the populated view
675
#   Locate the JATS build files within the populated view
641
#
676
#
642
chdir ($VIEWDIR) or Error( "Cannot chdir to $VIEWDIR");
677
chdir ($VIEWDIR) or Error( "Cannot chdir to $VIEWDIR");
643
Message( "Locating build files");
678
Message( "Locating build files");
644
 
679
 
Line 1047... Line 1082...
1047
# Returns         : Error code
1082
# Returns         : Error code
1048
#
1083
#
1049
sub ClearTool
1084
sub ClearTool
1050
{
1085
{
1051
    my $quiet;
1086
    my $quiet;
-
 
1087
    $load_count = 0;
1052
 
1088
 
1053
    #
1089
    #
1054
    #   Scan for initial options
1090
    #   Scan for initial options
1055
    #       --Quiet
1091
    #       --Quiet
1056
    #
1092
    #
Line 1065... Line 1101...
1065
    while (<CMD>)
1101
    while (<CMD>)
1066
    {
1102
    {
1067
        #
1103
        #
1068
        #   Filter output from the user
1104
        #   Filter output from the user
1069
        #
1105
        #
-
 
1106
        $load_count++ if ( m'Loading ' );
1070
        next if ( $quiet );
1107
        next if ( $quiet );
-
 
1108
        if ( $opt_extract_files )
-
 
1109
        {
-
 
1110
            next if ( m'Loading ' );
-
 
1111
            next if ( m'Done loading ' );
-
 
1112
            next if ( m'Log has been written to ' );
-
 
1113
        }
1071
        unless ( $opt_verbose )
1114
        unless ( $opt_verbose )
1072
        {
1115
        {
1073
            next if ( m~Making dir~ );
1116
            next if ( m~Making dir~ );
1074
            next if ( m~End dir~ );
1117
            next if ( m~End dir~ );
1075
            next if ( m~Processing dir~ );
1118
            next if ( m~Processing dir~ );
Line 1153... Line 1196...
1153
    }
1196
    }
1154
    Error ("Not all labels unlocked: @still_locked") if ( @still_locked  );
1197
    Error ("Not all labels unlocked: @still_locked") if ( @still_locked  );
1155
}
1198
}
1156
 
1199
 
1157
#-------------------------------------------------------------------------------
1200
#-------------------------------------------------------------------------------
1158
# Function        : extract_files_from_view
-
 
1159
#
-
 
1160
# Description     : This function will
-
 
1161
#                       Create a dynamic view
-
 
1162
#                       Copy all the files out of the view
-
 
1163
#                       Delete the view
-
 
1164
#
-
 
1165
#                   Its used in the creation of escrow directories
-
 
1166
#
-
 
1167
# Inputs          : None
-
 
1168
#                   All done via globals
-
 
1169
#
-
 
1170
# Returns         : 
-
 
1171
#
-
 
1172
sub extract_files_from_view
-
 
1173
{
-
 
1174
    my $vob_mounted = 1;
-
 
1175
    my $vob_name;
-
 
1176
 
-
 
1177
    #
-
 
1178
    #   Determine the target directory for the extracted files
-
 
1179
    #       Delete the output subdir
-
 
1180
    #       Create the config spec in that directory
-
 
1181
    #
-
 
1182
    Verbose("Extracting files into $VIEWDIR");
-
 
1183
    if ( -d $VIEWDIR )
-
 
1184
    {
-
 
1185
        Verbose "Delete existing directory: $VIEWDIR";
-
 
1186
        RmDirTree( $VIEWDIR );
-
 
1187
    }
-
 
1188
 
-
 
1189
    #
-
 
1190
    #   Which config spec
-
 
1191
    #   If we need to create it, do it within the final view
-
 
1192
    #
-
 
1193
    my $config;
-
 
1194
    $config = $opt_config_spec;
-
 
1195
    unless ( $opt_config_spec )
-
 
1196
    {
-
 
1197
        File::Path::mkpath( $VIEWDIR );
-
 
1198
        $config = create_config_spec( "$VIEWDIR/config_spec.txt" );
-
 
1199
    }
-
 
1200
 
-
 
1201
    #
-
 
1202
    #   Create the view and insert the config spec
-
 
1203
    #
-
 
1204
    ClearCmd ( 'rmview', '-tag', $VIEWTAG );
-
 
1205
    ClearCmd ( 'mkview', '-tag', $VIEWTAG, '-stgloc', '-auto' );
-
 
1206
    ClearCmd ( 'setcs',  '-tag', $VIEWTAG, $config );
-
 
1207
 
-
 
1208
    #
-
 
1209
    #   Ensure that the base VOB has been 'mounted'
-
 
1210
    #   Dynamic views require vobs to be mounted
-
 
1211
    #
-
 
1212
    ($vob_name = $ROOT_VOB) =~ s~/~$VOB_SEP~g;
-
 
1213
    $vob_mounted = ClearCmd ('mount', $vob_name);
-
 
1214
 
-
 
1215
    #
-
 
1216
    #   Calculate where the dynmaic view will be
-
 
1217
    #   This differ between UNIX/WINDOWS
-
 
1218
    #
-
 
1219
    my $vpath = $VIEW_PREFIX . $VIEWTAG . $VOB_PREFIX;
-
 
1220
    my $cpath = $vpath;
-
 
1221
       $cpath .= $opt_path if ( $opt_path );
-
 
1222
    #
-
 
1223
    #   Is the view where we expect it to be
-
 
1224
    #
-
 
1225
    Error ("Cannot locate dynamic view",
-
 
1226
            "Looking in: $vpath" ) unless -d $vpath;
-
 
1227
 
-
 
1228
    #
-
 
1229
    #   Copy all the files out of the view
-
 
1230
    #
-
 
1231
    Verbose ("Copy View contents");
-
 
1232
    my $rv = copy_directory ($cpath, $VIEWDIR, $vpath );
-
 
1233
    Message ("View files in: $VIEWDIR, Files: $copy_count" );
-
 
1234
 
-
 
1235
    #
-
 
1236
    #   Remove the view
-
 
1237
    #
-
 
1238
    ClearCmd ( 'rmview', '-tag', $VIEWTAG );
-
 
1239
 
-
 
1240
    #
-
 
1241
    #   Unmount the vob - if mounted
-
 
1242
    #
-
 
1243
    ClearCmd ('umount', $vob_name) unless $vob_mounted;
-
 
1244
 
-
 
1245
    Error ("Copy did not complete without error")
-
 
1246
        if ( $rv );
-
 
1247
 
-
 
1248
}
-
 
1249
 
-
 
1250
#-------------------------------------------------------------------------------
-
 
1251
# Function        : create_config_spec
1201
# Function        : create_config_spec
1252
#
1202
#
1253
# Description     : Creates a config spec
1203
# Description     : Creates a config spec
1254
#
1204
#
1255
# Inputs          : $config     - Path to the config file
1205
# Inputs          : $config     - Path to the config file
Line 1340... Line 1290...
1340
    #
1290
    #
1341
    #   Handle file(directory) addition
1291
    #   Handle file(directory) addition
1342
    #   Need a rule to allow /main/0 to be visible
1292
    #   Need a rule to allow /main/0 to be visible
1343
    #   Need to ensure that we don't "see" the entire VOB, just below the load path
1293
    #   Need to ensure that we don't "see" the entire VOB, just below the load path
1344
    #
1294
    #
1345
    unless ($GBE_ABT)
1295
    unless ($GBE_ABT || $opt_extract_files)
1346
    {
1296
    {
1347
        #
1297
        #
1348
        #   Ensure that we have more than just the VOB root
1298
        #   Ensure that we have more than just the VOB root
1349
        #   If we only have the VOB root then we will get all top level entries
1299
        #   If we only have the VOB root then we will get all top level entries
1350
        #   in the vob - and this is not good.
1300
        #   in the vob - and this is not good.