[pacman-dev] [PATCH 2/5] Remove pkgdelta

Allan McRae allan at archlinux.org
Sat Mar 2 10:19:13 UTC 2019


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 doc/Makefile.am         |   2 -
 doc/index.asciidoc      |   1 -
 doc/meson.build         |   1 -
 doc/pkgdelta.8.asciidoc |  53 ---------
 scripts/.gitignore      |   1 -
 scripts/Makefile.am     |   3 -
 scripts/meson.build     |   1 -
 scripts/pkgdelta.sh.in  | 234 ----------------------------------------
 scripts/po/POTFILES.in  |   1 -
 9 files changed, 297 deletions(-)
 delete mode 100644 doc/pkgdelta.8.asciidoc
 delete mode 100644 scripts/pkgdelta.sh.in

diff --git a/doc/Makefile.am b/doc/Makefile.am
index de87c409..f4b0b943 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -10,7 +10,6 @@ MANPAGES = \
 	makepkg-template.1 \
 	repo-add.8 \
 	vercmp.8 \
-	pkgdelta.8 \
 	pacman-key.8 \
 	PKGBUILD.5 \
 	makepkg.conf.5 \
@@ -41,7 +40,6 @@ EXTRA_DIST = \
 	makepkg-template.1.asciidoc \
 	repo-add.8.asciidoc \
 	vercmp.8.asciidoc \
-	pkgdelta.8.asciidoc \
 	pacman-key.8.asciidoc \
 	PKGBUILD.5.asciidoc \
 	PKGBUILD-example.txt \
diff --git a/doc/index.asciidoc b/doc/index.asciidoc
index 35de0b90..9f9ab3a2 100644
--- a/doc/index.asciidoc
+++ b/doc/index.asciidoc
@@ -52,7 +52,6 @@ configuration files dealing with pacman.
 * linkman:pacman[8]
 * linkman:pacman-key[8]
 * linkman:pacman.conf[5]
-* linkman:pkgdelta[8]
 * linkman:repo-add[8]
 * linkman:vercmp[8]
 
