Subversion Repositories DevTools

Rev

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

Rev 5125 Rev 5253
Line 54... Line 54...
54
my $opt_limit;
54
my $opt_limit;
55
my $opt_quick;
55
my $opt_quick;
56
my $opt_phase = '123';                      # Default - do all, but don't save data
56
my $opt_phase = '123';                      # Default - do all, but don't save data
57
my $opt_purge;
57
my $opt_purge;
58
my $opt_pcount = 0;
58
my $opt_pcount = 0;
-
 
59
my $opt_explain;
59
 
60
 
60
#
61
#
61
#   Globals
62
#   Globals
62
#
63
#
63
my $progBase;
64
my $progBase;
Line 107... Line 108...
107
#
108
#
108
my $result = GetOptions (
109
my $result = GetOptions (
109
                "help+"         => \$opt_help,          # flag, multiple use allowed
110
                "help+"         => \$opt_help,          # flag, multiple use allowed
110
                "manual"        => \$opt_manual,        # flag
111
                "manual"        => \$opt_manual,        # flag
111
                "verbose:+"     => \$opt_verbose,       # flag
112
                "verbose:+"     => \$opt_verbose,       # flag
-
 
113
                "explain:+"     => \$opt_explain,       # flag
112
                "test:+"        => \$opt_test,          # Test a version string
114
                "test:+"        => \$opt_test,          # Test a version string
113
                "limit:n"       => \$opt_limit,         #
115
                "limit:n"       => \$opt_limit,         #
114
                "phase:s"       => \$opt_phase,         # Phase to do
116
                "phase:s"       => \$opt_phase,         # Phase to do
115
                "quick"         => \$opt_quick,         # Don't look for indirects
117
                "quick"         => \$opt_quick,         # Don't look for indirects
116
                "purge"         => \$opt_purge,         # Purge old quarantined packages
118
                "purge"         => \$opt_purge,         # Purge old quarantined packages
Line 256... Line 258...
256
    # if we are not or cannot connect then return 0 as we have not found anything
258
    # if we are not or cannot connect then return 0 as we have not found anything
257
    connectRM(\$RM_DB) unless $RM_DB;
259
    connectRM(\$RM_DB) unless $RM_DB;
258
 
260
 
259
    # Get all Releases
261
    # Get all Releases
260
    # From non-archived releases
262
    # From non-archived releases
261
    my $m_sqlstr = "SELECT prj.PROJ_NAME, rt.RTAG_NAME, rt.PROJ_ID, rt.RTAG_ID, rt.official" .
263
    my $m_sqlstr = "SELECT prj.PROJ_NAME, rt.RTAG_NAME, rt.PROJ_ID, rt.RTAG_ID, rt.official, TRUNC (SYSDATE - rt.official_stamp) as OFFICIAL_STAMP_DAYS, TRUNC (SYSDATE - rt.created_stamp) as CREATED_STAMP_DAYS" .
262
                   " FROM release_manager.release_tags rt, release_manager.projects prj" .
264
                   " FROM release_manager.release_tags rt, release_manager.projects prj" .
263
                   " WHERE prj.PROJ_ID = rt.PROJ_ID " .
265
                   " WHERE prj.PROJ_ID = rt.PROJ_ID " .
264
                   "   AND rt.official != 'A' ";
266
                   "   AND rt.official != 'A' ORDER BY UPPER(prj.PROJ_NAME), UPPER(rt.RTAG_NAME)";
265
#                   "   AND rt.official != 'Y'" .
267
#                   "   AND rt.official != 'Y'" .
266
 
268
 
267
    Verbose3("getReleaseDetails: $m_sqlstr");
269
    Verbose3("getReleaseDetails: $m_sqlstr");
268
    my $sth = $RM_DB->prepare($m_sqlstr);
270
    my $sth = $RM_DB->prepare($m_sqlstr);
269
    if ( defined($sth) )
271
    if ( defined($sth) )
Line 274... Line 276...
274
            {
276
            {
275
                while ( @row = $sth->fetchrow_array )
277
                while ( @row = $sth->fetchrow_array )
276
                {
278
                {
277
                    my $rtag_id =$row[3];
279
                    my $rtag_id =$row[3];
278
                    my $proj_id = $row[2];
280
                    my $proj_id = $row[2];
-
 
281
                    my $official = $row[4];
-
 
282
                    my $age = defined($row[5]) ? $row[5] : $row[6];
-
 
283
                    
-
 
284
#if ( $official eq 'Y' ) {
-
 
285
#    Information("Closed Age ($proj_id) : $age : $row[0], $row[1]");
-
 
286
#}
-
 
287
#                    if ( $official eq 'Y' && $age && $age > 300 )
-
 
288
#                    {
-
 
289
#                        next;
-
 
290
#                    }
279
 
291
 
280
                    $Releases{$rtag_id}{pName} = $row[0];
292
                    $Releases{$rtag_id}{pName} = $row[0];
281
                    $Releases{$rtag_id}{name} = $row[1];
293
                    $Releases{$rtag_id}{name} = $row[1];
282
                    $Releases{$rtag_id}{proj_id} = $proj_id;
294
                    $Releases{$rtag_id}{proj_id} = $proj_id;
283
                    $Releases{$rtag_id}{rtag_id} = $rtag_id;
295
                    $Releases{$rtag_id}{rtag_id} = $rtag_id;
284
                    $Releases{$rtag_id}{official} = $row[4];
296
                    $Releases{$rtag_id}{official} = $row[4];
-
 
297
                    $Releases{$rtag_id}{officialDays} = defined($row[5]) ? $row[5] : $row[6] ;
-
 
298
                    $Releases{$rtag_id}{createdDays} = $row[6];
285
 
299
 
286
                    print join (',',@row), "\n" if ($opt_verbose > 2);
300
                    print join (',',@row), "\n" if ($opt_verbose > 2);
287
                }
301
                }
288
            }
302
            }
289
            $sth->finish();
303
            $sth->finish();
Line 978... Line 992...
978
    {
992
    {
979
        foreach my $pkgVersion ( sort keys %{$pkgPvid{$pkgName}} )
993
        foreach my $pkgVersion ( sort keys %{$pkgPvid{$pkgName}} )
980
        {
994
        {
981
            my $mtime = $pkgPvid{$pkgName}{$pkgVersion}{mtime} || 0;
995
            my $mtime = $pkgPvid{$pkgName}{$pkgVersion}{mtime} || 0;
982
            my $pvid = $pkgPvid{$pkgName}{$pkgVersion}{pvid};
996
            my $pvid = $pkgPvid{$pkgName}{$pkgVersion}{pvid};
-
 
997
            my $keepReason = '';
-
 
998
            my $entry = $Packages{$pvid};
983
 
999
 
984
            if ( $pvid && $mtime )
-
 
985
            {
1000
            {
-
 
1001
                # Examine entry. Determine a reason to keep the package
-
 
1002
 
986
                my $entry = $Packages{$pvid};
1003
                unless ($entry) { $keepReason ='NoPackageEntry'; last;}
987
                next if ( exists $entry->{tlp} || exists $entry->{slp} || exists $entry->{sdk} || exists $entry->{dm} );
1004
                unless ($entry->{dpkg_archive}) { $keepReason ='NotInArchive'; last;}
988
                next if ( $mtime <= $config{retain} );
1005
                unless ($pvid) { $keepReason = 'NoPVid'; last;}
989
                next unless ( $entry->{buildStandard} );
1006
                if (exists $entry->{tlp}) { $keepReason ='tlp'; last;}
990
                next if ( $entry->{isPatch} );
1007
                if (exists $entry->{slp}) { $keepReason ='slp'; last;}
991
                next if ( $entry->{locked} ne 'Y');
1008
                if (exists $entry->{sdk}) { $keepReason ='sdk'; last;}
992
#                next if ( $entry->{buildType} eq 'M' );
1009
                if (exists $entry->{dm}) { $keepReason ='dm'; last;}
-
 
1010
                if ($entry->{isPatch}) { $keepReason ='isPatch'; last;}
-
 
1011
                unless ($mtime) { $keepReason ='ZeroTime'; last;}
-
 
1012
                if ($mtime <= $config{retain}) { $keepReason ='mtime<Retain:' . ($config{retain} - $mtime); last;}
-
 
1013
                unless ($entry->{buildStandard}) { $keepReason ='NoBuildStandard' . $mtime; last;}
-
 
1014
                if ($entry->{locked} ne 'Y') { $keepReason ='NotLocked:' . $entry->{locked}; last;}
-
 
1015
                #if ($entry->{buildType} eq 'M') { $keepReason ='ManualBuild:' . $entry->{buildType}; last;}
-
 
1016
 
-
 
1017
                $pkgPvid{$pkgName}{$pkgVersion}{keepReason} = $keepReason;
-
 
1018
            }
993
 
1019
 
-
 
1020
            unless ( $keepReason )
-
 
1021
            {
994
                Verbose2("Quarantine:$pvid, $pkgName, $pkgVersion, Age:$mtime, Lock:$entry->{locked}, Patch:$entry->{isPatch}, BS:$entry->{buildStandard}, BT:$entry->{buildType}");
1022
                Verbose2("Quarantine:$pvid, $pkgName, $pkgVersion, Age:$mtime, Lock:$entry->{locked}, Patch:$entry->{isPatch}, BS:$entry->{buildStandard}, BT:$entry->{buildType}");
995
                quarantineItem( 'Q', $mtime, join('/', $config{dpkg_archive}, $pkgName, $pkgVersion ) );
1023
                quarantineItem( 'Q', $mtime, join('/', $config{dpkg_archive}, $pkgName, $pkgVersion ) );
996
            }
1024
            }
-
 
1025
 
-
 
1026
            if ($opt_explain)
-
 
1027
            {
-
 
1028
                Information("Reason:$pvid, $pkgName, $pkgVersion, Reason:$keepReason");
-
 
1029
            }
997
        }
1030
        }
998
    }
1031
    }
999
 
1032
 
1000
    #
1033
    #
1001
    # Perform the quarantine
1034
    # Perform the quarantine