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);
46 my %options = (debug => 0,
52 'upstream_version|upstream-version=s',
55 $DEBUG = $options{debug};
58 if (not exists $options{upstream_version}) {
59 push @USAGE_ERRORS,"You must give the --upstream-version option";
62 push @USAGE_ERRORS,"You must give exactly one filename on the command line";
66 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
69 my $tdir = tempdir(CLEANUP => 1);
72 my $orig_dir_name = 'unscd-'.$options{upstream_version};
73 my $orig_dir_path = File::Spec->catfile($tdir,$orig_dir_name);
74 mkdir($orig_dir_path) or die "Unable to mkdir $orig_dir_path: $!";
75 rename($ARGV[0],File::Spec->catfile($orig_dir_path,'nscd.c')) or
76 die "Unable to copy $ARGV[0] to $orig_dir_path/nscd.c: $!";
77 system('tar','-zcf',File::Spec->catfile($curdir,
79 'unscd_'.$options{upstream_version}.'.orig.tar.gz'),
80 '-C',$tdir,$orig_dir_name) == 0 or