[pacman-dev] [PATCH] repo-add: Ensure only adding package's deltas.

Nathan Jones nathanj at insightbb.com
Mon Nov 12 16:54:50 EST 2007


repo-add was adding the delta files of any package that started with the
same package name plus a hyphen.

In this example, deltatest-libs delta files were added to the deltatest
package:

$ repo-add deltatest.db.tar.gz deltatest-1.0.2-1-i686.pkg.tar.gz
==> Extracting database to a temporary location...
==> Adding package 'deltatest-1.0.2-1-i686.pkg.tar.gz'
  -> Removing existing package 'deltatest-1.0.2-1'...
  -> Creating 'desc' db entry...
  -> Computing md5 checksums...
  -> Creating 'depends' db entry...
  -> Creating 'deltas' db entry...
  -> Added delta 'deltatest-1.0.2rc3-1_to_1.0.2-1-i686.delta'
  -> Added delta 'deltatest-libs-1.0.0-1_to_1.0.1-1-i686.delta'
==> Creating updated database file /tmp/deltatest.db.tar.gz

Signed-off-by: Nathan Jones <nathanj at insightbb.com>
---
 scripts/repo-add.sh.in |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 4dfedbe..adcefc1 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -218,7 +218,13 @@ db_write_entry()
 
 	# create deltas entry if there are delta files
 	for delta in $startdir/$pkgname-*-*_to_*-*-$arch.delta; do
-		if [ -f "$delta" ]; then
+		# 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...")"
-- 
1.5.3.5




More information about the pacman-dev mailing list