Bug 1886567
Summary: | libdnf 0.54.2 / dnf 4.4.0 break ARM disk image builds (and hence Rawhide composes) | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Adam Williamson <awilliam> |
Component: | livecd-tools | Assignee: | Neal Gompa <ngompa13> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | urgent | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | adam.stokes, bcl, bruno, dhuff, dmach, jmracek, jrohel, katzj, mblaha, mboddu, metherid, ngompa13, nsella, pkratoch, robatino, rpm-software-management, vanmeeuwen+fedora |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-10-19 21:41:52 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: | 1829022 |
Description
Adam Williamson
2020-10-08 18:59:49 UTC
From the imgcreate source, I believe excludedPkgs is a list. oh, it seems we're actually concerned about package_types / pkg_types here. imgcreate passes it as a set: package_types = {'mandatory', 'default'} if include == GROUP_REQUIRED: package_types.remove('default') elif include == GROUP_ALL: package_types.add('optional') looking at dnf source, I can see cases where it's passed as a tuple (in several of the tests and in dnf/cli/commands/install.py via env_group_install) and as a list (in some of the examples, at least). I don't see any cases of it being passed as a set. The API docs state "`pkg_types` is a sequence of strings...". Python 3 docs state "There are three basic sequence types: lists, tuples, and range objects." - https://docs.python.org/3/library/stdtypes.html - so by implication a set is not considered a "sequence", so I guess we can say livecd-creator (where imgcreate comes from) is kinda out of bounds here and should convert the package types to a tuple or list before passing them. Though since it worked before it might be nice if it could be made to keep working, I guess. Looks like the upstream change that triggered this was probably https://github.com/rpm-software-management/dnf/commit/4d991f6154cbf888d304f7accb0a7024951e6b68 . I'm having trouble figuring where the hell 'listToCompsPackageType' actually comes from though. That string doesn't exist in the libdnf source. Must be weird Python binding stuff? Sigh, I'm looking on the wrong libdnf branch. Not 'master' but 'dnf-4-master' is right. Still, that doesn't tell us a lot more, just confirms that listToCompsPackageType is expecting a vector of strings and presumably not getting one. I tried to figure out what C++ type SWIG converts a Python set of strings to, but didn't get very far because, well, it's complicated and hard to understand. But I'm guessing the answer is "not a vector of strings". OK, yup, I think I'm right. >>> libdnf.transaction.listToCompsPackageType({"mandatory", "default"}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.9/site-packages/libdnf/transaction.py", line 424, in listToCompsPackageType return _transaction.listToCompsPackageType(types) TypeError: in method 'listToCompsPackageType', argument 1 of type 'std::vector< std::string,std::allocator< std::string > > const &' >>> libdnf.transaction.listToCompsPackageType(tuple({"mandatory", "default"})) 6 >>> I'll send a PR for livecd-tools and backport it. https://koji.fedoraproject.org/koji/taskinfo?taskID=53027536 should fix this for Rawhide. I also built it for F33 - https://koji.fedoraproject.org/koji/taskinfo?taskID=53027564 - and that build should go into the F33 update for dnf 4.4.0 assuming one is submitted. For dnf folks: I checked the dnf code back to 2013 and it looks to me like it always worked with any kind of iterable, because it just used `if X in pkg_types:` style logic. So even though the wording in the API docs kinda does suggest only sequences are allowed, it might be a good idea if possible to have the libdnf code also handle sets and maybe any other iterable types we can think of, just in case there's other code lurking out there which does something similar. I checked the things I could think of (anaconda and dnfdaemon) and they both look okay, but there may well be other things that use this codepath. oh, I suppose you could also try to handle this in dnf by just changing: types = libdnf.transaction.listToCompsPackageType(types) to: types = libdnf.transaction.listToCompsPackageType(list(types)) or tuple(types). This has been fixed for a while. |