Bug 2132574

Summary: Fedora-review fails to install metapackages with local dependencies
Product: [Fedora] Fedora Reporter: Akira TAGOH <tagoh>
Component: fedora-reviewAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: admiller, alex.ploumistos, benson_muite, copr-team, jkeating, leamas.alec, mebrown, michel, msuchy, ngompa13, philip.wyett, pingou, praiskup, williams
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: fedora-review-0.10.0-2.fc38 fedora-review-0.10.0-2.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-28 02:41:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1822847    

Description Akira TAGOH 2022-10-06 07:57:03 UTC
Description of problem:
I have submitted a package review (https://bugzilla.redhat.com/show_bug.cgi?id=1822847) and facing a weird error from fedora-review.
They reported the installation errors like this:

INFO: installing package(s): /builddir/vl-pgothic-fonts-20220612-2.fc38.noarch.r
pm /builddir/vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm
ERROR: Command failed: 
 # /usr/bin/dnf --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releas
ever 38 --setopt=deltarpm=False --allowerasing --disableplugin=local --disablepl
ugin=spacewalk --disableplugin=versionlock install /builddir/vl-pgothic-fonts-20
220612-2.fc38.noarch.rpm /builddir/vl-gothic-fonts-all-20220612-2.fc38.noarch.rp
m

Sure. following that step indeed introduces an error. but they are missing one package generated by rpm apparently. see:

$ ls -1 1822847-vl-gothic-fonts/results/
build.log
hw_info.log
installed_pkgs.log
root.log
state.log
vl-gothic-fonts-20220612-2.fc38.noarch.rpm
vl-gothic-fonts-20220612-2.fc38.src.rpm
vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm
vl-pgothic-fonts-20220612-2.fc38.noarch.rpm

vl-gothic-fonts-all is a meta package which has dependencies to vl-gothic-fonts and vl-pgothic-fonts here. so that error happens.

That looks like a bug in fedora-review.

Version-Release number of selected component (if applicable):
fedora-review-0.9.0-1.fc38.noarch

How reproducible:
always

Steps to Reproduce:
1.fedora-review -b 1822847

Comment 1 Benson Muite 2022-10-06 09:50:07 UTC
Tested this using mock. On its own, the following fails:

mock -r fedora-rawhide-x86_64 rebuild vl-gothic-fonts-20220612-2.fc38.src.rpm
mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm

however installing the separate font packages first works:
mock -r fedora-rawhide-x86_64 rebuild vl-gothic-fonts-20220612-2.fc38.src.rpm
mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-20220612-2.fc38.noarch.rpm
mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-pgothic-fonts-20220612-2.fc38.noarch.rpm
mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm

This seems to affect other metapackages as well.  For some reason, the dependencies in the metapackage are not installed first.

Comment 2 Benson Muite 2022-10-07 12:22:29 UTC
Updated component to mock, tested with mock 3.1, rpm 4.17.1 and dnf 4.14.0. The fonts install from https://copr.fedorainfracloud.org/coprs/fed500/vl-gothic-fonts/ mock needs a way to install metapackages when dependencies are local.

Comment 3 Benson Muite 2022-10-07 14:45:41 UTC
The following also works:
mock -r fedora-rawhide-x86_64 --postinstall rebuild vl-gothic-fonts-20220612-2.fc38.src.rpm
Possibly https://pagure.io/FedoraReview/blob/master/f/src/FedoraReview/mock.py could be modified to rebuild and install if installation on its own fails?

Mock does not seem to have tests with metapackages:
https://github.com/rpm-software-management/mock/tree/main/mock/integration-tests

Comment 4 Pavel Raiskup 2022-10-10 07:57:31 UTC
Thank you for the report @Akira and @Benson!

(In reply to Benson Muite from comment #1)
> Tested this using mock. On its own, the following fails:
> 
> mock -r fedora-rawhide-x86_64 rebuild vl-gothic-fonts-20220612-2.fc38.src.rpm
> mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm

This can not work.  This is an explicit request for package installation,
using a path to filename, not a repository.  Mock is not informed about the
other dependency packages.

> however installing the separate font packages first works:
> mock -r fedora-rawhide-x86_64 rebuild vl-gothic-fonts-20220612-2.fc38.src.rpm
> mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-20220612-2.fc38.noarch.rpm
> mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-pgothic-fonts-20220612-2.fc38.noarch.rpm
> mock -r fedora-rawhide-x86_64 install /var/lib/mock/fedora-rawhide-x86_64/result/vl-gothic-fonts-all-20220612-2.fc38.noarch.rpm

And naturally, this works.  The two first commands modify the chroot, and
then the `*-all` package can be installed.

> This seems to affect other metapackages as well.  For some reason, the
> dependencies in the metapackage are not installed first.

It is not just about metapackages; any missing dependency will cause
problems.  There are at least two ways out:

1. install all the packages at once:

  $ mock -r fedora-rawhide-x86_64 install dep1.rpm dep2.rpm ... metapackage.rpm

2. provide an additional repository with all the dependencies:

  $ mkdir /tmp/repo
  $ cp  /var/lib/mock/fedora-rawhide-x86_64/result/*.rpm /tmp/repo
  $ createrepo_c /tmp/repo
  $ mock -r fedora-rawhide-x86_64 --install v1-gothic-fonts-all --addrepo /tmp/repo

Note that in the 2nd case I'm intentionally copying the *rpm files out
from the chroot result directory.  It seems less error-prone (better
than mixing mock's inputs and outputs in one command).

I'm closing this bug, but feel free to continue discussing here.

Comment 5 Benson Muite 2022-10-12 13:19:19 UTC
@praiskup Thanks for the suggestions. Will test what can be implemented in fedora-review, the second option seems easier to implement.

Comment 6 Pavel Raiskup 2022-10-12 18:44:14 UTC
Seems like the needinfo flag was raised mistakenly (no question asked), let's clear it up.

Comment 7 Benson Muite 2022-10-14 12:48:19 UTC
Changing the status sine it appears fixes can be made in fedora-review

Comment 8 Benson Muite 2022-10-14 21:22:05 UTC
The problem is that the dependencies are taken from the packages explicitly listed in the spec file:
https://pagure.io/FedoraReview/blob/master/f/src/FedoraReview/mock.py#_334
More packages than these can be generated when there are metapackages. Pull request with a
possible fix:
https://pagure.io/FedoraReview/pull-request/460

Comment 9 Benson Muite 2022-10-15 11:42:13 UTC
Using rpmspec https://rpm-software-management.github.io/rpm/man/rpmspec.8.html could be an alternative method or additional check.

Comment 10 Fedora Update System 2023-07-25 02:38:04 UTC
FEDORA-2023-6e77bcd1e7 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-6e77bcd1e7

Comment 11 Fedora Update System 2023-07-25 02:38:04 UTC
FEDORA-2023-a62b830c9a has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-a62b830c9a

Comment 12 Fedora Update System 2023-07-26 01:57:12 UTC
FEDORA-2023-a62b830c9a has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a62b830c9a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a62b830c9a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2023-07-26 02:09:08 UTC
FEDORA-2023-6e77bcd1e7 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-6e77bcd1e7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-6e77bcd1e7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2023-07-27 01:56:25 UTC
FEDORA-2023-a62b830c9a has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a62b830c9a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a62b830c9a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2023-07-27 02:55:22 UTC
FEDORA-2023-6e77bcd1e7 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-6e77bcd1e7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-6e77bcd1e7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2023-07-28 02:41:23 UTC
FEDORA-2023-6e77bcd1e7 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2023-08-04 01:28:18 UTC
FEDORA-2023-a62b830c9a has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.