Subversion Repositories DevTools

Rev

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

Rev 5527 Rev 5568
Line 81... Line 81...
81
my $opt_outputPath;
81
my $opt_outputPath;
82
my $opt_preDelete;
82
my $opt_preDelete;
83
my $opt_tmpDir;
83
my $opt_tmpDir;
84
my $opt_keepFragments;
84
my $opt_keepFragments;
85
my $opt_testArchive;
85
my $opt_testArchive;
-
 
86
my $opt_DeleteVersion;
86
 
87
 
87
#-------------------------------------------------------------------------------
88
#-------------------------------------------------------------------------------
88
# Function        : main entry point 
89
# Function        : main entry point 
89
#
90
#
90
# Description     : Main Entry point
91
# Description     : Main Entry point
Line 105... Line 106...
105
                'output=s'          => \$opt_outputPath,        # String
106
                'output=s'          => \$opt_outputPath,        # String
106
                'tmpdir=s'          => \$opt_tmpDir,            # String
107
                'tmpdir=s'          => \$opt_tmpDir,            # String
107
                'predelete!'        => \$opt_preDelete,         # [no]flag
108
                'predelete!'        => \$opt_preDelete,         # [no]flag
108
                'keepFragments!'    => \$opt_keepFragments ,    # [no]flag
109
                'keepFragments!'    => \$opt_keepFragments ,    # [no]flag
109
                'testArchive'       => \$opt_testArchive,       # [no]flag
110
                'testArchive'       => \$opt_testArchive,       # [no]flag
-
 
111
                'DeleteVersion'     => \$opt_DeleteVersion,     # flag
110
                );              
112
                );              
111
 
113
 
112
    #
114
    #
113
    #   Process help and manual options
115
    #   Process help and manual options
114
    #
116
    #
Line 155... Line 157...
155
    Error ("Output path not specified" ) unless defined $opt_outputPath;
157
    Error ("Output path not specified" ) unless defined $opt_outputPath;
156
    Error ("Output path does not exist", $opt_outputPath) unless -d $opt_outputPath;
158
    Error ("Output path does not exist", $opt_outputPath) unless -d $opt_outputPath;
157
    Error ("TmpDir does not exist:", $opt_tmpDir) if (defined($opt_tmpDir) && ! -d ($opt_tmpDir));
159
    Error ("TmpDir does not exist:", $opt_tmpDir) if (defined($opt_tmpDir) && ! -d ($opt_tmpDir));
158
 
160
 
159
    #
161
    #
-
 
162
    #   Alternate Modes
-
 
163
    #   These will not return, but will exis the utility
-
 
164
    #   
-
 
165
    if ($opt_DeleteVersion)
-
 
166
    {
-
 
167
        DeletePackageVersion();
-
 
168
        exit 1;
-
 
169
    }
-
 
170
 
-
 
171
 
-
 
172
    #
160
    #   Create a temp work directory for this
173
    #   Create a temp work directory for this
161
    #       This will be removed on program exit 
174
    #       This will be removed on program exit 
162
    #       Not by File:Temp as it doesn't handle the case where we have chdir'd to the temp area
175
    #       Not by File:Temp as it doesn't handle the case where we have chdir'd to the temp area
163
    #
176
    #
164
    if ($opt_tmpDir)
177
    if ($opt_tmpDir)
Line 511... Line 524...
511
    Information("Package Target: $pkgTargetDir");
524
    Information("Package Target: $pkgTargetDir");
512
    $deleteTargetDir = 0;
525
    $deleteTargetDir = 0;
513
    exit 0;
526
    exit 0;
514
 
527
 
515
#-------------------------------------------------------------------------------
528
#-------------------------------------------------------------------------------
-
 
529
# Function        : DeletePackageVersion 
-
 
530
#
-
 
531
# Description     : Delete the named package version from the package archive
-
 
532
#                   Used by the 'buildtool' to clean up failed or test builds
-
 
533
#
-
 
534
# Inputs          : 
-
 
535
#
-
 
536
# Returns         : Does not return. Must exit the utility 
-
 
537
#
-
 
538
sub DeletePackageVersion
-
 
