Subversion Repositories DevTools

Rev

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

Rev 1558 Rev 1560
Line 58... Line 58...
58
use ArrayHashUtils;
58
use ArrayHashUtils;
59
use JatsEnv;
59
use JatsEnv;
60
use JatsError;
60
use JatsError;
61
use JatsSystem;
61
use JatsSystem;
62
 
62
 
63
#
-
 
64
#   The LWP is a part of the Active State Perl, but not the solaris perl
-
 
65
#   If the user has not read the installation doco that insists we use
-
 
66
#   ActiveState perl...
-
 
67
#
-
 
68
my $UserAgentAvailable = eval "require LWP::UserAgent";
-
 
69
 
-
 
70
 
63
 
71
#-------------------------------------------------------------------------------
64
#-------------------------------------------------------------------------------
72
#   Export variables and function into the users name space
65
#   Export variables and function into the users name space
73
#-------------------------------------------------------------------------------
66
#-------------------------------------------------------------------------------
74
our @ISA    = qw(Exporter);
67
our @ISA    = qw(Exporter);
Line 309... Line 302...
309
our %BuildPkgArchive     = ();
302
our %BuildPkgArchive     = ();
310
 
303
 
311
our $RmPkgDetails        = undef;
304
our $RmPkgDetails        = undef;
312
our $RmPvPkgDetails      = undef;
305
our $RmPvPkgDetails      = undef;
313
 
306
 
314
my  $autobuild = $ENV{'GBE_ABT'} || 0;
-
 
315
 
-
 
316
 
307
 
317
#------------------------------------------------------------------------------
308
#------------------------------------------------------------------------------
318
# Initialization actions
309
# Initialization actions
319
#------------------------------------------------------------------------------
310
#------------------------------------------------------------------------------
320
 
311
 
Line 778... Line 769...
778
        Information("PkgPatchNum      =[$PkgPatchNum]");
769
        Information("PkgPatchNum      =[$PkgPatchNum]");
779
        Information("PkgPatchID       =[$PkgPatchID]");
770
        Information("PkgPatchID       =[$PkgPatchID]");
780
        Information("PkgPatchTmpDir   =[$PkgPatchTmpDir]");
771
        Information("PkgPatchTmpDir   =[$PkgPatchTmpDir]");
781
    }
772
    }
782
 
773
 
783
    Information("PkgReleaseNote   =[$PkgReleaseNote]") unless ($autobuild);
-
 
784
    Information("PkgReleaseNote   =[Generated later by ABT]") if ($autobuild);
774
    Information("PkgReleaseNote   =[Generated later by ABT]");
785
    Information("PkgLabel         =[$PkgLabel]");
775
    Information("PkgLabel         =[$PkgLabel]");
786
 
776
 
787
    Information("PkgPreviousVersionStr=[$PkgPreviousVersionStr]");
777
    Information("PkgPreviousVersionStr=[$PkgPreviousVersionStr]");
788
 
778
 
789
    Information("ProjectAcronym   =[$ProjectAcronym]");
779
    Information("ProjectAcronym   =[$ProjectAcronym]");
Line 883... Line 873...
883
 
873
 
884
    # Everything went ok lets begin by creating some dirs...
874
    # Everything went ok lets begin by creating some dirs...
885
    #
875
    #
886
    CreateTargetDirStructure();
876
    CreateTargetDirStructure();
887
 
877
 
888
    # lets get some details for our package
-
 
889
    getRmDetails();
-
 
890
 
-
 
891
    # done
878
    # done
892
    return 1;
879
    return 1;
893
}
880
}
894
 
881
 
895
 
882
 
Line 6987... Line 6974...
6987
        make_directory( $item, 0777 );
6974
        make_directory( $item, 0777 );
6988
    }
6975
    }
6989
}
6976
}
6990
 
6977
 
6991
 
6978
 
6992
 
-
 
6993
 
-
 
6994
#------------------------------------------------------------------------------
-
 
6995
sub getRmDetails
-
 
6996
#
-
 
6997
#    Description:
-
 
6998
#        This is called to update the RM class objects with details from RM database
-
 
6999
#------------------------------------------------------------------------------
-
 
