Mar 042021
 

Red Hat Enterprise Linux 7やCentOS 7では、yum-utilsパッケージに含まれるコマンドを使用してパッケージのダウンロード(yumdownloader)や不要になったパッケージの検索(package-cleanup)などをおこなっていました。

Red Hat Enterprise Linux 8やCentOS 8でも同パッケージは提供されていますが、導入される各コマンドは/usr/libexec/dnf-utilsへのシンボリックリンクとなっています。

/usr/libexec/dnf-utilsはPython実行ファイルになっており、以下のようにdnfコマンドへのマッピングがおこなわれています。

MAPPING = {'debuginfo-install': ['debuginfo-install'],
            'needs-restarting': ['needs-restarting'],
            'find-repos-of-install': ['list', 'installed'],
            'package-cleanup': [],
            'repo-graph': ['repograph'],
            'repoclosure': ['repoclosure'],
            'repodiff': ['repodiff'],
            'repomanage': ['repomanage'],
            'repoquery': ['repoquery'],
            'reposync': ['reposync'],
            'repotrack': ['download', '--resolve', '--alldeps'],
            'yum-builddep': ['builddep'],
            'yum-config-manager': ['config-manager'],
            'yum-debug-dump': ['debug-dump'],
            'yum-debug-restore': ['debug-restore'],
            'yumdownloader': ['download']
            }

yumdownloaderであればdnf downloadyum-config-managerであればdnf config-managerといった具合です。

package-cleanupは更に先のif文で詳細なマッピングとオプション指定がおこなわれています。

if command == 'package-cleanup':
     if '--dupes' in args:
         args[args.index('--dupes')] = '--duplicates'
         MAPPING[command] = ['repoquery']
     elif '--leaves' in args:
         args[args.index('--leaves')] = '--unneeded'
         MAPPING[command] = ['repoquery']
     elif '--orphans' in args:
         args[args.index('--orphans')] = '--extras'
         MAPPING[command] = ['repoquery']
     elif '--problems' in args:
         args[args.index('--problems')] = '--unsatisfied'
         MAPPING[command] = ['repoquery']
     elif '--cleandupes' in args:
         args[args.index('--cleandupes')] = '--duplicates'
         MAPPING[command] = ['remove']
     else:
         sys.stderr.write('package-cleanup has to be executed with one of the options: --dupes, '
                          '--leaves, --orphans, --problems or --cleandupes\n')

package-cleanup --leavesdnf repoquery --unneededということですね。

ただ、マッピングもいまいちわからないし(man dnfできちんと調べればわかるのでしょうが)、dnf-utilsの中身を見るぐらいなら結局yum-utils暫く使いそうです。

Sorry, the comment form is closed at this time.