[pacman-dev] [PATCH 5/6] repo-add : drop delta support to rewrite it from scratch

Xavier Chantry shiningxc at gmail.com
Thu Feb 26 15:06:16 EST 2009


The current implementation has several problems :

Wrong database format

All the info is taken from the filename, which is a bit ugly

It looks for .delta files in the current directory when adding a package,
which is not very flexible

Signed-off-by: Xavier Chantry <shiningxc at gmail.com>
---
 scripts/repo-add.sh.in |   59 ------------------------------------------------
 1 files changed, 0 insertions(+), 59 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index c21a08f..9cf66e5 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -107,37 +107,6 @@ find_pkgentry()
 	return 1
 }
 
-# write a delta entry to the pacman database
-#   arg1 - path to delta
-db_write_delta()
-{
-	# blank out all variables
-	local deltafile="$1"
-	local filename=$(basename "$deltafile")
-	local deltavars pkgname fromver tover arch csize md5sum
-
-	# format of the delta filename:
-	# (package)-(fromver)_to_(tover)-(arch).delta
-	deltavars=( $(echo "$filename" | sed -e 's/\(.*\)-\(.*-.*\)_to_\(.*-.*\)-\(.*\).delta/\1 \2 \3 \4/') )
-	pkgname=${deltavars[0]}
-	fromver=${deltavars[1]}
-	tover=${deltavars[2]}
-	arch=${deltavars[3]}
-
-	# get md5sum and size of delta
-	md5sum="$(openssl dgst -md5 "$deltafile" | awk '{print $NF}')"
-	csize=$(@SIZECMD@ "$deltafile")
-
-	# ensure variables were found
-	if [ -z "$pkgname" -o -z "$fromver" -o -z "$tover" -o -z "$arch" ]; then
-		return 1
-	fi
-
-	# add the entry for this delta file
-	echo -e "$fromver $tover $csize $filename $md5sum" >>deltas
-} # end db_write_delta
-
-
 # write an entry to the pacman database
 #   arg1 - path to package
 db_write_entry()
@@ -232,40 +201,12 @@ db_write_entry()
 	write_list_entry "PROVIDES" "$_provides" "depends"
 	write_list_entry "OPTDEPENDS" "$_optdepends" "depends"
 
-	# create deltas entry if there are delta files
-	# Xav : why should deltas be in $startdir?
-	for delta in $startdir/$pkgname-*-*_to_*-*-$arch.delta; do
-		# This for loop also pulls in all files that start with the current package
-		# name and are followed by a -whatever. For instance, running this loop for
-		# gcc would also grab gcc-libs. To guard against this, compare the package
-		# name of the delta to the current package name.
-		local filename=$(basename "$delta")
-		local dpkgname="$(echo "$filename" | sed -e 's/\(.*\)-.*-.*_to_.*-.*-.*.delta/\1/')"
-		if [ "$pkgname" = "$dpkgname" -a -f "$delta" ]; then
-			# create deltas file if it does not already exist
-			if [ ! -f "deltas" ]; then
-				msg2 "$(gettext "Creating 'deltas' db entry...")"
-				echo -e "%DELTAS%" >>deltas
-			fi
-
-			# write this delta entry
-			if db_write_delta "$delta"; then
-				msg2 "$(gettext "Added delta '%s'")" "$(basename "$delta")"
-			else
-				warning "$(gettext "Could not add delta '%s'")" "$(basename "$delta")"
-			fi
-		fi
-	done
-	# add the final newline
-	[ -f "deltas" ] && echo -e "" >>deltas
-
 	popd 2>&1 >/dev/null
 
 	# preserve the modification time
 	# Xav : what for?
 	pkgdir="$gstmpdir/$pkgname-$pkgver"
 	touch -r "$pkgfile" "$pkgdir/desc" "$pkgdir/depends"
-	[ -f "$pkgdir/deltas" ] && touch -r "$pkgfile" "$pkgdir/deltas"
 
 	return 0
 } # end db_write_entry
-- 
1.6.1.3



More information about the pacman-dev mailing list