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 <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Nathan Jones 2007-11-12 16:54:50 -05:00 committed by Dan McGee
parent 103c3ac5a7
commit c29209e7b6
1 changed files with 7 additions and 1 deletions

View File

@ -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...")"