7000
{
-
 
7001
    #
-
 
7002
    #   If this script is invoked by the AutoBuildTool, then we may not be able
-
 
7003
    #   to create a Release Note as the RM entry may not be available. More over
-
 
7004
    #   the ABT will create a release note as the package is made official
-
 
7005
    #
-
 
7006
    if ( $autobuild )
-
 
7007
    {
-
 
7008
        Debug('getRmDetails: AutoBuild Environment supresses function');
-
 
7009
        return;
-
 
7010
    }
-
 
7011
 
-
 
7012
 
-
 
7013
    if ( ! defined($RmPkgDetails) )
-
 
7014
    {
-
 
7015
        # Set defaults for elements in RM if not found
-
 
7016
        DeployUtils::RmPkgInfo->DefaultDescription($PkgDesc);
-
 
7017
        DeployUtils::RmPkgInfo->DefaultLabel($PkgLabel);
-
 
7018
 
-
 
7019
        $RmPkgDetails = DeployUtils::RmPkgInfo->new( 
-
 
7020
                                    { PKG_NAME => $PkgName, 
-
 
7021
                                      PKG_VERSION => ( "$PkgPatchNum" ne "" ) ? $PkgPatchID : $PkgVersionUser } );
-
 
7022
 
-
 
7023
        # lets check to see if we got something
-
 
7024
        if ( $RmPkgDetails->foundPkg() )
-
 
7025
        {
-
 
7026
            $RmPvPkgDetails = DeployUtils::RmPkgInfo->new( { PKG_NAME => $PkgName, 
-
 
7027
                                                             PKG_VERSION => $PkgPreviousVersionStr } );
-
 
7028
            if ( $RmPvPkgDetails->foundDetails() )
-
 
7029
            {
-
 
7030
                sub MultiLineVerb
-
 
7031
                {
-
 
7032
                    my ($prefix, $text ) = @_;
-
 
7033
                    my $zap = 0;
-
 
7034
 
-
 
7035
                    foreach my $line ( split /[\r\n]+/, $text  )
-
 
7036
                    {
-
 
7037
                        Verbose($prefix . "[" . $line . "]");
-
 
7038
                        unless ( $zap )
-
 
7039
                        {
-
 
7040
                            $prefix = ' ' x length($prefix);
-
 
7041
                            $zap = 1;
-
 
7042
                        }
-
 
7043
                    }
-
 
7044
                }
-
 
7045
 
-
 
7046
                Information("Retrieved Package Details from Release Manager");
-
 
7047
                if ( IsVerbose(1) )
-
 
7048
                {
-
 
7049
                    MultiLineVerb("RM pkg_name       = ",  $RmPkgDetails->pkg_name()       );
-
 
7050
                    MultiLineVerb("RM pkg_id         = ",  $RmPkgDetails->pkg_id()         );
-
 
7051
                    MultiLineVerb("RM pv_id          = ",  $RmPkgDetails->pv_id()          );
-
 
7052
                    MultiLineVerb("RM pv_description = ",  $RmPkgDetails->pv_description() );
-
 
7053
                    MultiLineVerb("RM pv_overview    = ",  $RmPkgDetails->pv_overview()    );
-
 
7054
                    MultiLineVerb("RM pv_reason      = ",  $RmPkgDetails->pv_reason()      );
-
 
7055
                    MultiLineVerb("RM pv_label       = ",  $RmPkgDetails->pv_label()       );
-
 
7056
                    MultiLineVerb("RM previousPv_id  = ",  $RmPvPkgDetails->pv_id()        );
-
 
7057
                    MultiLineVerb("RM pv_dlocked     = ",  $RmPvPkgDetails->pv_dlocked()   );
-
 
7058
                }
-
 
7059
            }
-
 
7060
            else
-
 
7061
            {
-
 
7062
                # our package does not exist in release manager
-
 
7063
                Warning("Could not retrieve package $PkgName $PkgVersionUser previous version " .
-
 
7064
                        "details from Release Manager.")
-
 
7065
            }
-
 
7066
        }
-
 
7067
        else
-
 
7068
        {
-
 
7069
            # our package does not exist in release manager 
-
 
7070
            Warning("Package $PkgName $PkgVersionUser does not exist in the Release Manager",
-
 
7071
                    "Please check configuration.")
-
 
7072
        }
-
 
7073
    }
-
 
7074
}  
-
 
