Package init
This commit is contained in:
commit
05173f131c
@ -0,0 +1,98 @@
|
|||||||
|
From 9e0e8bf226112195c93fa2493086353bd46bd001 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Wed, 17 Dec 2014 18:07:11 +0100
|
||||||
|
Subject: [PATCH 2/4] do not finish applydeltarpm jobs when in the middle of a
|
||||||
|
request
|
||||||
|
|
||||||
|
If applydeltarpm failed we start another request, this does not
|
||||||
|
mix well if re're in the middle of receiving another request...
|
||||||
|
---
|
||||||
|
drpmsync | 39 +++++++++++++++++++++++++++------------
|
||||||
|
1 file changed, 27 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drpmsync b/drpmsync
|
||||||
|
index f629aad..2265b7e 100755
|
||||||
|
--- a/drpmsync
|
||||||
|
+++ b/drpmsync
|
||||||
|
@@ -2686,6 +2686,7 @@ sub opensock {
|
||||||
|
return if $sock_isopen;
|
||||||
|
my $tcpproto = getprotobyname('tcp');
|
||||||
|
socket(S, PF_INET, SOCK_STREAM, $tcpproto) || die("socket: $!\n");
|
||||||
|
+ setsockopt(S, SOL_SOCKET, SO_KEEPALIVE, pack("l",1)) || die("setsockopt: $!\n");
|
||||||
|
connect(S, sockaddr_in($syncport, $syncaddr)) || die("connect: $!\n");
|
||||||
|
$sock_isopen = 1;
|
||||||
|
}
|
||||||
|
@@ -2974,7 +2975,8 @@ sub drpmsync_get_update {
|
||||||
|
} elsif ($type eq 'FISO') {
|
||||||
|
$ans = copytofile(*S, "$tmpnam.fiso", $ans, $anssize, $ctx);
|
||||||
|
$ans = finishreq(*S, $ans, $ctx, $id);
|
||||||
|
- return 'FISO', [ $tmpnam, undef, substr($extra, 0, 12) ];
|
||||||
|
+ $d = [ $tmpnam, undef, substr($extra, 0, 12) ];
|
||||||
|
+ return ('FISO', $d);
|
||||||
|
} elsif ($type eq 'RPM ') {
|
||||||
|
$sabytes -= $anssize;
|
||||||
|
my $delta;
|
||||||
|
@@ -2982,36 +2984,49 @@ sub drpmsync_get_update {
|
||||||
|
die("nothing to do?\n") if $nrpm == 0 && $ndrpm == 0;
|
||||||
|
my @deltas;
|
||||||
|
my $dextra = substr($extra, 12 + 16);
|
||||||
|
+ my @renames;
|
||||||
|
while ($ndrpm > 0) {
|
||||||
|
$delta = $tmpnam;
|
||||||
|
$delta =~ s/[^\/]*$//;
|
||||||
|
$delta .= substr($dextra, 12, 32 * 3);
|
||||||
|
- # end old job if we have a delta conflict
|
||||||
|
- checkjob() if $runningjob && -e $delta;
|
||||||
|
my $size = hex(substr($dextra, 12 + 3 * 32, 8));
|
||||||
|
die("delta rpm bigger than answer? $size > $anssize\n") if $size > $anssize;
|
||||||
|
+ push @deltas, $delta;
|
||||||
|
+ # conflict with running job?
|
||||||
|
+ if ($runningjob && -e $delta) {
|
||||||
|
+ push @renames, $delta;
|
||||||
|
+ $delta .= ".tmp";
|
||||||
|
+ }
|
||||||
|
$ans = copytofile(*S, $delta, $ans, $size, $ctx);
|
||||||
|
$anssize -= $size;
|
||||||
|
fixmodetime($delta, substr($dextra, 0, 12));
|
||||||
|
$dextra = substr($dextra, 12 + 32 * 3 + 8);
|
||||||
|
- push @deltas, $delta;
|
||||||
|
$ndrpm--;
|
||||||
|
}
|
||||||
|
- if ($nrpm == 1) {
|
||||||
|
+ if ($nrpm) {
|
||||||
|
$ans = copytofile_seek(*S, $tmpnam, $extractoff, $ans, $anssize, $ctx);
|
||||||
|
- $ans = finishreq(*S, $ans, $ctx, $id);
|
||||||
|
- return 'RPM ', [ $dto->[0] ], @deltas if $rextract;
|
||||||
|
+ } else {
|
||||||
|
+ die("junk at end of answer\n") if $anssize;
|
||||||
|
+ }
|
||||||
|
+ $ans = finishreq(*S, $ans, $ctx, $id);
|
||||||
|
+ if (@renames) {
|
||||||
|
+ checkjob();
|
||||||
|
+ for (@renames) {
|
||||||
|
+ rename("$_.tmp", $_) || die("rename $_.tmp $_: $!\n");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (!$nrpm) {
|
||||||
|
+ $d = [ undef, undef, substr($extra, 0, 12) ];
|
||||||
|
+ } elsif ($rextract) {
|
||||||
|
+ $d = [ $dto->[0] ];
|
||||||
|
+ } else {
|
||||||
|
fixmodetime($tmpnam, substr($extra, 0, 12));
|
||||||
|
my @s = stat($tmpnam);
|
||||||
|
die("$tmpnam: $!\n") unless @s;
|
||||||
|
$sabytes += $s[7];
|
||||||
|
$d = [ $dto->[0], "$s[9]/$s[7]/$s[1]", sprintf("1%03x%08x", ($s[2] & 07777), $s[9]), rpminfo($tmpnam) ];
|
||||||
|
- } else {
|
||||||
|
- die("junk at end of answer\n") if $anssize;
|
||||||
|
- $ans = finishreq(*S, $ans, $ctx, $id);
|
||||||
|
- $d = [ undef, undef, substr($extra, 0, 12) ];
|
||||||
|
}
|
||||||
|
- return 'RPM ', $d, @deltas;
|
||||||
|
+ return ('RPM ', $d, @deltas);
|
||||||
|
} else {
|
||||||
|
die("received strange answer type: $type\n");
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
25
0003-add-newline-in-missing-prelink-error.patch
Normal file
25
0003-add-newline-in-missing-prelink-error.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 6b13095e1ae5b3ba2f2631ce750ac1d3d3d3e152 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Fri, 9 Jan 2015 12:39:39 +0100
|
||||||
|
Subject: [PATCH 3/4] add newline in missing prelink error
|
||||||
|
|
||||||
|
---
|
||||||
|
prelink.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/prelink.c b/prelink.c
|
||||||
|
index 07516f8..e74fbc5 100644
|
||||||
|
--- a/prelink.c
|
||||||
|
+++ b/prelink.c
|
||||||
|
@@ -130,7 +130,7 @@ prelinked_open(char *name)
|
||||||
|
if (stat("/usr/sbin/prelink", &stb))
|
||||||
|
{
|
||||||
|
perror("/usr/sbin/prelink");
|
||||||
|
- fprintf(stderr, "prelink not installed, cannot undo prelinking");
|
||||||
|
+ fprintf(stderr, "prelink not installed, cannot undo prelinking\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcpy(template, "/tmp/deltarpm.XXXXXX");
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
From 1d0657b29ee72e842e0d1ada61ea0177b3159a8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jonathan Dieter <jdieter@lesbg.com>
|
||||||
|
Date: Mon, 12 Jan 2015 13:47:51 +0200
|
||||||
|
Subject: [PATCH 4/4] Return error rather than crashing if we can't allocate
|
||||||
|
memory
|
||||||
|
|
||||||
|
Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
|
||||||
|
---
|
||||||
|
deltarpmmodule.c | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/deltarpmmodule.c b/deltarpmmodule.c
|
||||||
|
index cf333b6..40ea60f 100644
|
||||||
|
--- a/deltarpmmodule.c
|
||||||
|
+++ b/deltarpmmodule.c
|
||||||
|
@@ -46,6 +46,11 @@ PyObject *createDict(struct deltarpm d)
|
||||||
|
if (d.seq) {
|
||||||
|
char *tmp = calloc(d.seql * 2 + 1, sizeof(char));
|
||||||
|
int i;
|
||||||
|
+
|
||||||
|
+ if(tmp == NULL) {
|
||||||
|
+ PyErr_SetFromErrno(PyExc_SystemError);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
for (i = 0; i < d.seql; i++) {
|
||||||
|
char buf[3];
|
||||||
|
|
||||||
|
@@ -54,6 +59,10 @@ PyObject *createDict(struct deltarpm d)
|
||||||
|
}
|
||||||
|
o = PyString_FromString(tmp);
|
||||||
|
free(tmp);
|
||||||
|
+ if(o == NULL) {
|
||||||
|
+ PyErr_SetFromErrno(PyExc_SystemError);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
PyDict_SetItemString(dict, "seq", o);
|
||||||
|
Py_DECREF(o);
|
||||||
|
} else {
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
26
0005-fix-off-by-one-error-in-delta-generation-code.patch
Normal file
26
0005-fix-off-by-one-error-in-delta-generation-code.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From 619eaf318b3420056c14933bd513201bfb8af494 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Mon, 12 Jan 2015 14:38:50 +0100
|
||||||
|
Subject: [PATCH 5/6] fix off-by-one error in delta generation code
|
||||||
|
|
||||||
|
This could lead to a segfault in rare circumstances.
|
||||||
|
---
|
||||||
|
delta.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/delta.c b/delta.c
|
||||||
|
index 3569351..caafa62 100644
|
||||||
|
--- a/delta.c
|
||||||
|
+++ b/delta.c
|
||||||
|
@@ -366,7 +366,7 @@ scannext:
|
||||||
|
{
|
||||||
|
if (memcmp(new + scan + HSIZE *3, old + pos2 - 1, HSIZE))
|
||||||
|
{
|
||||||
|
- ssx2 = (ssx2 == prime) ? 0 : ssx2 + 1;
|
||||||
|
+ ssx2 = (ssx2 == prime - 1) ? 0 : ssx2 + 1;
|
||||||
|
pos2 = hash[ssx2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
From 19b7ad9efae520997da8b4b58a5ae0208185952c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jonathan Dieter <jdieter@lesbg.com>
|
||||||
|
Date: Wed, 14 Jan 2015 08:16:55 +0200
|
||||||
|
Subject: [PATCH 6/6] Add fflush's so output can be watched using tail -f
|
||||||
|
|
||||||
|
Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
|
||||||
|
---
|
||||||
|
applydeltaiso.c | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/applydeltaiso.c b/applydeltaiso.c
|
||||||
|
index 67f8e39..e482694 100644
|
||||||
|
--- a/applydeltaiso.c
|
||||||
|
+++ b/applydeltaiso.c
|
||||||
|
@@ -122,6 +122,7 @@ processrpm(FILE *fpold, struct cfile *ocf, struct cfile *cf, unsigned int *nmp,
|
||||||
|
unsigned char buf[8192];
|
||||||
|
|
||||||
|
printf("%s: verbatim copy\n", namebuf);
|
||||||
|
+ fflush(stdout);
|
||||||
|
len = cget4(cf);
|
||||||
|
while (len)
|
||||||
|
{
|
||||||
|
@@ -141,9 +142,15 @@ processrpm(FILE *fpold, struct cfile *ocf, struct cfile *cf, unsigned int *nmp,
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ctype == 254)
|
||||||
|
- printf("%s: copying unchanged payload\n", namebuf);
|
||||||
|
+ {
|
||||||
|
+ printf("%s: copying unchanged payload\n", namebuf);
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ }
|
||||||
|
else
|
||||||
|
- printf("%s (%s): applying delta\n", namebuf, cfile_comp2str(ctype));
|
||||||
|
+ {
|
||||||
|
+ printf("%s (%s): applying delta\n", namebuf, cfile_comp2str(ctype));
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ }
|
||||||
|
rpmn = cget4(cf);
|
||||||
|
if (rpmn < 0 || rpmn >= nmpn)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
12
deltarpm-3.6-fix-python2.patch
Normal file
12
deltarpm-3.6-fix-python2.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -urb deltarpm-3.6/Makefile deltarpm-3.6b/Makefile
|
||||||
|
--- deltarpm-3.6/Makefile 2013-06-07 16:02:18.000000000 +0100
|
||||||
|
+++ deltarpm-3.6b/Makefile 2018-07-14 22:36:28.105979631 +0100
|
||||||
|
@@ -12,7 +12,7 @@
|
||||||
|
CPPFLAGS = -fPIC -DDELTARPM_64BIT -DBSDIFF_NO_SUF -DRPMDUMPHEADER=\"$(rpmdumpheader)\" $(zlibcppflags)
|
||||||
|
LDLIBS = -lbz2 $(zlibldflags) -llzma
|
||||||
|
LDFLAGS =
|
||||||
|
-PYTHONS = python python3
|
||||||
|
+PYTHONS = python2 python3
|
||||||
|
|
||||||
|
all: makedeltarpm applydeltarpm rpmdumpheader makedeltaiso applydeltaiso combinedeltarpm fragiso
|
||||||
|
|
||||||
BIN
deltarpm-3.6.tar.bz2
Normal file
BIN
deltarpm-3.6.tar.bz2
Normal file
Binary file not shown.
88
deltarpm.spec
Normal file
88
deltarpm.spec
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
%bcond_without python3
|
||||||
|
Name: deltarpm
|
||||||
|
Version: 3.6
|
||||||
|
Release: 29
|
||||||
|
Summary: deltarpm contains the difference between an old and a new version of an RPM package.
|
||||||
|
License: BSD
|
||||||
|
URL: http://gitorious.org/deltarpm/deltarpm
|
||||||
|
Source0: https://github.com/rpm-software-management/%{name}/archive/%{name}-%{version}.tar.bz2
|
||||||
|
Patch0: 0002-do-not-finish-applydeltarpm-jobs-when-in-the-middle-.patch
|
||||||
|
Patch1: 0003-add-newline-in-missing-prelink-error.patch
|
||||||
|
Patch2: 0004-Return-error-rather-than-crashing-if-we-can-t-alloca.patch
|
||||||
|
Patch3: 0005-fix-off-by-one-error-in-delta-generation-code.patch
|
||||||
|
Patch4: 0006-Add-fflush-s-so-output-can-be-watched-using-tail-f.patch
|
||||||
|
Patch5: deltarpm-3.6-fix-python2.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc bzip2-devel perl-generators xz-devel rpm-devel popt-devel zlib-devel
|
||||||
|
BuildRequires: %{_vendor}-rpm-config
|
||||||
|
BuildRequires: python2-devel python3-devel
|
||||||
|
|
||||||
|
%description
|
||||||
|
Delta RPM packages contain the difference between an old and a new
|
||||||
|
version of an RPM package. Applying a delta RPM on an old RPM results
|
||||||
|
in the complete new RPM. It is not necessary to have a copy of the
|
||||||
|
old RPM, because a delta RPM can also work with an installed RPM.
|
||||||
|
|
||||||
|
%package help
|
||||||
|
Summary: help document
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
BuildArch: noarch
|
||||||
|
%description help
|
||||||
|
This package provides help document for deltarpm.
|
||||||
|
|
||||||
|
%package -n python2-%{name}
|
||||||
|
Summary: Python2 bindings for deltarpm
|
||||||
|
BuildRequires: python2-devel
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
%{?python_provide:%python_provide python2-%{name}}
|
||||||
|
%description -n python2-%{name}
|
||||||
|
Python2 bindings for deltarpm.
|
||||||
|
|
||||||
|
%package -n python3-%{name}
|
||||||
|
Summary: Python3 bindings for deltarpm
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
%{?python_provide:%python_provide python3-%{name}}
|
||||||
|
%description -n python3-%{name}
|
||||||
|
Python3 bindings for deltarpm.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
%make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%__global_ldflags" \
|
||||||
|
bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix} \
|
||||||
|
zlibbundled='' zlibldflags='-lz' zlibcppflags=''
|
||||||
|
%make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%__global_ldflags" \
|
||||||
|
bindir=%{_bindir} libdir=%{_libdir} mandir=%{_mandir} prefix=%{_prefix} \
|
||||||
|
zlibbundled='' zlibldflags='-lz' zlibcppflags='' python
|
||||||
|
|
||||||
|
%install
|
||||||
|
%makeinstall pylibprefix=%{buildroot}
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%license LICENSE.BSD
|
||||||
|
%{_bindir}/*
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc README NEWS
|
||||||
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
|
%files -n python2-%{name}
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{python2_sitearch}/%{name}.py*
|
||||||
|
%{python2_sitearch}/_%{name}module.so
|
||||||
|
|
||||||
|
%files -n python3-%{name}
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{python3_sitearch}/%{name}.py
|
||||||
|
%{python3_sitearch}/__pycache__/%{name}*.pyc
|
||||||
|
%{python3_sitearch}/_%{name}module.so
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Sep 04 2019 openEuler Buildtoam <buildteam@openeuler.com> - 3.6-29
|
||||||
|
- Package Init
|
||||||
Loading…
x
Reference in New Issue
Block a user