summaryrefslogtreecommitdiff
path: root/packaging/0004-openSUSE-HACK-enable-special-upstream-bzip2.patch
blob: 5edf29a28932d0f6fcfc0beb025182c6b22145cd (plain)
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
From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Date: Thu, 16 Aug 2012 14:28:28 +0300
Subject: openSUSE HACK: enable special upstream bzip2

This is a hack for openSUSE that makes pristine-bz2 use a special
(pristine-tar-specific) bzip2. Otherwise it uses the system bzip2 which
is unable to re-create/gendelta bz2 archives created by other
distributions.

Gbp-Rpm: If 0%{?suse_version} && 0%{?suse_version} < 1220
Gbp: Ignore

Change-Id: Icfcbee5207e65820248172152623a4dbf4440131
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
 Makefile.PL  |  5 +++++
 pristine-bz2 | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index 904d6ce..e64459a 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -59,6 +59,8 @@ extra_build: zgz/zgz pristine-tar.spec
 	pod2man -c pristine-xz pristine-xz > pristine-xz.1
 	pod2man -c zgz zgz/zgz.pod > zgz.1
 	$(MAKE) -C pit/suse-bzip2 PREFIX=$(PREFIX)
+	$(MAKE) -C pit/upstream-bzip2
+	sed -i s'|^my $$__upstream_bzip2_prefix.*|my $$__upstream_bzip2_prefix = "$(PKGLIBDIR)/upstream-bzip2/";|' pristine-bz2
 
 ZGZ_SOURCES = zgz/zgz.c zgz/gzip/*.c zgz/old-bzip2/*.c
 zgz/zgz: $(ZGZ_SOURCES)
@@ -71,6 +73,9 @@ extra_install:
 	install -m 0644 *.1 $(DESTDIR)$(PREFIX)/share/man/man1
 	install -d $(DESTDIR)$(PKGLIBDIR)/suse-bzip2
 	install pit/suse-bzip2/bzip2 pit/suse-bzip2/libbz2* $(DESTDIR)$(PKGLIBDIR)/suse-bzip2
+	install -d $(DESTDIR)$(PKGLIBDIR)/upstream-bzip2
+	install pit/upstream-bzip2/bzip2 $(DESTDIR)$(PKGLIBDIR)/upstream-bzip2
+	install pit/upstream-bzip2/libbz2* $(DESTDIR)$(PKGLIBDIR)/upstream-bzip2
 
 extra_clean:
 	$(MAKE) clean -C pit/suse-bzip2 PREFIX=$(PREFIX)
diff --git a/pristine-bz2 b/pristine-bz2
index c2403ff..411e990 100755
--- a/pristine-bz2
+++ b/pristine-bz2
@@ -91,6 +91,8 @@ use IO::Handle;
 delete $ENV{BZIP};
 delete $ENV{BZIP2};
 
+my $__upstream_bzip2_prefix = "";
+
 my @supported_bzip2_programs = qw(bzip2 pbzip2 zgz);
 
 my $try=0;
@@ -169,7 +171,12 @@ sub testvariant {
 
 	# try bzip2'ing with the arguments passed
 	if ($bzip2_program ne 'zgz') {
-		doit($bzip2_program, @args, $tmpin);
+		if ($bzip2_program eq 'bzip2') {
+			doit("$__upstream_bzip2_prefix/bzip2", @args, $tmpin);
+		}
+		else {
+			doit($bzip2_program, @args, $tmpin);
+		}
 	}
 	else {
 		doit_redir($tmpin, $new, $bzip2_program, @args);
@@ -264,6 +271,9 @@ sub genbz2 {
 		# unlike bzip2, zgz only uses stdio
 		doit_redir($file, "$file.bz2", $program, @params);
 	}
+	elsif ($program eq 'bzip2') {
+		doit("$__upstream_bzip2_prefix/bzip2", @params, $file);
+	}
 	else {
 		doit($program, @params, $file);
 	}