Fix package manager decisions#419
Conversation
mock/py/mockbuild/package_manager.py
Outdated
| from .trace_decorator import traceLog, getLog | ||
|
|
||
| fallbacks = { | ||
| 'dnf': ['dnf', 'yum', 'microdnf'], |
There was a problem hiding this comment.
Shouldn't this be ['dnf', 'microdnf', 'yum']?
There was a problem hiding this comment.
Probably yes, good point.
6823a18 to
e1a57c3
Compare
|
@praiskup Also, how do we handle for the YUM package manager preferring |
|
Meh, I forgot about that. I'll special-case that case, thank you! |
| option = '{}_command'.format(name) | ||
| pathname = config_opts[option] | ||
| if not os.path.isfile(pathname): | ||
| if pathname == '/usr/bin/yum': |
There was a problem hiding this comment.
I can have yum-deprecated without yum by having the yum package installed and the dnf-yum package not installed. This should account for that.
There was a problem hiding this comment.
The pathname variable only contains "expected" location. This code doesn't
work with package name - so I think it should work just fine. Can you please
take another look?
There was a problem hiding this comment.
There's the other problem, if there are both yum and dnf-yum packages installed. The check simply prefers '/usr/bin/yum' (which is dnf) and tells that there's no yum ... I'll fix this.
There was a problem hiding this comment.
Can be tested with mock from dnf copr enable praiskup/mock-fixes, if anyone wanted to try.
360223d to
b554860
Compare
| self.builddep_command = ['/usr/bin/yum-builddep-deprecated'] | ||
| # the command in bootstrap may not exists yet | ||
| if bootstrap_buildroot is None: | ||
| self._check_command() |
There was a problem hiding this comment.
FWIW, I'm not entirely sure that suggesting --dnf or --yum here is correct.
mock/py/mockbuild/package_manager.py
Outdated
|
|
||
|
|
||
| def package_manager_class(config_opts, buildroot, bootstrap_buildroot=None): | ||
| pm = config_opts.get('package_manager', 'yum') |
There was a problem hiding this comment.
I changed the default to 'dnf' several commits ago.
mock/py/mockbuild/package_manager.py
Outdated
|
|
||
| fallbacks = { | ||
| 'dnf': ['dnf', 'microdnf', 'yum'], | ||
| 'yum': ['yum', 'dnf', 'microdnf'], |
There was a problem hiding this comment.
MicroDNF cannot actually work without DNF. Yet. So having microdnf in fallback for yum and dnf does not have sense. E.g. Microdnf cannot do 'builddep' command and execute dnf for that.
| if distribution in util.RHEL_CLONES: | ||
| version = int(version.split('.')[0]) | ||
| if version < 8: | ||
| if ('dnf_warning' not in config_opts or config_opts['dnf_warning']) and \ |
c027e0c to
b229224
Compare
|
PTAL, the output now is (on F31 with installed yum.rpm): vs. |
mock/etc/mock/site-defaults.cfg
Outdated
| # config_opts['dnf_vars'] = { 'key': 'value', 'key2': 'value2' } | ||
| # | ||
| # Flip this if you want to get rid of warning message on systems which does not support DNF | ||
| # Flip this if you want to get rid of warning message on systems which does not support |
Previously we only warned when 'dnf' was expected for chroot initialization, but wasn't available. Now we detect this situation also for other package managers (e.g. missing /bin/yum, etc.). When installing bootstrap chroot, we aren't anymore that much picky about host pkg manager. This means that '/bin/yum' doesn't have to be installed at all on host to install yum-based bootstrap, but more importantly '/bin/dnf' doesn't have to exist on YUM based hosts when installing DNF based chroots. This should demotivate users from using '--yum' option on YUM based options to install bootstrap (rpm-software-management#233). Fixes: rpm-software-management#233
Detect '/bin/yum' symlink to 'dnf' In such case we actually talk to 'dnf', and it doesn't make any sense to instantiate Yum class. This is generalized to other package managers as well, even though it is less likely to happen.
Special-case searching for yum-deprecated binary on host The Yum class code dealing with 'yum-deprecated' script isn't nice, because it blindly overrides (possibly) user-specified config_opts['yum_command']. I don't want to change that part of code now (too late, yum-deprecated is not likely to be seen on users' hosts anyways). So I only check if the /usr/bin/yum-deprecated exists, and postpone all the important decisions to the Yum class logic.
yum: delay the check for /usr/bin/yum a bit The check needs to be done once we detected that yum-deprecated needs to be used instead. This fails e.g. on F29 with 'yum' installed but missing 'yum-dnf' (if yum-dnf get's installed it works fine, but yum-dnf ins't used at all).
mock: default the pkg manager to dnf The default should always be given by util.py anyways.
b229224 to
dcfe010
Compare
Fixes #233.
From commits: