[Bug 285197] ports-mgmt/pkg - v.2.0.6 - pkg-upgrade and pkg-version fail using multiple repositories

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 06 Mar 2025 14:07:57 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285197

--- Comment #2 from Eric <erichanskrs@gmail.com> ---
( in addition to comment #1 )

The attached DEBUG Session output is run on quarterly at
   DEBUG_LEVEL = 4;
when trying to upgrade
  drm-61-kmod-6.1.92.1401000_3
to
  drm-61-kmod-6.1.128.1402000_1

I choose to switch to quarterly because there are now two very different
versions in play,
which makes it easier to make the distinction between 
the installed version 
  and 
possible upgrade candidates

Note that I'm still using pkg v. 2.0.6 from 'latest'.

The commands used for this DEBUG session are:
[1-0] # date -u; uname -a; pkg -v
[2-0] # pkg sea '^drm-61-kmod'
[3-0] # pkg ins drm-61-kmod-6.1.92.1401000_3
[4-0] # sed.dlevel 4   # set DEBUG_LEVEL=4
[5-0] # pkg -vv | sed -n -e '/DEBUG/ p' -e '/^Repositories:/,$ p'
[6-0] # pkg upgrade -r FreeBSD -r FreeBSD-kmods drm-61-kmod
[7-0] # pkg upgrade -r FreeBSD  drm-61-kmod
[8-0] # pkg upgrade -r FreeBSD-kmods drm-61-kmod

Below is a snippet that may be relevant.
The lines have been numbered and double empty lines have been added 
for easier distinction.

I am unfamiliar with the innner workings of this (multi-repository) upgrade
process,
so I'm guessing as to what is happening.

In line #1 I see that the one local version drm-61-kmod-6.1.92.1401000 is added
to a set (for comparison I assume).
Line #2 adds the remote version drm-61-kmod-6.1.128.1402000
Line #3 adds the remote version drm-61-kmod-6.1.92.1401000_3; this one should
be selected as the viable upgrade candidate.

Skipping over mostly various db queries.
Lines #19-21 show the various versions in play.
Line #19 I do not understand:
(solver) rule: upgrade rule: upgrade local drm-61-kmod-6.1.128.1402000_1 to
remote drm-61-kmod-6.1.92.1401000_3
I don't see why a 'local' drm-61-kmod-6.1.128.1402000_1 is being used for
comparison.

Line #20-21 seem to compare the local, already installed
drm-61-kmod-6.1.92.1401000_3, used to be compared to remote available
candidates:
  1 - drm-61-kmod-6.1.92.1401000_3    - this is from the 'FreeBSD' repository
  2 - drm-61-kmod-6.1.128.1402000_1   - this is from the 'FreeBSD-kmods'
repository

It seems to be decided that 'the local drm-61-kmod' with its (hash-string?
ending in twb) is to be installed.
Later (line #29), it seems that this particular version is the same as the one
already installed, therefore the upgrade candidate is rejected.
This does not lead to the desired and expected behaviour of upgrading to:
 drm-61-kmod-6.1.128.1402000_1

--- Command sequence snippet
    [6-0] # pkg upgrade -r FreeBSD -r FreeBSD-kmods drm-61-kmod
        <snap>
 1      DBG(2)[3685]> (universe) add new local pkg: drm-61-kmod,
(drm-61-kmod-6.1.92.1401000_3:2$2$nxx89f1idgsw8rk7sa7fy5rrrwsi579bdzfxx6ixwc4kd3cz8a7o4wt1ynn1e65nhwzf1en4pubjix84id9tax9hxxt4dsyfxmzmtwb)
 2 DBG(2)[3685]> (universe) add new remote pkg: drm-61-kmod,
(drm-61-kmod-6.1.128.1402000_1:2$2$8me3pjg6btunyygfgaa1u8obw3n35uj8n91q9ujja664azgt919nb16x9t1o5xyf64kn8rrwcofdmc15kh8fjqo5ufewgnwd4a464ad)
 3 DBG(2)[3685]> (universe) add new remote pkg: drm-61-kmod,
(drm-61-kmod-6.1.92.1401000_3:2$2$nxx89f1idgsw8rk7sa7fy5rrrwsi579bdzfxx6ixwc4kd3cz8a7o4wt1ynn1e65nhwzf1en4pubjix84id9tax9hxxt4dsyfxmzmtwb)
 4 DBG(4)[3685]> (jobs) add new uid drm-61-kmod to the request


 5 DBG(4)[3685]> (db) running: 'SELECT DISTINCT d.name, d.origin, p.version, 0 
FROM deps AS d    LEFT JOIN packages AS p ON    (p.origin = d.origin AND p.name
= d.name)  WHERE d.package_id = 40  ORDER BY d.origin DESC'
 6 DBG(4)[3685]> (db) adding option
 7 DBG(4)[3685]> (db) running: 'SELECT option, value  FROM option    JOIN
pkg_option USING(option_id)  WHERE package_id = 40  ORDER BY option'
 8 DBG(4)[3685]> (db) adding option
 9 DBG(4)[3685]> (db) adding option
10 DBG(4)[3685]> (db) running: 'SELECT name  FROM pkg_shlibs_required, shlibs
AS s  WHERE package_id = 40    AND shlib_id = s.id  ORDER by name DESC'
11 DBG(4)[3685]> (db) running: 'SELECT name  FROM pkg_shlibs_provided, shlibs
AS s  WHERE package_id = 40    AND shlib_id = s.id  ORDER by name DESC'
12 DBG(4)[3685]> (db) running: 'SELECT k.annotation AS tag, v.annotation AS
value  FROM pkg_annotation p    JOIN annotation k ON (p.tag_id =
k.annotation_id)    JOIN annotation v ON (p.value_id = v.annotation_id)  WHERE
p.package_id = 40  ORDER BY tag, value'
13 DBG(4)[3685]> (db) running: 'SELECT packages.name  FROM pkg_conflicts   
LEFT JOIN packages ON    (packages.id = pkg_conflicts.conflict_id)  WHERE
package_id = 40'
14 DBG(4)[3685]> (db) running: 'SELECT provide  FROM pkg_provides, provides AS
s  WHERE package_id = 40    AND provide_id = s.id  ORDER by provide DESC'
15 DBG(4)[3685]> (db) running: 'SELECT require  FROM pkg_requires, requires AS
s  WHERE package_id = 40    AND require_id = s.id  ORDER by require DESC'
16 DBG(1)[3685]> (universe) removing drm-61-kmod from the request as it is the
same as local
17 DBG(4)[3685]> (solver) add variable from universe with uid pkg
18 DBG(4)[3685]> (solver) add variable from universe with uid drm-61-kmod


19 DBG(2)[3685]> (solver) rule: upgrade rule: upgrade local
drm-61-kmod-6.1.128.1402000_1 to remote drm-61-kmod-6.1.92.1401000_3
20 DBG(2)[3685]> (solver) rule: upgrade rule: upgrade local
drm-61-kmod-6.1.92.1401000_3 to remote drm-61-kmod-6.1.92.1401000_3
21 DBG(2)[3685]> (solver) rule: upgrade rule: upgrade local
drm-61-kmod-6.1.92.1401000_3 to remote drm-61-kmod-6.1.128.1402000_1
22 DBG(2)[3685]> (solver) decided local
pkg-2$2$14iqinm7q41u8hddbbinfdxuq3idn4pqn6kswsabz8mca7hunafy8hohqkb364dcp9f5n8wxdkgu9h7imfrd7md9cbo6qw6y73qefhy
to install
23 DBG(2)[3685]> (solver) decided local
drm-61-kmod-2$2$nxx89f1idgsw8rk7sa7fy5rrrwsi579bdzfxx6ixwc4kd3cz8a7o4wt1ynn1e65nhwzf1en4pubjix84id9tax9hxxt4dsyfxmzmtwb
to install
24 DBG(2)[3685]> (solver) decided remote
drm-61-kmod-2$2$8me3pjg6btunyygfgaa1u8obw3n35uj8n91q9ujja664azgt919nb16x9t1o5xyf64kn8rrwcofdmc15kh8fjqo5ufewgnwd4a464ad
to delete
25 DBG(2)[3685]> (solver) decided remote
drm-61-kmod-2$2$nxx89f1idgsw8rk7sa7fy5rrrwsi579bdzfxx6ixwc4kd3cz8a7o4wt1ynn1e65nhwzf1en4pubjix84id9tax9hxxt4dsyfxmzmtwb
to delete
26 DBG(4)[3685]> (solver) check variable with uid pkg
27 DBG(2)[3685]> (solver) ignoring package
pkg(2$2$14iqinm7q41u8hddbbinfdxuq3idn4pqn6kswsabz8mca7hunafy8hohqkb364dcp9f5n8wxdkgu9h7imfrd7md9cbo6qw6y73qefhy)
as its state has not been changed
28 DBG(4)[3685]> (solver) check variable with uid drm-61-kmod
29 DBG(2)[3685]> (solver) ignoring package
drm-61-kmod(2$2$nxx89f1idgsw8rk7sa7fy5rrrwsi579bdzfxx6ixwc4kd3cz8a7o4wt1ynn1e65nhwzf1en4pubjix84id9tax9hxxt4dsyfxmzmtwb)
as its state has not been changed
30 DBG(4)[3685]> (db) executing 'END TRANSACTION;'
31 Checking integrity...DBG(1)[3685]> (jobs) check integrity for 0 items added
32  done (0 conflicting)
33 Your packages are up to date.
34 DBG(1)[3685]> (db) release an advisory lock on a database
35 [7-0] #

-- 
You are receiving this mail because:
You are the assignee for the bug.