-
Notifications
You must be signed in to change notification settings - Fork 1
/
mktar.pl
executable file
·40 lines (33 loc) · 1012 Bytes
/
mktar.pl
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
#! /usr/bin/perl -w
#
# create a tar ball snapshot from cvs repository.
#
# 2005-12-15, jw
#
use Data::Dumper;
my $srcdir = 'src';
my $version_file = "$srcdir/configure.ac";
my %symlinks =
(
'FAQ' => 'doc/FAQ',
'doc/install.sh' => '../install.sh'
);
for my $l (keys %symlinks)
{
my $ll = "$srcdir/$l";
next if -l $ll;
print "replacing $ll with a symlink to $symlinks{$l}\n";
unlink $ll;
symlink $symlinks{$l}, $ll;
}
my %version;
open IN, "<", $version_file or die "unable to read $version_file: $!";
$version = $1 if <IN> =~ /AC_INIT\(\[[^\]]+\],\[(\d+\.\d+\.\d+)\]/;
close IN;
my $tmpdir = "/tmp/mktar-$^T";
mkdir $tmpdir or die "cannot mkdir $tmpdir: $!";
system "cp -a $srcdir $tmpdir" and die "'cp -a $srcdir $tmpdir' failed: $!";
rename "$tmpdir/$srcdir", "$tmpdir/screen-$version" or die "rename to screen-$version failed: $!";
system "tar zcf - -C $tmpdir > screen-$version.tar.gz screen-$version";
system "rm -rf $tmpdir";
print "screen-$version.tar.gz written.\n";