packages_tree: exact package name match is trumped by other providers

Bug #1656888 reported by Alexandru Avadanii
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
packetary
Fix Released
Undecided
Alexandru Avadanii

Bug Description

Ubuntu frequently has multiple providers for the same package name,
e.g. "vim" is provided by "vim", "vim-gnome" etc.

Below is a sample dump of an internal packetary's list of matches for a generic
"vim" package requirement, without a version enforced, based on current Xenial repos:

vim-gtk3-py2 (2:7.4.1689-3ubuntu1)
vim-gnome (2:7.4.1689-3ubuntu1)
vim-gtk (2:7.4.1689-3ubuntu1)
vim-nox (2:7.4.1689-3ubuntu1)
vim-gtk-py2 (2:7.4.1689-3ubuntu1)
vim-gnome-py2 (2:7.4.1689-3ubuntu1)
vim-nox-py2 (2:7.4.1689-3ubuntu1)
vim (2:7.4.1689-3ubuntu1)
vim-gtk3 (2:7.4.1689-3ubuntu1)
vim-athena (2:7.4.1689-3ubuntu1)
vim-athena-py2 (2:7.4.1689-3ubuntu1)
vim-gtk (2:7.4.1689-3ubuntu1.2)
vim-gnome-py2 (2:7.4.1689-3ubuntu1.2)
vim-gtk-py2 (2:7.4.1689-3ubuntu1.2)
vim-nox (2:7.4.1689-3ubuntu1.2)
vim-nox-py2 (2:7.4.1689-3ubuntu1.2)
vim-gtk3 (2:7.4.1689-3ubuntu1.2)
vim (2:7.4.1689-3ubuntu1.2)
vim-athena (2:7.4.1689-3ubuntu1.2)
vim-athena-py2 (2:7.4.1689-3ubuntu1.2)
vim-gnome (2:7.4.1689-3ubuntu1.2)
vim-gtk3-py2 (2:7.4.1689-3ubuntu1.2)

Currently, packetary solves the "vim" relation by using the last item
in the sorted list, in this case "vim-gtk3-py2"; instead of using the
exact package name match "vim".

NOTE: Xenial recently added the "*-py2" packages, previously our
selection included "vim" just by chance.

This leads to our final mirror clone missing the "vim" package, and
inherintely failing to build bootstrap/target images using only the
partial Ubuntu mirror in OPNFV ISO.

To reproduce, run packetary:

$ packetary --threads-num 10 clone \
  -t deb \
  -r ubuntu_mirror.yaml \
  -R ubuntu_packages.yaml \
  -d .

ubuntu_mirror.yaml:
- name: ubuntu
  path: /home/alav/fuel/build/f_isoroot/f_repobuild/nailgun/mirrors/ubuntu
  priority: null
  section:
  - main
  - multiverse
  - restricted
  - universe
  suite: xenial
  type: deb
  uri: http://mirror.zetup.net/ubuntu/

ubuntu_packages.yaml:
mandatory: exact
packages:
- name: vim
[...]

$ find /home/alav/fuel/build/f_isoroot/f_repobuild/nailgun/mirrors/ubuntu -name vim*deb
[ ... missing logs, but we have a bunch of "vim-gnome", "vim-gtk3", and no "vim" ... ]

The proposed fix is to first check the list for an exact name match,
which would trump any secondary providers, even if they have a
higher package version.

One problem with the current form of the proposed patch is that newer versions of alternative
providers are trumped by an exact package name patch.

However, one major consequence of the proposed fix is the drastic size reduction of the cloned mirror,
without any functional impact (all requirements are still satisfied with the reduced set).

I'm not really convinced my patch is the right way to do it, and I haven't tested it with RPM cloning, but it should "just work" (?).

Changed in packetary:
assignee: nobody → Alexandru Avadanii (alexandru-avadanii)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to packetary (master)

Reviewed: https://review.openstack.org/420815
Committed: https://git.openstack.org/cgit/openstack/packetary/commit/?id=25b8673f84946b1072605137a4a1f60c89586489
Submitter: Jenkins
Branch: master

commit 25b8673f84946b1072605137a4a1f60c89586489
Author: Alexandru Avadanii <email address hidden>
Date: Sun Jan 15 00:40:15 2017 +0100

    packages_tree: exact match trumps other providers

    Ubuntu frequently has multiple providers for the same package name,
    e.g. "vim" is provided by "vim", "vim-gnome" etc.

    We need to adjust the resolving algorithm to:
    1. lookup in virtual packages
    2. lookup in packages
    3. lookup in obsoletes.
    Use the package which was found last (version-sorted).

    Closes-bug: 1656888

    Change-Id: I7279aa6526ff9133829be2e316932c9b052c7814
    Signed-off-by: Alexandru Avadanii <email address hidden>

Changed in packetary:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.