From d1ca11561e184ed3bfded69140b2ccaf709d0ae3 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 6 Sep 2018 10:02:33 -0700 Subject: [PATCH] - Add the create ISO component for ARMv7 (pbrobinson@gmail.com) - Don't activate default auto connections after switchroot (rvykydal@redhat.com) - Ignore a pylint warning about UnquotingConfigParser get args (bcl@redhat.com) - Ditch all use of pyanaconda's simpleconfig (awilliam@redhat.com) --- .gitignore | 1 + ...all-use-of-pyanaconda-s-simpleconfig.patch | 166 ------------------ lorax.spec | 17 +- sources | 2 +- 4 files changed, 9 insertions(+), 177 deletions(-) delete mode 100644 0001-Ditch-all-use-of-pyanaconda-s-simpleconfig.patch diff --git a/.gitignore b/.gitignore index 83ce971..b050477 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,4 @@ /lorax-29.11.tar.gz /lorax-29.12.tar.gz /lorax-29.13.tar.gz +/lorax-29.14.tar.gz diff --git a/0001-Ditch-all-use-of-pyanaconda-s-simpleconfig.patch b/0001-Ditch-all-use-of-pyanaconda-s-simpleconfig.patch deleted file mode 100644 index cd0d987..0000000 --- a/0001-Ditch-all-use-of-pyanaconda-s-simpleconfig.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 3f4759a58ba87ed434dc0093bda817002ee2400d Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Thu, 30 Aug 2018 11:31:55 -0700 -Subject: [PATCH] Ditch all use of pyanaconda's simpleconfig - -lorax uses pyanaconda's SimpleConfigParser in three different -places (twice with a copy that's been dumped into pylorax, once -by importing it), just to do a fairly simple job: read some -values out of /etc/os-release. The only value SimpleConfigParser -is adding over Python's own ConfigParser here is to read a file -with no section headers, and to unquote the values. The cost is -either a dependency on pyanaconda, or needing to copy the whole -of simpleparser plus some other utility bits from pyanaconda -into lorax. This seems like a bad trade-off. - -This changes the approach: we copy one very simple utility -function from pyanaconda (`unquote`), and do some very simple -wrapping of ConfigParser to handle reading a file without any -section headers, and returning unquoted values. This way we can -read what we need out of os-release without needing a dep on -pyanaconda or to copy lots of things from it into pylorax. - -Resolves: #449 -Resolves: #450 - -Signed-off-by: Adam Williamson ---- - src/pylorax/api/compose.py | 15 ++++++--------- - src/pylorax/api/dnfbase.py | 7 +++---- - src/pylorax/sysutils.py | 23 +++++++++++++++++++++++ - src/sbin/lorax | 7 +++---- - 4 files changed, 35 insertions(+), 17 deletions(-) - -diff --git a/src/pylorax/api/compose.py b/src/pylorax/api/compose.py -index c0ed3b7d..816ea535 100644 ---- a/src/pylorax/api/compose.py -+++ b/src/pylorax/api/compose.py -@@ -40,8 +40,6 @@ import pytoml as toml - import shutil - from uuid import uuid4 - --from pyanaconda.simpleconfig import SimpleConfigFile -- - # Use pykickstart to calculate disk image size - from pykickstart.parser import KickstartParser - from pykickstart.version import makeVersion -@@ -51,7 +49,7 @@ from pylorax.api.projects import ProjectsError - from pylorax.api.recipes import read_recipe_and_id - from pylorax.api.timestamp import TS_CREATED, write_timestamp - from pylorax.imgutils import default_image_name --from pylorax.sysutils import joinpaths -+from pylorax.sysutils import joinpaths, flatconfig - - - def test_templates(dbo, share_dir): -@@ -356,14 +354,13 @@ def start_build(cfg, dnflock, gitlock, branch, recipe_name, compose_type, test_m - # Get the title, project, and release version from the host - if not os.path.exists("/etc/os-release"): - log.error("/etc/os-release is missing, cannot determine product or release version") -- os_release = SimpleConfigFile("/etc/os-release") -- os_release.read() -+ os_release = flatconfig("/etc/os-release") - -- log.debug("os_release = %s", os_release) -+ log.debug("os_release = %s", dict(os_release.items())) - -- cfg_args["title"] = os_release.get("PRETTY_NAME") -- cfg_args["project"] = os_release.get("NAME") -- cfg_args["releasever"] = os_release.get("VERSION_ID") -+ cfg_args["title"] = os_release.get("PRETTY_NAME", "") -+ cfg_args["project"] = os_release.get("NAME", "") -+ cfg_args["releasever"] = os_release.get("VERSION_ID", "") - cfg_args["volid"] = "" - - cfg_args.update({ -diff --git a/src/pylorax/api/dnfbase.py b/src/pylorax/api/dnfbase.py -index df4444dc..b7a4d1c6 100644 ---- a/src/pylorax/api/dnfbase.py -+++ b/src/pylorax/api/dnfbase.py -@@ -26,7 +26,7 @@ import os - import shutil - - from pylorax import DEFAULT_PLATFORM_ID --from pylorax.simpleconfig import SimpleConfigFile -+from pylorax.sysutils import flatconfig - - def get_base_object(conf): - """Get the DNF object with settings from the config file -@@ -76,9 +76,8 @@ def get_base_object(conf): - log.warning("/etc/os-release is missing, cannot determine platform id, falling back to %s", DEFAULT_PLATFORM_ID) - platform_id = DEFAULT_PLATFORM_ID - else: -- os_release = SimpleConfigFile("/etc/os-release") -- os_release.read() -- platform_id = os_release.get("PLATFORM_ID") or DEFAULT_PLATFORM_ID -+ os_release = flatconfig("/etc/os-release") -+ platform_id = os_release.get("PLATFORM_ID", DEFAULT_PLATFORM_ID) - log.info("Using %s for module_platform_id", platform_id) - dbc.module_platform_id = platform_id - -diff --git a/src/pylorax/sysutils.py b/src/pylorax/sysutils.py -index c2f46f1e..9735a7ff 100644 ---- a/src/pylorax/sysutils.py -+++ b/src/pylorax/sysutils.py -@@ -30,6 +30,8 @@ import pwd - import grp - import glob - import shutil -+import shlex -+from configparser import ConfigParser - - from pylorax.executils import runcmd - -@@ -106,3 +108,24 @@ def remove(target): - - def linktree(src, dst): - runcmd(["/bin/cp", "-alx", src, dst]) -+ -+def unquote(s): -+ return ' '.join(shlex.split(s)) -+ -+class UnquotingConfigParser(ConfigParser): -+ """A ConfigParser, only with unquoting of the values.""" -+ def get(self, *args, **kwargs): -+ ret = super().get(*args, **kwargs) -+ if ret: -+ ret = unquote(ret) -+ return ret -+ -+def flatconfig(filename): -+ """Use UnquotingConfigParser to read a flat config file (without -+ section headers) by adding a section header. -+ """ -+ with open (filename, 'r') as conffh: -+ conftext = "[main]\n" + conffh.read() -+ config = UnquotingConfigParser() -+ config.read_string(conftext) -+ return config['main'] -diff --git a/src/sbin/lorax b/src/sbin/lorax -index ce21d8f5..30b9cadc 100755 ---- a/src/sbin/lorax -+++ b/src/sbin/lorax -@@ -35,7 +35,7 @@ import librepo - import pylorax - from pylorax import DRACUT_DEFAULT, DEFAULT_PLATFORM_ID - from pylorax.cmdline import lorax_parser --from pylorax.simpleconfig import SimpleConfigFile -+from pylorax.sysutils import flatconfig - import selinux - - def setup_logging(opts): -@@ -225,9 +225,8 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None, - log.warning("/etc/os-release is missing, cannot determine platform id, falling back to %s", DEFAULT_PLATFORM_ID) - platform_id = DEFAULT_PLATFORM_ID - else: -- os_release = SimpleConfigFile("/etc/os-release") -- os_release.read() -- platform_id = os_release.get("PLATFORM_ID") or DEFAULT_PLATFORM_ID -+ os_release = flatconfig("/etc/os-release") -+ platform_id = os_release.get("PLATFORM_ID", DEFAULT_PLATFORM_ID) - log.info("Using %s for module_platform_id", platform_id) - conf.module_platform_id = platform_id - --- -2.17.1 - diff --git a/lorax.spec b/lorax.spec index 59996ba..2c88830 100644 --- a/lorax.spec +++ b/lorax.spec @@ -3,8 +3,8 @@ %define debug_package %{nil} Name: lorax -Version: 29.13 -Release: 3%{?dist} +Version: 29.14 +Release: 1%{?dist} Summary: Tool for creating the anaconda install images Group: Applications/System @@ -15,8 +15,6 @@ URL: https://github.com/weldr/lorax # git checkout -b archive-branch lorax-%%{version}-%%{release} # tito build --tgz Source0: %{name}-%{version}.tar.gz -# Hopefully make lorax actually work without pyanaconda -Patch0: 0001-Ditch-all-use-of-pyanaconda-s-simpleconfig.patch BuildRequires: python3-devel @@ -158,7 +156,6 @@ build images, etc. from the command line. %prep %setup -q -n %{name}-%{version} -%patch0 -p1 %build @@ -233,11 +230,11 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %{_sysconfdir}/bash_completion.d/composer-cli %changelog -* Thu Aug 30 2018 Adam Williamson - 29.13-3 -- Correct a bug in the patch from -2 - -* Thu Aug 30 2018 Adam Williamson - 29.13-2 -- Backport upstream PR#451 to avoid undeclared pyanaconda dependency +* Thu Sep 06 2018 Brian C. Lane 29.14-1 +- Add the create ISO component for ARMv7 (pbrobinson@gmail.com) +- Don't activate default auto connections after switchroot (rvykydal@redhat.com) +- Ignore a pylint warning about UnquotingConfigParser get args (bcl@redhat.com) +- Ditch all use of pyanaconda's simpleconfig (awilliam@redhat.com) * Wed Aug 29 2018 Brian C. Lane 29.13-1 - Update the example blueprints for rawhide (bcl@redhat.com) diff --git a/sources b/sources index dea3cda..2980978 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lorax-29.13.tar.gz) = 16a7188c0c0630a3e2415fcdf307140c998a9d7a1f60b5ceb88038028773ca598db91ed115b7c843f8369102c0ed517551c2b500778138cd76ad2eb516a0b4de +SHA512 (lorax-29.14.tar.gz) = 8634cbd960960cbae763b4b71c6a64c64bc59f3c4c8239c4b4a554bfe0fd6c5b525537edbbfbe9c7f2f0f75447ec085b1d38eec38e0902b3001c6f527504e055