SF.net SVN: opencsw:[680] buildfarm/bin/cleanup-experimental
dmichelsen at users.sourceforge.net
dmichelsen at users.sourceforge.net
Thu Feb 19 10:55:04 CET 2015
Revision: 680
http://sourceforge.net/p/opencsw/code/680
Author: dmichelsen
Date: 2015-02-19 09:55:04 +0000 (Thu, 19 Feb 2015)
Log Message:
-----------
cleanup-experimental: Do not remove files when there is a .nocleanup in the project directory
Modified Paths:
--------------
buildfarm/bin/cleanup-experimental
Modified: buildfarm/bin/cleanup-experimental
===================================================================
--- buildfarm/bin/cleanup-experimental 2014-10-31 12:30:45 UTC (rev 679)
+++ buildfarm/bin/cleanup-experimental 2015-02-19 09:55:04 UTC (rev 680)
@@ -41,31 +41,36 @@
}
closedir D;
-
opendir D, $experimentaldir;
-my @projects = grep { !/^\.\.?$/ } readdir D;
+my @projects = grep { !/^\.zfs$/ && !/^\.\.?$/ } readdir D;
closedir D;
+# If there is <project>/.nocleanup then do nothing here - someone may use this to build catalogs for downgraded packages
+ at projects = grep { ! -e "${experimentaldir}/$_/.nocleanup" } @projects;
+
foreach my $p (sort @projects) {
+ my $deleted_something = 0;
opendir D, "$experimentaldir/$p";
my @files = grep { !/^\.\.?$/ } readdir D;
closedir D;
+ my @keep; # These are the remaining files after deletion
foreach my $f (sort @files) {
- # Ignore artifact from submitpkg
- next if( $f eq "newpkgs.mail" );
-
# Check for package files with identical names
if( exists $allpkgfiles{$f} ) {
system( "cmp -s $experimentaldir/$p/$f $allpkgsdir/$f" );
if( $? >> 8 == 0 ) {
print "Deleting released pkg $p/$f\n";
unlink( "$experimentaldir/$p/$f" );
+ $deleted_something = 1;
+ next;
} else {
# Contents is different.
print STDERR " Contents differs: $p/$f\n";
print "Deleting anyway $p/$f\n";
unlink( "$experimentaldir/$p/$f" );
+ $deleted_something = 1;
+ next;
}
}
@@ -73,6 +78,7 @@
my ($name, $rev) = ($f =~ /^([^-]+).*,REV=(\d\d\d\d\.\d\d\.\d\d)/);
if( !defined $rev ) {
print STDERR " No REV in pkgname: $p/$f\n";
+ push @keep, $f;
next;
}
if( exists $latestpkgrev{$name} ) {
@@ -81,9 +87,17 @@
print STDERR " Released: $latestpkgname{$name}\n";
print "Deleting anyway $p/$f\n";
unlink( "$experimentaldir/$p/$f" );
+ $deleted_something = 1;
+ next;
}
}
+ push @keep, $f;
}
+
+ # If we deleted all files from the directory, then also delete the directory itself
+ if( $deleted_something && @keep == 0 ) {
+ rmdir "$experimentaldir/$p";
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list