7075
 
-
 
7076
 
-
 
7077
 
-
 
7078
# This is now depricated
6979
# This is now depricated
7079
sub generateReleaseNote
6980
sub generateReleaseNote
7080
{
6981
{
7081
    Error("generateReleaseNote is depricated please use generateHtmlReleaseNote");
6982
    Error("generateReleaseNote is depricated please use generateHtmlReleaseNote");
7082
    return 1;
6983
    return 1;
7083
}
6984
}
7084
 
6985
 
7085
 
-
 
7086
 
-
 
7087
#------------------------------------------------------------------------------
6986
#------------------------------------------------------------------------------
7088
sub generateHtmlReleaseNote
6987
sub generateHtmlReleaseNote
7089
#
6988
#
7090
#    Description:
6989
#    Description:
7091
#
6990
#
7092
#------------------------------------------------------------------------------
6991
#------------------------------------------------------------------------------
7093
{
6992
{
7094
 
-
 
7095
    #
-
 
7096
    #   If this script is invoked by the AutoBuildTool, then we may not be able
-
 
7097
    #   to create a Release Note as the RM entry may not be available. More over
-
 
7098
    #   the ABT will create a release note as the package is made official
-
 
7099
    #
-
 
7100
    if ( $autobuild )
-
 
7101
    {
-
 
7102
        Warning('AutoBuild Environment. Release notes generated later');
-
 
7103
        return;
-
 
7104
    }
-
 
7105
 
-
 
7106
    #
-
 
7107
    #   Ensure the Release directory is present
-
 
7108
    #
-
 
7109
    make_directory( $ReleaseDir, 0777 );
-
 
7110
 
-
 
7111
    if ( ! getRmReleaseNote() )
-
 
7112
    {
-
 
7113
        Error("No Release Manager details, release note not generated.");
-
 
7114
    }
-
 
7115
}
-
 
7116
 
-
 
7117
 
-
 
7118
 
-
 
7119
#------------------------------------------------------------------------------
-
 
7120
sub getRmReleaseNote
-
 
7121
#
-
 
7122
#    Description:
-
 
7123
#
-
 
7124
#------------------------------------------------------------------------------
-
 
7125
{
-
 
7126
    # lets get some details for our package
-
 
7127
    getRmDetails();
-
 
7128
 
-
 
7129
 
-
 
7130
    # now we need to ensure that our local build file dependencies are
-
 
7131
    # the same as those we have entered in the Release Manager database.
-
 
7132
    checkDependencies();
-
 
7133
 
-
 
7134
 
-
 
7135
    # let's update the release contents now
-
 
7136
    #
-
 
7137
    generateProductContents();
-
 
7138
 
-
 
7139
    #
-
 
7140
    #   Is the interface available
-
 
7141
    #
-
 
7142
    unless ( $UserAgentAvailable )
-
 
7143
    {
-
 
7144
        Warning("Unable to retrieve Release Manager Release Notes: LWP module missing");
-
 
7145
        return 0;
-
 
7146
    }
-
 
7147
 
-
 
7148
    our $GBE_RM_URL;
-
 
7149
    EnvImport('GBE_RM_URL');
-
 
7150
    
-
 
7151
    Information("Retrieving Release Notes From Release Manager...Please wait...");
-
 
7152
 
-
 
7153
    my $user_agent = LWP::UserAgent->new( timeout => 30 );
-
 
7154
    my $response = $user_agent->get( $GBE_RM_URL . '/_adhoc_release_notes.asp?pv_id='. $RmPkgDetails->pv_id(),
-
 
7155
                                    ':content_file' => "$PkgReleaseNote\.html");
-
 
7156
    if ( $response->is_success )
-
 
7157
    {
-
 
7158
        Verbose("Retrieved Release Manager HTML Release note [$PkgReleaseNote\.html]");
-
 
7159
        return 1;
-
 
7160
    }
-
 
7161
    else
-
 
7162
    {
-
 
7163
        Warning("Unable to retrieve Release Manager Release Notes");
6993
    Warning('Deprecated Function: generateHtmlReleaseNote');
7164
        return 0;
-
 
7165
    }
-
 
7166
}
-
 
7167
 
-
 
7168
#------------------------------------------------------------------------------
-
 
7169
sub checkDependencies
-
 
7170
#
-
 
7171
#------------------------------------------------------------------------------
-
 
7172
{
-
 
7173
    my ($i);
-
 
7174
    my ($retValue) = 0;
-
 
7175
    
-
 
7176
    # first we want to loop through all our local build archives
-
 
7177
    # 
-
 
7178
    my ($versionStr) = "";
-
 
7179
    foreach $i ( $BuildFileInfo->getDpkgArchiveList() )
-
 
7180
    {
-
 
7181
        my $moduleInfo = $BuildFileInfo->getDpkgArchiveInfo($i);
-
 
7182
        
-
 
7183
        $versionStr = "$moduleInfo->{version}"; 
-
 
7184
        $versionStr .= "\.$moduleInfo->{proj}" if ( $moduleInfo->{proj} ne "" );
-
 
7185
        my $depObj = $RmPkgDetails->getDependencyObject($i);
-
 
7186
 
-
 
7187
        if ( defined ( $depObj ) )
-
 
7188
        {
-
 
7189
            if ( $depObj->pkg_version() ne "$versionStr" )
-
 
7190
            {
-
 
7191
                Warning("Dependency difference, [$i] Local version $versionStr, RM version " . $depObj->pkg_version());
-
 
7192
                $retValue = 1;
-
 
7193
            }
-
 
7194
        }  
-
 
7195
        else
-
 
7196
        {
-
 
7197
            Warning("Dependency difference, [$i] Cannot locate archive in Release Manager database.");
-
 
7198
            $retValue = 1;
-
 
7199
        }
-
 
7200
    }
-
 
7201
 
-
 
7202
    # lets check to see if we detected a difference 
-
 
7203
    if ( $retValue != 0 )
-
 
7204
    { 
-
 
7205
        Error("Difference detected between the local build.pl and Release Manager config.",
-
 
7206
              "Please check Release Manager configuration.");
-
 
7207
    }
-
 
7208
 
-
 
7209
 
-
 
7210
 
-
 
7211
    # now we check release manager details against our local ones
-
 
7212
    #
-
 
7213
    foreach $i ( $RmPkgDetails->getDependencyNames() )
-
 
7214
    {
-
 
7215
        if ( "$i" eq "ishieldlibimg" || "$i" eq "ishieldlibicon" )
-
 
7216
        {
-
 
7217
            # these two packages are a special case,
-
 
7218
            # we do not include them in the dependecy check
-
 
7219
            #
-
 
7220
            next;
-
 
7221
        }
-
 
7222
 
-
 
7223
        my $moduleInfo = $BuildFileInfo->getDpkgArchiveInfo($i);
-
 
7224
 
-
 
7225
        if ( defined ( $moduleInfo ) )
-
 
7226
        {
-
 
7227
            $versionStr = "$moduleInfo->{version}"; 
-
 
7228
            $versionStr .= "\.$moduleInfo->{proj}" if ( $moduleInfo->{proj} ne "" );
-
 
7229
            my $depObj = $RmPkgDetails->getDependencyObject($i);
-
 
7230
 
-
 
7231
            if ( $depObj->pkg_version() ne "$versionStr" )
-
 
7232
            {
-
 
7233
                Warning("Dependency difference, [$i] local version $versionStr, RM version " . $depObj->pkg_version());
-
 
7234
                $retValue = 1;
-
 
7235
            }
-
 
7236
        }  
-
 
7237
        else
-
 
7238
        {
-
 
7239
            Warning("Dependency difference, cannot locate archive [$i] in local build.pl.");
-
 
7240
            $retValue = 1;
-
 
7241
        }
-
 
7242
    }
-
 
7243
 
-
 
7244
    # lets check to see if we detected a difference 
-
 
7245
    if ( $retValue != 0 )
-
 
7246
    { 
-
 
7247
        Error("Difference detected between Release Manager config and the local build.pl. ",
-
 
7248
               "Please check the local configuration.");
-
 
7249
    }
-
 
7250
 
-
 
7251
    return 1;
-
 
7252
}
6994
}
7253
 
