View | Details | Raw Unified | Return to bug 17058
Collapse All | Expand All

(-)a/srpmcmp (-6 / +20 lines)
Lines 78-83 Link Here
78
use Getopt::Long qw(GetOptions);
78
use Getopt::Long qw(GetOptions);
79
GetOptions verbose => \my $opt_verbose,
79
GetOptions verbose => \my $opt_verbose,
80
	deep => \my $opt_deep, autocrap => \my $opt_autocrap, rcs => \my $opt_rcs;
80
	deep => \my $opt_deep, autocrap => \my $opt_autocrap, rcs => \my $opt_rcs;
81
use Cwd qw(getcwd realpath);
82
my $cwd = getcwd();
81
83
82
sub verbose {
84
sub verbose {
83
	print STDERR "@_\n" if $opt_verbose;
85
	print STDERR "@_\n" if $opt_verbose;
Lines 91-97 Link Here
91
	my $dir = tempdir("srpmcmp.XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1);
93
	my $dir = tempdir("srpmcmp.XXXXXXXXXX", TMPDIR => 1, CLEANUP => 1);
92
	chdir $dir;
94
	chdir $dir;
93
	my $rv = system qq(rpm2cpio '$rpm' | cpio -idmu --quiet --no-absolute-filenames);
95
	my $rv = system qq(rpm2cpio '$rpm' | cpio -idmu --quiet --no-absolute-filenames);
94
	die "$0: `rpm2cpio $rpm' failed\n" if $rv;
96
	if ($rv) {
97
        chdir $cwd;
98
        die "$0: `rpm2cpio $rpm' failed\n";
99
    }
95
	return $dir;
100
	return $dir;
96
}
101
}
97
102
Lines 101-115 Link Here
101
106
102
	if (my @gz = (<*.gz>, <*.tgz>)) {
107
	if (my @gz = (<*.gz>, <*.tgz>)) {
103
		my $rv = system qw(gzip -d) => @gz;
108
		my $rv = system qw(gzip -d) => @gz;
104
		die "$0: `gzip -d @gz' failed\n" if $rv;
109
        if ($rv) {
110
            chdir $cwd;
111
    		die "$0: `gzip -d @gz' failed\n"
112
        }
105
	}
113
	}
106
	if (my @bz2 = <*.bz2>) {
114
	if (my @bz2 = <*.bz2>) {
107
		my $rv = system qw(bzip2 -df) => @bz2;
115
		my $rv = system qw(bzip2 -df) => @bz2;
108
		die "$0: `bzip2 -df @bz2' failed\n" if $rv;
116
        if ($rv) {
117
            chdir $cwd;
118
    		die "$0: `bzip2 -df @bz2' failed\n";
119
        }
109
	}
120
	}
110
	foreach (<*.tar>) {
121
	foreach (<*.tar>) {
111
		my $rv = system qw(tar xf) => $_;
122
		my $rv = system qw(tar xf) => $_;
112
		die "$0: `tar xf $_' failed\n" if $rv;
123
        if ($rv) {
124
            chdir $cwd;
125
    		die "$0: `tar xf $_' failed\n";
126
        }
113
		unlink;
127
		unlink;
114
	}
128
	}
115
}
129
}
Lines 261-267 Link Here
261
}
275
}
262
276
263
sub srpmcmp ($$) {
277
sub srpmcmp ($$) {
264
	use Cwd qw(realpath);
265
	my ($rpm1, $rpm2) = map { realpath($_) } @_;
278
	my ($rpm1, $rpm2) = map { realpath($_) } @_;
266
279
267
	my $dir1 = tmp_unpack $rpm1; uncompress $dir1; cleanup $dir1;
280
	my $dir1 = tmp_unpack $rpm1; uncompress $dir1; cleanup $dir1;
Lines 296-300 Link Here
296
$0 [--deep] [--autocrap] [--rcs] package1.src.rpm package2.src.rpm
309
$0 [--deep] [--autocrap] [--rcs] package1.src.rpm package2.src.rpm
297
See srpmcmp(1) for details.
310
See srpmcmp(1) for details.
298
EOF
311
EOF
299
print srpmcmp $ARGV[0], $ARGV[1];
300
312
313
print srpmcmp $ARGV[0], $ARGV[1];
314
chdir $cwd;

Return to bug 17058