https://github.com/genome/genome
Raw File
Tip revision: 80a1f6d278abc6ee393b42fd8ba5986cef849015 authored by Thomas B. Mooney on 11 June 2015, 22:01:25 UTC
Merge pull request #792 from tmooney/print_lock_resource_not_object_hash
Tip revision: 80a1f6d
clean-debian-builds.pl
#!/usr/bin/env genome-perl
use strict;
use warnings;
use File::Basename;
chdir File::Basename::dirname(__FILE__);
my @dirs = (glob("*/debian/*"), glob("*/ubuntu-lucid/*"), glob("vendor/*/debian/*"), glob("vendor/*/ubuntu-lucid/*"));

@dirs = grep { 
        if (m{^(vendor/|)(.*)/(debian|ubuntu-lucid)/(.*)}) {
            if ($2 eq $4) {
                ($_);
            }
            else {
                #print "missed $_\n";
                ();
            }
        }
        else {
            die "odd: $_";
        }
    }
    @dirs;

if (@dirs == 0) {
    print "No directories with debian build cruft found under $ENV{PWD} (checkted for 'debian' and 'ubuntu-lucid').\n";
    exit;
}

print "Removing all data from these directories under $ENV{PWD}:\n\t",join("\n\t",@dirs),"\n\n";
print "Press ctr-c in 5 seconds if you don't want to do this...\n";

sleep 5;

for my $dir (@dirs) {
    my $cmd = "rm -rf '$dir'";
    print "RUN: $cmd\n";
    my $rv = system $cmd;
    $rv /= 256;
    if ($rv) {
        warn "error for $dir: $!";
        next;
    }
}

back to top