539
{
-
 
540
    #
-
 
541
    #   Information for the user
-
 
542
    #
-
 
543
    Information ("---------------------------------------------------------------");
-
 
544
    Information ("Dpkg fragment assembly tool");
-
 
545
    Information ("Version: $VERSION");
-
 
546
    Information ("");
-
 
547
    Information ("Information:");
-
 
548
    Information ("Repository    = [$GBE_DPKG]");
-
 
549
    Information ("Target dir    = [$pkgTargetDir]");
-
 
550
    Information ("DPKG_NAME     = [$opt_pname]");
-
 
551
    Information ("DPKG_VERSION  = [$opt_pversion]");
-
 
552
    Information ("GBE_ABT       = [$GBE_ABT]");
-
 
553
    Information ("");
-
 
554
    Information ("Mode          - DeleteVersion");
-
 
555
    Information ("Package       - " . (-d $pkgTargetDir ? "Exists" : "Does Not exist"));
-
 
556
    Information ("---------------------------------------------------------------");
-
 
557
 
-
 
558
    Verbose("Package Target: $pkgTargetDir");
-
 
559
 
-
 
560
    if (-d $pkgTargetDir)
-
 
561
    {
-
 
562
        if (RmDirTree($pkgTargetDir))
-
 
563
        {
-
 
564
            Error ("Package-Version not deleted");
-
 
565
        }
-
 
566
    }
-
 
567
 
-
 
568
    exit 0;
-
 
569
}
-
 
570
 
-
 
571
 
-
 
572
#-------------------------------------------------------------------------------
516
# Function        : END 
573
# Function        : END 
517
#
574
#
518
# Description     : Cleanup process 
575
# Description     : Cleanup process 
519
#
576
#
520
# Inputs          : 
577
# Inputs          : 
Line 525... Line 582...
525
{
582
{
526
    #
583
    #
527
    #   Save the programs exit code
584
    #   Save the programs exit code
528
    #   This END block may use the 'system' call and this will clobber the value in $?
585
    #   This END block may use the 'system' call and this will clobber the value in $?
529
    #   which is the systems exit code
586
    #   which is the systems exit code
-
 
587
    #   
-
 
588
    #   Limit exist codes to 16 bits
530
    #
589
    #
531
    my $savedExitCode = $?;
-
 
532
    Message("Cleanup processing");
590
    Message("Cleanup processing($?)");
-
 
591
    local $?;
533
 
592
 
534
    #
593
    #
535
    #   Delete input package fragments
594
    #   Delete input package fragments
536
    #   These will be deleted on error as well as on good exits
595
    #   These will be deleted on error as well as on good exits
537
    #   Reason: This tool is used by the build system
596
    #   Reason: This tool is used by the build system
Line 582... Line 641...
582
 
641
 
583
        my $pkgDir = StripFileExt($pkgTargetDir);
642
        my $pkgDir = StripFileExt($pkgTargetDir);
584
        rmdir($pkgDir) && Message("Remove package dir: $pkgDir");
643
        rmdir($pkgDir) && Message("Remove package dir: $pkgDir");
585
    }
644
    }
586
 
645
 
-
 
646
    # Note: $? has been localised and should not be reflected back to the user
587
    $? = $savedExitCode;
647
    Message("End Cleanup processing($?)");
588
}
648
}
589
 
649
 
590
#-------------------------------------------------------------------------------
650
#-------------------------------------------------------------------------------
591
# Function        : writeFileInfo 
651
# Function        : writeFileInfo 
592
#
652
#
Line 659... Line 719...
659
    -man               - Full documentation
719
    -man               - Full documentation
660
    -verbose           - Display additional progress messages
720
    -verbose           - Display additional progress messages
661
    -pname=name        - Ensure package is named correctly
721
    -pname=name        - Ensure package is named correctly
662
    -pversion=version  - Ensure package version is correct
722
    -pversion=version  - Ensure package version is correct
663
    -srcdir=path       - Location of the package fragments
723
    -srcdir=path       - Location of the package fragments
-
 
724
    -DeleteVersion     - Alternate Mode. Delete package-version
664
 
725
 
665
  Debug and Testing:
726
  Debug and Testing:
666
    -[no]mergeErrors   - Allow merge errors
727
    -[no]mergeErrors   - Allow merge errors
667
    -[no]preDelete     - Predelete generated package
728
    -[no]preDelete     - Predelete generated package
668
    -[no]keepFragments - Delete input package fragments
729
    -[no]keepFragments - Delete input package fragments
Line 696... Line 757...
696
 
757
 
697
=item B<-pversion=version>
758
=item B<-pversion=version>
698
 
759
 
699
The version of the target package.
760
The version of the target package.
700
 
761
 
-
 
762
=item B<-DeleteVersion>
-
 
763
 
-
 
764
This option invokes an alternate mode of operation. In this mode the specified package version
-
 
765
will be deleted from the package archive.
-
 
766
 
-
 
767
This mode is used by the 'buildtool' while cleaning up failed builds.
-
 
768
 
-
 
769
Is is not an error for the named package versio to not exist.
-
 
770
 
701
=item B<-[no]mergeErrors>
771
=item B<-[no]mergeErrors>
702
 
772
 
703
This option allows the merging process to continue if merge errors are located.
773
This option allows the merging process to continue if merge errors are located.
704
The default is -noMergeErrors
774
The default is -noMergeErrors
705
 
775