6995
 
7254
#-------------------------------------------------------------------------------
6996
#-------------------------------------------------------------------------------
7255
# Function        : generateXmlDependancy
6997
# Function        : generateXmlDependancy
7256
#
6998
#
Line 7321... Line 7063...
7321
    my $filename = "PkgInfo_$PkgName" . '.xml';
7063
    my $filename = "PkgInfo_$PkgName" . '.xml';
7322
    my $targetTag;
7064
    my $targetTag;
7323
 
7065
 
7324
    return if ( ! ActivePlatform($platforms) );
7066
    return if ( ! ActivePlatform($platforms) );
7325
    Information("Generating XML dependancy information from RM data: $filename");
7067
    Information("Generating XML dependancy information from RM data: $filename");
-
 
7068
    Warning ("This function is not compatible with Escrow builds");
7326
 
7069
 
7327
    #
7070
    #
7328
    #   Insert defaults
7071
    #   Insert defaults
7329
    #
7072
    #
7330
    $data{default_visible} = 1;
7073
    $data{default_visible} = 1;
Line 7734... Line 7477...
7734
 
7477
 
7735
    # done.
7478
    # done.
7736
    return 1;
7479
    return 1;
7737
}
7480
}
7738
 
7481
 
7739
 
-
 
7740
#------------------------------------------------------------------------------
-
 
