diff -r a9d4531388d0 -r d90029decf65 bldsystemtools/commonbldutils/remove_old_builds.pl --- a/bldsystemtools/commonbldutils/remove_old_builds.pl Wed Mar 31 23:20:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -#!perl -w -# -# remove_old_builds.pl -# -# usage: -# perl remove_old_builds.pl current_build_number build-directory required-free-space -# -use strict; - -sub usage - { - print <) - { - if (/\s+(\d+) bytes free/) { $s=$1;} - } - return $s; - } - -my $current_build=$ARGV[0]; -my $bld_dir=$ARGV[1]; -my $space=$ARGV[2]; - -unless ($space) { usage() }; # Must have all three args. So check for last one only. - -open DIRS, "dir /b /ad /od $bld_dir |" or die "Cannot open DIRS $bld_dir"; # /b = "bare output" /ad = directories only /od = sort by date -while (my $name = ) - { - if (freespace($bld_dir) >= $space) - { last; } - chomp $name; - chomp $current_build; - - if(($name =~ /^((D|T|M|MSF|TB|E|(\d{2,3}_))?(\d+))(([a-z]\.\d+)|([a-z])|(\.\d+))?/) && ($name ne $current_build)) - { - print "Removing $bld_dir\\$name\n"; - if (system("rmdir /s /q $bld_dir\\$name")) - { - print "ERROR: Failed to remove: $bld_dir\\$name\n"; - } - } - } -close DIRS; - -if (freespace($bld_dir) < $space) - { - print "ERROR: Cannot create $space free bytes in $bld_dir\n"; - exit 1; - } - -exit 0; - - - -