curl/ares/maketgz

101 строка
1.5 KiB
Plaintext
Исходник Обычный вид История

2003-10-09 00:18:15 +04:00
#!/usr/bin/env perl
$version = $ARGV[0];
2004-01-29 14:33:31 +03:00
$name="c-ares";
2003-10-09 00:18:15 +04:00
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;
}
2003-10-09 00:25:37 +04:00
if(!-f "configure") {
`autoconf`;
}
2003-10-09 00:18:15 +04:00
@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) {
2004-01-29 14:33:31 +03:00
my $dir = dirpart("$name-$version/$_");
2003-10-09 00:18:15 +04:00
# print "Create $dir\n";
mkalldir($dir);
# print "Copy $_ to $dir\n";
`cp -p $_ $dir`;
}
2004-01-29 14:33:31 +03:00
# make a tarball
`tar -cf $name-$version.tar $name-$version`;
# gzip the tarball
`gzip -9 $name-$version.tar`;
# remove the dir
`rm -rf $name-$version`;
print "NOTE: now cvs tag this release!\n";