Without the -n flag, gzip stores the modification time inside the
header which can produce different md5sums for the same file contents.
By using this flag, it will be possible for the package to be generated
using a delta and have the same md5sum.
A new script, apply-delta, is created to apply a delta file and
recompress the resulting package. This will produce a package with the
correct md5sum.
+apply-delta: $(srcdir)/apply-delta.sh.in
makepkg: $(srcdir)/makepkg.sh.in
pacman-optimize: $(srcdir)/pacman-optimize.sh.in
rankmirrors: $(srcdir)/rankmirrors.py.in
diff --git a/scripts/apply-delta.sh.in b/scripts/apply-delta.sh.in
new file mode 100644
index 0000000..9dca177
--- /dev/null
+++ b/scripts/apply-delta.sh.in
@@ -0,0 +1,30 @@
+#!/bin/bash -e
+#
+# apply-delta - apply xdelta patch and then recompress using gzip
+# @configure_input@
+#
+# Copyright (c) 2008 by Judd Vinet <jvinet@zeroflux.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+withoutgz="$(echo $3 | sed -e 's/.gz$//')"
+
+# patch
+xdelta patch "$1" "$2" "$3"
+
+# now re-gzip
+gzip -d "$3"
+gzip -f -n "$withoutgz"
+
+# vim: set ts=2 sw=2 noet:
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index cecda1d..b9b3ed7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -869,7 +869,7 @@ create_package() {
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
- if ! bsdtar -czf "$pkg_file" $comp_files $(ls); then
+ if ! bsdtar -cf - $comp_files $(ls) | gzip -n > "$pkg_file"; then
error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code
fi
@@ -910,28 +910,16 @@ create_xdelta() {
if [ "$base_file" != "" ]; then
msg "$(gettext "Making delta from version %s...")" "$latest_version"
+ msg2 "$(gettext "NOTE: the delta should ONLY be distributed with this tarball")"
+
local delta_file="$PKGDEST/$pkgname-${latest_version}_to_$pkgver-$pkgrel-$CARCH.delta"
local ret=0
- # xdelta will decompress base_file & pkg_file into TMP_DIR (or /tmp if
- # TMP_DIR is unset) then perform the delta on the resulting tars
+ # xdelta will decompress base_file & pkg_file into TMPDIR (or /tmp if
+ # TMPDIR is unset) then perform the delta on the resulting tars
xdelta delta "$base_file" "$pkg_file" "$delta_file" || ret=$?
- if [ $ret -eq 0 -o $ret -eq 1 ]; then
- # Generate the final gz using xdelta for compression. xdelta will be our
- # common denominator compression utility between the packager and the
- # users. makepkg and pacman must use the same compression algorithm or
- # the delta generated package may not match, producing md5 checksum
- # errors.
- msg2 "$(gettext "Recreating package tarball from delta to match md5 signatures")"
- msg2 "$(gettext "NOTE: the delta should ONLY be distributed with this tarball")"
- ret=0
- xdelta patch "$delta_file" "$base_file" "$pkg_file" || ret=$?
- if [ $ret -ne 0 ]; then
- error "$(gettext "Could not generate the package from the delta.")"
- exit 1
- fi
- else
+ if [ $ret -ne 0 -a $ret -ne 1 ]; then
warning "$(gettext "Delta was not able to be created.")"
fi
else
--
1.5.4
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev