File: mkdist

package info (click to toggle)
perl-tk 1:800.025-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,444 kB
  • ctags: 19,081
  • sloc: ansic: 206,740; perl: 40,187; makefile: 4,371; sh: 2,373; yacc: 762
file content (82 lines) | stat: -rwxr-xr-x 1,452 bytes parent folder | download
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
#!/usr/local/bin/perl -w
use strict;

use ExtUtils::Manifest "/mani/";
use POSIX qw(getcwd);

use vars qw($opt_dev $opt_man $opt_lax $version);

use Getopt::Long;

GetOptions('dev=s','man','lax');

sub System
{
 print STDERR join(' ',@_),"\n" if (@_ < 8);
 die "Cannot " . join(' ',@_) if (system(@_));
}

open(MF,"<Tk.pm") || die "Cannot open Tk.pm:$!";
while (<MF>)
 {
  if (/\$Tk::VERSION\s*=\s*'([^']+)'/)
   {
    $version = $1;
    last;
   }
 }
close(MF);

die "Cannot find version\n" unless defined $version;

System("perl","Makefile.PL") unless (-r "Makefile");

System("make","manifest") if ($opt_man);

my $path  = getcwd();
my $dir   = $path;
my $files = maniread();
$dir      = 'Tk';

my $snag = 0;

foreach my $file (keys %$files)
 {
  unless (-f $file)
   {
    $snag++;
    warn "$file not found\n";
   }
  if (-z $file)
   {
    $snag++;
    warn "$file is zero sized\n";
   }
 }

exit(1) if $snag && !$opt_lax;

my @files = map("$dir$version/$_",sort(keys %$files));
chdir("..");

unlink("$dir$version") if (-l "$dir$version");
symlink($path,"$dir$version") || die "Cannot link $dir $dir$version:$!";

$dir .= $version;

system("mv","$dir.tar.gz","$dir.tar.gz%") if (-e "$dir.tar.gz");

if (defined $opt_dev)
 {
  System("tar","-cf",$opt_dev,@files);
  System("tar","-tvf",$opt_dev);
 }
else
 {
  warn "Writing $dir.tar\n";
  System("tar","-cf","$dir.tar",@files);
  warn "gzip'ing $dir.tar\n";
  System("gzip",'-9',"$dir.tar");
 }