From c29209e7b6555b140794ffb6907fbd33f0d0aa88 Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Mon, 12 Nov 2007 16:54:50 -0500 Subject: repo-add: Ensure only adding package's deltas. 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 Signed-off-by: Dan McGee --- scripts/repo-add.sh.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 4dfedbe6..adcefc1d 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...")" -- cgit v1.2.3-70-g09d2