aboutsummaryrefslogtreecommitdiff
path: root/ares/maketgz
blob: 2638e2a20992da44a22790af961c9641e07b8624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env perl

$version = $ARGV[0];

if($version eq "") {
    print "Enter version number!\n";
    exit;
}

if(!-f "ares.h") {
    print "run this script in the ares source root dir\n";
    exit;
}

@files=`find . -name FILES`;

my @entries;

sub dirpart {
    my ($file)=@_;
    my @p=split("/", $file);
    $p[$#p]=""; # blank the last one
    my $dir=join("/", @p);

    $dir =~ s/^\.\///; # cut off ./ beginnings

    $dir =~ s/\/$//;  # off / trailers

    if(!$dir) {
        $dir = ".";
    }

    return $dir;
}

sub add {
    my ($file)=@_;

    my $dir=dirpart($file);

    open(FILE, "<$file");
    while(<FILE>) {
        if($_ =~ /^ *\#/) {
            next;
        }
        chomp;
        push @entries, "$dir/$_";
    }
    close(FILE);
}

for(@files) {
    chomp;
    add($_);
}

sub mkalldir {
    my ($dir) = @_;

    my @parts = split("/", $dir);

    #print "IN: $dir\n";

    my $sub="";
    for(@parts) {
        #print "PART: $_\n";

        $sub .= "$_";
        if($_ eq "") {
            next;
        }
        mkdir($sub, 0777);
        #print "make $sub\n";
        $sub .= "/";
    }
    
}

for(@entries) {
    my $dir = dirpart("arescurl-$version/$_");
 #   print "Create $dir\n";
    mkalldir($dir);
 #   print "Copy $_ to $dir\n";
    `cp -p $_ $dir`;
}

`tar -cf arescurl-$version.tar arescurl-$version`;
`gzip -9 arescurl-$version.tar`;
`rm -rf arescurl-$version`;