#!/usr/local/bin/perl -w use strict; use ExtUtils::Manifest "/mani/"; use POSIX qw(getcwd); use vars qw($opt_dev $opt_man $opt_lax $opt_sfx $version); $opt_sfx = ''; use Getopt::Long; GetOptions('dev=s','man','lax','sfx=s'); sub System { print STDERR join(' ',@_),"\n" if (@_ < 8); die "Cannot " . join(' ',@_) if (system(@_)); } use blib; use Audio::Data; $version = $Audio::Data::VERSION; 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 = 'Audio'; $opt_sfx = '_'.$opt_sfx if (length($opt_sfx) && $opt_sfx !~ /^_/); system(p4 => edit => 'Change.log'); system("p4 changes -l ./... > Change.log"); open(my $fh,"|p4 submit -i") || die; print $fh <<"END"; Change: new Client: llama User: nick Status: new Description: $dir-$version$opt_sfx Release Preparation Files: //depot/Audio/Change.log # edit END close($fh); 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$opt_sfx/$_",sort(keys %$files)); chdir(".."); unlink("$dir-$version$opt_sfx") if (-l "$dir-$version$opt_sfx"); symlink($path,"$dir-$version$opt_sfx") || die "Cannot link $dir $dir-$version$opt_sfx:$!"; $dir .= "-$version$opt_sfx"; 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"); }