From 24da5f48f6397b74b19de9e66d2744902f337e3f Mon Sep 17 00:00:00 2001 From: Zheng Ruoqin Date: Mon, 11 Mar 2019 10:21:26 -0700 Subject: [PATCH] Fix configure of tui.py for dnf 4.1.0. Signed-off-by: Zheng Ruoqin --- README.md | 32 +++++++++++++++++++------------- dnf-plugins/tui.py | 13 ++++++++++++- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 347f123..33be890 100644 --- a/README.md +++ b/README.md @@ -702,32 +702,38 @@ file system or Reference2 to install systemd based root file system. ### 3.1.4 Manage packages by command line -After init, you can use dnf tui command line to manage packages such as using dnf in other Distro (e.g. Fedora). +After init, you can use dnf tui command line to manage packages such as using dnf in other Distro. e.g. ``` # dnf tui --command info bash //show info of a package # dnf tui --command install bash //install a package ``` -More information please reference to https://fedoraproject.org/wiki/DNF?rd=Dnf. +More information please refer to https://fedoraproject.org/wiki/DNF?rd=Dnf. -New options of tui. -
(1) --pkg_list PKG_LIST -PKG_LIST is package list file for packages you want to install, remove or upgrade. -e.g. +##### 3.1.4.1 New options of 'dnf tui --command'. + +
(1) --nosave +
Dnf tui use .config to save installed packages. Every time after install, remove or upgrade, dnf tui will automatically update .config file. +``` + # cat .config + base-files + bash + ...... +``` +
If you don't want to update .config file, you can add --nosave option. +
e.g. ``` - # dnf tui --command install --pkg_list PKG_LIST //install all packages in PKG_LIST + # dnf tui --command install bash --nosave + # dnf tui --command remove bash --nosave ``` - Note: - Every time after install, remove or upgrade, dnf tui will automatically save the package list for installed packages in .config file in current directory. +
(2) --pkg_list file +
'--pkg_list' is used to manage packages that list in the file, such as install, remove or upgrade. -
(2) --nosave - If you don't want to save .config file, you can add --nosave option. e.g. ``` - # dnf tui --command install/remove/upgrade bash --nosave - # dnf tui --command install/remove/upgrade --pkg_list pkg_config --nosave + # dnf tui --command install --pkg_list pkg.list ``` ### 3.1.5 Manage srpm or spdx file by command line diff --git a/dnf-plugins/tui.py b/dnf-plugins/tui.py index 76c12b4..c1f9ade 100755 --- a/dnf-plugins/tui.py +++ b/dnf-plugins/tui.py @@ -165,7 +165,7 @@ def pre_configure(self): self.opts.logdir = os.path.dirname(install_root_from_env) #Execute dnf command line - if isinstance(self.opts.command_args,list): + if self.opts.command_args is not None: os.environ["LD_PRELOAD"] = '' base_cmd = "%s/dnf-host" % (plugin_dir) if len(self.opts.command_args) > 0: @@ -224,7 +224,18 @@ def pre_configure(self): sys.exit(0) def configure(self): + # append to ShellDemandSheet missing demands from + # dnf.cli.demand.DemandSheet with their default values. + default_demands = self.cli.demands self.cli.demands = dnf.cli.commands.shell.ShellDemandSheet() + for attr in dir(default_demands): + if attr.startswith('__'): + continue + try: + getattr(self.cli.demands, attr) + except AttributeError: + setattr(self.cli.demands, attr, getattr(default_demands, attr)) + demands = self.cli.demands demands.root_user = False