diff --git a/container-github-pr434.patch b/container-github-pr434.patch new file mode 100644 index 0000000..a32fb2b --- /dev/null +++ b/container-github-pr434.patch @@ -0,0 +1,54 @@ +From 12156b34856828e63f0278b38c807842d489aa78 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Tue, 25 Feb 2020 14:26:01 +0100 +Subject: [PATCH] plugin docker: Fix arch string used for container metadata to + be compliant with the standard Fixes: RHBZ#1793927 + +--- + imagefactory_plugins/Docker/Docker.py | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/imagefactory_plugins/Docker/Docker.py b/imagefactory_plugins/Docker/Docker.py +@@ -46,6 +46,15 @@ + "gzip": "gzip -c %s > %s", + "bzip2": "bzip2 -c %s > %s" } + ++ # In image metadata, Go arch is used to identify the architecture ++ # https://docs.docker.com/registry/spec/manifest-v2-2/ ++ goarchs = { "x86_64": "amd64", ++ "aarch64": "arm64", ++ "armv7hl": "armhfp", ++ "riscv64": "riscv64", ++ "ppc64le": "ppc64le", ++ "s390x": "s390x"} ++ + # The templates below allow us to generate base images without a running docker locally + + # imcleod@redhat.com - 26-Aug-2014 +@@ -391,7 +400,7 @@ + if set_arch_label: + if label == 'null': + label = dict() +- label["architecture"] = tldobj.arch ++ label["architecture"] = goarchs[tdlobj.arch] + + rdict = { repository: { tag: docker_image_id } } + +@@ -400,16 +409,11 @@ + raise Exception("No docker JSON template available for specified docker version (%s)" % (dockerversion)) + docker_json_template=self.docker_templates_dict[dockerversion] + +- arch = tdlobj.arch +- if arch == "x86_64": +- arch = "amd64" +- elif arch == "armv7hl": +- arch = "armhfp" + tdict = { } + tdict['commentstring'] = parameters.get('comment', 'Created by Image Factory') + tdict['os'] = parameters.get('os', 'linux') + tdict['createdtime'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') +- tdict['arch'] = arch ++ tdict['arch'] = goarchs[tdlobj.arch] + tdict['idstring'] = docker_image_id + tdict['cmd'] = cmd + tdict['env'] = env diff --git a/imagefactory.spec b/imagefactory.spec index fc78af4..f578f6f 100644 --- a/imagefactory.spec +++ b/imagefactory.spec @@ -1,23 +1,20 @@ -%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 -%global use_systemd 1 -%else -%global use_systemd 0 -# This is, of course, not set in older RPMs and is needed below -%global _unitdir /usr/lib/systemd/system -%endif - -Summary: System image generation tool Name: imagefactory Version: 1.1.14 -Release: 2%{?dist} -Source0: https://github.com/redhat-imaging/imagefactory/archive/imagefactory-%{version}-1.tar.gz +Release: 3%{?dist} +Summary: System image generation tool License: ASL 2.0 -Group: Applications/System URL: https://github.com/redhat-imaging/imagefactory + +Source0: https://github.com/redhat-imaging/imagefactory/archive/imagefactory-%{version}-1.tar.gz +Patch0: container-github-pr434.patch BuildArch: noarch -%if 0%{?rhel} == 6 -ExcludeArch: i386 ppc64 -%endif + +BuildRequires: python3 +BuildRequires: python3-setuptools +BuildRequires: python3-rpm-macros +BuildRequires: python-rpm-macros +BuildRequires: systemd-units + Requires: python3-pycurl Requires: python3-libguestfs Requires: python3-zope-interface @@ -28,23 +25,10 @@ Requires: python3-oauth2 Requires: python3-libs Requires: oz -%if %{use_systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -BuildRequires: systemd-units -%else -Requires(post): chkconfig -Requires(preun): chkconfig -# This is for /sbin/service -Requires(preun): initscripts -%endif - -BuildRequires: python3 -BuildRequires: python3-setuptools -BuildRequires: python3-rpm-macros -BuildRequires: python-rpm-macros # TODO: Any changes to the _internal_ API must increment this version or, in # the case of backwards compatible changes, add a new version (RPM # allows multiple version "=" lines for the same package or @@ -57,7 +41,7 @@ and cloud providers from a single template definition. See https://github.com/redhat-imaging/imagefactory for more information. %prep -%setup -q -n imagefactory-imagefactory-%{version}-1 +%autosetup -p1 -n imagefactory-imagefactory-%{version}-1 %build %py3_build @@ -67,25 +51,17 @@ https://github.com/redhat-imaging/imagefactory for more information. %py3_install -%{__install} -d %{buildroot}/%{_sysconfdir}/imagefactory/jeos_images -%{__install} -d %{buildroot}/%{_localstatedir}/lib/imagefactory/images -%{__install} -d %{buildroot}/%{_sysconfdir}/imagefactory/plugins.d -%{__install} -d %{buildroot}/%{_sysconfdir}/logrotate.d +install -d %{buildroot}/%{_sysconfdir}/imagefactory/jeos_images +install -d %{buildroot}/%{_localstatedir}/lib/imagefactory/images +install -d %{buildroot}/%{_sysconfdir}/imagefactory/plugins.d +install -d %{buildroot}/%{_sysconfdir}/logrotate.d #sed -i '/\/usr\/bin\/env python/d' %{buildroot}/%{python_sitelib}/imgfac/*.py -%{__install} -m0600 conf/sysconfig/imagefactoryd %{buildroot}/%{_sysconfdir}/sysconfig/imagefactoryd -%{__install} -m0600 conf/logrotate.d/imagefactoryd %{buildroot}/%{_sysconfdir}/logrotate.d/imagefactoryd +install -m0600 conf/sysconfig/imagefactoryd %{buildroot}/%{_sysconfdir}/sysconfig/imagefactoryd +install -m0600 conf/logrotate.d/imagefactoryd %{buildroot}/%{_sysconfdir}/logrotate.d/imagefactoryd -# setup.py installs both of these which I suppose is OK -# delete the one we don't want here -%if %{use_systemd} rm -f %{buildroot}/%{_initddir}/imagefactoryd -%else -rm -f %{buildroot}/%{_unitdir}/imagefactoryd.service -%endif - -%if %{use_systemd} %post %systemd_post imagefactoryd.service @@ -96,26 +72,10 @@ rm -f %{buildroot}/%{_unitdir}/imagefactoryd.service %postun %systemd_postun imagefactoryd.service -%else - -%post -/sbin/chkconfig --add imagefactoryd - -%preun -if [ $1 = 0 ] ; then - /sbin/service imagefactoryd stop >/dev/null 2>&1 - /sbin/chkconfig --del imagefactoryd -fi - -%endif %files -%doc COPYING -%if %{use_systemd} +%license COPYING %{_unitdir}/imagefactoryd.service -%else -%{_initddir}/imagefactoryd -%endif %config(noreplace) %{_sysconfdir}/imagefactory/imagefactory.conf %config(noreplace) %{_sysconfdir}/sysconfig/imagefactoryd %config(noreplace) %{_sysconfdir}/logrotate.d/imagefactoryd @@ -132,6 +92,11 @@ fi %{_bindir}/imagefactoryd %changelog +* Wed Mar 04 2020 Peter Robinson - 1.1.14-3 +- Upstream patch for container fixes +- Drop non systemd support as it requires python3 of which older distros won't have +- Spec cleanup + * Wed Jan 29 2020 Fedora Release Engineering - 1.1.14-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild