2 # repack repacks unscd upstream tarball
3 # and is released under the terms of the GNU GPL version 3, or any
4 # later version, at your option. See the file README and COPYING for
6 # Copyright 2013 by Don Armstrong <don@donarmstrong.com>.
17 repack - repacks unscd upstream tarball
21 repack --upstream-version version filename
29 =item B<--upstream-version>
37 repack --upstream-version 0.48 nscd-0.48.c
44 use File::Temp qw(tempdir);
45 use File::Copy qw(copy);
47 my %options = (debug => 0,
53 'upstream_version|upstream-version=s',
56 $DEBUG = $options{debug};
59 if (not exists $options{upstream_version}) {
60 push @USAGE_ERRORS,"You must give the --upstream-version option";
63 push @USAGE_ERRORS,"You must give exactly one filename on the command line";
67 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
70 my $tdir = tempdir(CLEANUP => 1);
73 my $orig_dir_name = 'unscd-'.$options{upstream_version};
74 my $orig_dir_path = File::Spec->catfile($tdir,$orig_dir_name);
75 mkdir($orig_dir_path) or die "Unable to mkdir $orig_dir_path: $!";
76 copy($ARGV[0],File::Spec->catfile($orig_dir_path,'nscd.c')) or
77 die "Unable to copy $ARGV[0] to $orig_dir_path/nscd.c: $!";
78 system('tar','-zcf',File::Spec->catfile($curdir,
80 'unscd_'.$options{upstream_version}.'.orig.tar.gz'),
81 '-C',$tdir,$orig_dir_name) == 0 or