diff --git a/doc/meson.build b/doc/meson.build
index b7514ef7..f29aaf5f 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -5,7 +5,6 @@ manpages = [
   { 'name': 'makepkg-template.1' },
   { 'name': 'repo-add.8' },
   { 'name': 'vercmp.8' },
-  { 'name': 'pkgdelta.8' },
   { 'name': 'pacman-key.8' },
   { 'name': 'PKGBUILD.5', 'extra_depends' : [ 'PKGBUILD-example.txt' ] },
   { 'name': 'makepkg.conf.5' },
diff --git a/doc/pkgdelta.8.asciidoc b/doc/pkgdelta.8.asciidoc
deleted file mode 100644
index 412e607e..00000000
--- a/doc/pkgdelta.8.asciidoc
+++ /dev/null
@@ -1,53 +0,0 @@
-pkgdelta(8)
-=========
-
-Name
-----
-pkgdelta - package delta generation utility
-
-
-Synopsis
---------
-'pkgdelta' [options] <package1> <package2>
-
-
-Description
------------
-'pkgdelta' is used to create package delta files between two versions of the
-same package. These files are essentially binary patches. linkman:pacman[8] can
-download deltas instead of full package upgrades, and use them with the
-previous versions of packages (in the package cache) to synthesize the upgraded
-version of the packages. This likely reduces download sizes for upgrades
-significantly.
-
-'pkgdelta' requires linkman:xdelta3[1] to do its job.
-
-
-Options
--------
-*--max-delta-size <ratio>*::
-	Only create delta files if the delta is smaller than ratio * package_size.
-	Possible values: 0.0 to 2.0.
-	Recommended values: 0.2 to 0.9.
-	Default value: 0.7
-
-*--min-pkg-size <size>*::
-	Minimal size of the package file in bytes to be considered for delta creation.
-	Default value: 1048576 bytes = 1 MiB. This may be any absolute size in bytes or
-	a human-readable value such as `4MiB` or `3.5MB`.
-
-*-q, \--quiet*::
-	Be quiet. Do not output anything but warnings and errors.
-
-
-Examples
---------
-
-  $ pkgdelta libreoffice-3.3.2-1-x86_64.pkg.tar.xz libreoffice-3.3.2-2-x86_64.pkg.tar.xz
-
-
-See Also
---------
-linkman:pacman[8], linkman:xdelta3[1]
-
-include::footer.asciidoc[]
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 3a5ac8a7..b8bb1f83 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -2,7 +2,6 @@ makepkg
 makepkg-template
 pacman-db-upgrade
 pacman-key
-pkgdelta
 repo-add
 repo-elephant
 repo-remove
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 7fffd93b..6628e8cf 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -16,7 +16,6 @@ OURSCRIPTS = \
 	makepkg \
 	pacman-db-upgrade \
 	pacman-key \
-	pkgdelta \
 	repo-add
 
 EXTRA_DIST = \
@@ -24,7 +23,6 @@ EXTRA_DIST = \
 	makepkg-template.pl.in \
 	pacman-db-upgrade.sh.in \
 	pacman-key.sh.in \
-	pkgdelta.sh.in \
 	repo-add.sh.in \
 	wrapper.sh.in \
 	$(COMPLETION_DIST) \
@@ -137,7 +135,6 @@ WRAPPER = \
 	makepkg-wrapper \
 	pacman-db-upgrade-wrapper \
 	pacman-key-wrapper \
-	pkgdelta-wrapper \
 	repo-add-wrapper
 
 COMPLETION_IN = \
diff --git a/scripts/meson.build b/scripts/meson.build
index 344333be..db442973 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -2,7 +2,6 @@ wrapped_scripts = [
   'makepkg.sh.in',
   'pacman-db-upgrade.sh.in',
   'pacman-key.sh.in',
-  'pkgdelta.sh.in',
   'repo-add.sh.in'
 ]
 
diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
deleted file mode 100644
index b0b0b21f..00000000
--- a/scripts/pkgdelta.sh.in
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/bin/bash
-#
-#   pkgdelta - create delta files for use with pacman and repo-add
-#   @configure_input@
-#
-#   Copyright (c) 2009 Xavier Chantry <shiningxc at gmail.com>
-#
-#   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/>.
-#
-
-# bash options
-set -o errexit
-
-# gettext initialization
-export TEXTDOMAIN='pacman-scripts'
-export TEXTDOMAINDIR='@localedir@'
-
-declare -r myver='@PACKAGE_VERSION@'
-
-LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
-
-# Import libmakepkg
-source "$LIBRARY"/util/message.sh
-source "$LIBRARY"/util/parseopts.sh
-
-# Options
-QUIET=0
-USE_COLOR='y'
-
-# minimal of package before deltas are generated (bytes)
-min_pkg_size=$((1024*1024))
-
-# percent of new package above which the delta will be discarded
-max_delta_size=70
-
-
-# ensure we have a sane umask set
-umask 0022
-
-# print usage instructions
-usage() {
-	printf "pkgdelta (pacman) %s\n" "${myver}"
-	echo
-	printf -- "$(gettext "Usage: pkgdelta [options] <package1> <package2>\n")"
-	echo
-	printf -- "$(gettext "\
-pkgdelta will create a delta file between two packages.\n\
-This delta file can then be added to a database using repo-add.\n")"
-	echo
-	printf -- "$(gettext "Example:  pkgdelta pacman-3.0.0.pkg.tar.gz pacman-3.0.1.pkg.tar.gz")\n"
-	echo
-	printf -- "$(gettext "Options:\n")"
-	printf -- "$(gettext "  -q, --quiet       minimize output\n")"
-	printf -- "$(gettext "  --nocolor         remove color from output\n")"
-	printf -- "$(gettext "  --min-pkg-size    minimum package size before deltas are generated\n")"
-	printf -- "$(gettext "  --max-delta-size  percent of new package above which the delta will be discarded\n")"
-}
-
-version() {
-	printf "pkgdelta (pacman) %s\n" "$myver"
-	printf -- "Copyright (c) 2009 Xavier Chantry <shiningxc at gmail.com>.\n"
-	printf '\n'
-	printf -- "$(gettext "\
-This is free software; see the source for copying conditions.\n\
-There is NO WARRANTY, to the extent permitted by law.\n")"
-}
-
-m4_include(library/human_to_size.sh)
-
-isnumeric() {
-	[[ $1 != *[!0-9]* ]]
-}
-
-read_pkginfo() {
-	unset pkgver pkgname arch
-	while IFS='=' read -r field value; do
-		# skip comments and invalid lines
-		[[ $field = '#'* || -z $value ]] && continue
-
-		# skip lines which aren't fields we care about
-		[[ $field != @(pkgver|pkgname|arch) ]] || continue
-
-		declare -g "${field% }=${value# }"
-
-		[[ $pkgname && $pkgver && $arch ]] && return 0
-	done < <(bsdtar -xOqf "$1" .PKGINFO 2>/dev/null)
-
-	error "$(gettext "Invalid package file '%s'.")" "$1"
-	return 1
-}
-
-# $oldfile $oldmd5 $newfile $newmd5 $deltafile $deltamd5 $deltasize
-create_xdelta()
-{
-	local oldfile=$1
-	local newfile=$2
-	local \
-	oldname oldver oldarch \
-	newname newver newarch \
-	deltafile
-
-	read_pkginfo "$oldfile" || return 1
-	oldname="$pkgname"
-	oldver="$pkgver"
-	oldarch="$arch"
-	read_pkginfo "$newfile" || return 1
-	newname="$pkgname"
-	newver="$pkgver"
-	newarch="$arch"
-
-	pkgsize="$(wc -c "$newfile" | cut -d' ' -f1)"
-
-	if ((pkgsize < min_pkg_size)); then
-		msg "$(gettext "Skipping delta creation for small package: %s - size %s")" "$newname" "$pkgsize"
-		return 0
-	fi
-
-	if [[ $oldname != "$newname" ]]; then
-		error "$(gettext "The package names don't match : '%s' and '%s'")" "$oldname" "$newname"
-		return 1
-	fi
-
-	if [[ $oldarch != "$newarch" ]]; then
-		error "$(gettext "The package architectures don't match : '%s' and '%s'")" "$oldarch" "$newarch"
-		return 1
-	fi
-
-	if [[ $oldver == "$newver" ]]; then
-		error "$(gettext "Both packages have the same version : '%s'")" "$newver"
-		return 1
-	fi
-
-	msg "$(gettext "Generating delta from version %s to version %s")" "$oldver" "$newver"
-	deltafile=$(dirname "$newfile")/$pkgname-${oldver}_to_${newver}-$arch.delta
-	local ret=0
-
-	xdelta3 -q -f -9 -S lzma -s "$oldfile" "$newfile" "$deltafile" || ret=$?
-	if (( ret )); then
-		error "$(gettext "Delta could not be created.")"
-		return 1
-	fi
-
-	deltasize="$(wc -c "$deltafile" | cut -d' ' -f1)"
-
-	if ((max_delta_size * pkgsize / 100 < deltasize)); then
-		msg "$(gettext "Delta package larger than maximum size. Removing.")"
-		rm -f "$deltafile"
-		return 0
-	fi
-
-	msg "$(gettext "Generated delta : '%s'")" "$deltafile"
-	(( QUIET )) && echo "$deltafile"
-
-	return 0
-}
-
-OPT_SHORT='hqV'
-OPT_LONG=('help' 'quiet' 'max-delta-size:' 'min-pkg-size:' 'nocolor' 'version')
-if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
-	exit 1
-fi
-set -- "${OPTRET[@]}"
-unset OPT_SHORT OPT_LONG OPTRET
-
-# parse arguments
-while :; do
-	case $1 in
-		-h|--help)
-			usage
-			exit 0 ;;
-		-V|--version)
-			version
-			exit 0 ;;
-		-q|--quiet)
-			QUIET=1;;
-		--nocolor)
-			USE_COLOR='n';;
-		--min-pkg-size)
-			if ! min_pkg_size=$(human_to_size "$2"); then
-				echo "invalid argument '$2' for option -- '$1'"
-				exit 1
-			fi
-			shift ;;
-		--max-delta-size)
-			arg=$(awk -v val="$2" 'BEGIN { print val * 100 }')
-			if ! isnumeric "$arg" || (( arg > 200 )); then
-				echo "invalid argument '$2' for option -- '$1'"
-				exit 1
-			fi
-			max_delta_size=$arg
-			shift ;;
-		--)
-			shift
-			break ;;
-	esac
-	shift
-done
-
-# check if messages are to be printed using color
-if [[ -t 2 && $USE_COLOR != "n" ]]; then
-	colorize
-else
-	unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-fi
-
-if (( $# != 2 )); then
-	usage
-	exit 1
-fi
-
-for i in "$@"; do
-	if [[ ! -f $i ]]; then
-		error "$(gettext "File '%s' does not exist")" "$i"
-		exit 1
-	fi
-done
-
-if ! type xdelta3 &>/dev/null; then
-	error "$(gettext "Cannot find the xdelta3 binary! Is xdelta3 installed?")"
-	exit 1
-fi
-
-create_xdelta "$@"
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index 25eb9d3f..5f02393d 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -5,7 +5,6 @@ scripts/makepkg.sh.in
 scripts/makepkg-template.pl.in
 scripts/pacman-db-upgrade.sh.in
 scripts/pacman-key.sh.in
-scripts/pkgdelta.sh.in
 scripts/repo-add.sh.in
 scripts/libmakepkg/integrity.sh.in
 scripts/libmakepkg/integrity/generate_checksum.sh.in
-- 
2.20.1


More information about the pacman-dev mailing list