7741
sub generateProductContents
-
 
7742
#
-
 
7743
#------------------------------------------------------------------------------
-
 
7744
{
-
 
7745
    if ( ! defined($RmPkgDetails) )
-
 
7746
    {
-
 
7747
        # Set defaults for elements in RM if not found
-
 
7748
        DeployUtils::RmPkgInfo->DefaultDescription($PkgDesc);
-
 
7749
        DeployUtils::RmPkgInfo->DefaultLabel($PkgLabel);
-
 
7750
 
-
 
7751
        $RmPkgDetails = DeployUtils::RmPkgInfo->new( 
-
 
7752
                        {
-
 
7753
                            PKG_NAME => $PkgName,
-
 
7754
                            PKG_VERSION => ( "$PkgPatchNum" ne "" ) ? $PkgPatchID : $PkgVersionUser
-
 
7755
                        } );
-
 
7756
    }
-
 
7757
 
-
 
7758
 
-
 
7759
    # we only go on if we have a pkg 
-
 
7760
    if ( $RmPkgDetails->foundPkg() )
-
 
7761
    {
-
 
7762
        # lets zap the product contents
-
 
7763
        # only if the release manager entry is not locked.
-
 
7764
        if ( $RmPkgDetails->pv_dlocked() ne "Y" )
-
 
7765
        {
-
 
7766
           Error("Failed to zap product contents.")
-
 
7767
                if ( ! $RmPkgDetails->zapProductContents( $Platform ) );
-
 
7768
        }
-
 
7769
 
-
 
7770
 
-
 
7771
        # lets get a listing of the products contents
-
 
7772
        #
-
 
7773
        File::Find::find( \&ProductContentsFind, "$PkgBaseDir/$TargetBaseDir");
-
 
7774
    }
-
 
7775
    else
-
 
7776
    {
-
 
7777
        Warning("Unable to load product contents because we do not have a connection to Release Manager.");
-
 
7778
    }
-
 
7779
 
-
 
7780
 
-
 
7781
    # done
-
 
7782
    return 1;
-
 
7783
}
-
 
7784
 
-
 
7785
 
-
 
7786
#------------------------------------------------------------------------------
-
 
7787
sub ProductContentsFind
-
 
7788
#
-
 
7789
#    Description:
-
 
7790
#        This subroutine is used to locate all associated items that 
-
 
7791
#        have been designated for the product.
-
 
7792
#
-
 
7793
#------------------------------------------------------------------------------
-
 
7794
{
-
 
7795
    my($item)= "$File::Find::name";
-
 
7796
    my($base)= File::Basename::basename($item);
-
 
7797
 
-
 
7798
 
-
 
7799
    # we get the absolute path from the find, but we only require
-
 
7800
    # a relative path from the starting dir.
-
 
7801
 
-
 
7802
    my ($_item)   = $item;
-
 
7803
    my ($_subStr) = "$PkgBaseDir\/$TargetBaseDir";
-
 
7804
    $_item =~ s/$_subStr//;
-
 
7805
 
-
 
7806
    my $cksumStr;
-
 
7807
    my $cksumValue;
-
 
7808
    my $cksumSize;
-
 
7809
    my $cksumName;
-
 
7810
    my $_tmpStr;
-
 
7811
    my $retVal;
-
 
7812
    my $cksumPath;
-
 
7813
 
-
 
7814
    if ( "$base" ne "." && "$base" ne ".." && "x$_item" ne "x" )
-
 
7815
    {
-
 
7816
        $_item =~ s/^\///;
-
 
7817
        $cksumPath = $_item;
-
 
7818
        $cksumName = File::Basename::basename($_item);
-
 
7819
 
-
 
7820
        # we need to determine which file we are dealing with
-
 
7821
        if ( ! -d "$item")
-
 
7822
        {
-
 
7823
            $cksumStr  = `cksum "$item"`;
-
 
7824
            $retVal    = $? / 256;
-
 
7825
            if ( $retVal != 0 )
-
 
7826
            {
-
 
7827
                Error("Failed to determine cksum for product content item [$item].") 
-
 
7828
            }
-
 
7829
            else
-
 
7830
            {
-
 
7831
                chomp($cksumStr);
-
 
7832
                $cksumStr =~ s/^\s+|\s+$//g;
-
 
7833
                if ( $cksumStr =~ m/^([0-9]*)\s*([0-9]*)\s*(.*)$/ )
-
 
7834
                {
-
 
7835
                    ($cksumValue, $cksumSize, $_tmpStr) = ($1, $2, $3);
-
 
7836
                    $cksumValue =~ s/^\s+|\s+$//g;
-
 
7837
                    $cksumSize  =~ s/^\s+|\s+$//g;
-
 
7838
                    $_tmpStr    =~ s/^\s+|\s+$//g;
-
 
7839
                }
-
 
7840
                else
-
 
7841
                {
-
 
7842
                    $cksumValue = '';
-
 
7843
                    $cksumSize  = 0;
-
 
7844
                    $_tmpStr    = '';
-
 
7845
                }
-
 
7846
            }
-
 
7847
 
-
 
7848
            $cksumPath = File::Basename::dirname($_item);
-
 
7849
            if ( $cksumPath eq "." )
-
 
7850
            {
-
 
7851
                $cksumPath = '';
-
 
7852
            }
-
 
7853
            else
-
 
7854
            {
-
 
7855
                $cksumPath =~ s/$/\//;
-
 
7856
            }
-
 
7857
 
-
 
7858
            # we only mess with the product contents
-
 
7859
            # if the package is not released.
-
 
7860
            if ( $RmPkgDetails->pv_dlocked() ne "Y" )
-
 
7861
            {
-
 
7862
                Error("Failed to insert product content item.")
-
 
7863
                     if ( ! $RmPkgDetails->insertProductContentItem( $Target, $cksumPath, $cksumName, '', $cksumSize, $cksumValue) );
-
 
7864
            }
-
 
7865
            else
-
 
7866
            {
-
 
7867
                Verbose("product item - $Target, $cksumPath, $cksumName, '', $cksumSize, $cksumValue");
-
 
7868
            }
-
 
7869
        }
-
 
7870
        else
-
 
7871
        {
-
 
7872
            $cksumPath =~ s/$/\//;
-
 
7873
            if ( $RmPkgDetails->pv_dlocked() ne "Y" )
-
 
7874
            {
-
 
7875
               Error("Failed to insert product content item.")
-
 
7876
                     if ( ! $RmPkgDetails->insertProductContentItem( $Target, $cksumPath, '', '', 0, '') );
-
 
7877
            }
-
 
7878
            else
-
 
7879
            {
-
 
7880
                Verbose("product dir - $Target, $cksumPath, '', '', 0, ''");
-
 
7881
            }
-
 
7882
        }
-
 
7883
    }
-
 
7884
}
-
 
7885
 
-
 
7886
#-------------------------------------------------------------------------------
7482
#-------------------------------------------------------------------------------
7887
# Function        : make_directory
7483
# Function        : make_directory
7888
#
7484
#
7889
# Description     : Create a directory if it does not already exist
7485
# Description     : Create a directory if it does not already exist
7890
#                   Simple function to provide user messages on the way
7486
#                   Simple function to provide user messages on the way