parent
60b9d4fb25
commit
69b059f8a5
@ -1,8 +1,8 @@
|
||||
From 7adfe384c4eea406ec9c4d2445ebac1a3e986d05 Mon Sep 17 00:00:00 2001
|
||||
From 49598dab042e2f9f0d5697786f3c6bf687709277 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
|
||||
<marmarek@invisiblethingslab.com>
|
||||
Date: Thu, 21 Apr 2016 02:15:54 +0200
|
||||
Subject: [PATCH] Allow specify gpg key for a repository
|
||||
Subject: [PATCH 1/3] Allow specify gpg key for a repository
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -14,21 +14,24 @@ additional per-repository settings.
|
||||
|
||||
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
---
|
||||
src/sbin/lorax | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
src/pylorax/cmdline.py | 4 ++--
|
||||
src/sbin/lorax | 10 ++++++++++
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/sbin/lorax b/src/sbin/lorax
|
||||
index f92aeb9..831fc6b 100755
|
||||
--- a/src/sbin/lorax
|
||||
+++ b/src/sbin/lorax
|
||||
@@ -60,13 +60,13 @@ def main(args):
|
||||
required.add_argument("-p", "--product", help="product name", required=True, metavar="STRING")
|
||||
required.add_argument("-v", "--version", help="version identifier", required=True, metavar="STRING")
|
||||
required.add_argument("-r", "--release", help="release information", required=True, metavar="STRING")
|
||||
diff --git a/src/pylorax/cmdline.py b/src/pylorax/cmdline.py
|
||||
index 69b6ccb..855d9f3 100644
|
||||
--- a/src/pylorax/cmdline.py
|
||||
+++ b/src/pylorax/cmdline.py
|
||||
@@ -41,7 +41,7 @@ def lorax_parser():
|
||||
required.add_argument("-p", "--product", help="product name", required=True, metavar="PRODUCT")
|
||||
required.add_argument("-v", "--version", help="version identifier", required=True, metavar="VERSION")
|
||||
required.add_argument("-r", "--release", help="release information", required=True, metavar="RELEASE")
|
||||
- required.add_argument("-s", "--source", help="source repository (may be listed multiple times)",
|
||||
+ required.add_argument("-s", "--source", help="source repository (may be listed multiple times), append gpgkey URL in brackets to enable package verification",
|
||||
metavar="REPOSITORY", action="append", default=[], required=True)
|
||||
|
||||
metavar="REPOSITORY", action="append", default=[])
|
||||
required.add_argument("--repo", help="source dnf repository file", type=os.path.abspath,
|
||||
dest="repos", metavar="REPOSITORY", action="append", default=[])
|
||||
@@ -49,7 +49,7 @@ def lorax_parser():
|
||||
# optional arguments
|
||||
optional = parser.add_argument_group("optional arguments")
|
||||
optional.add_argument("-m", "--mirrorlist",
|
||||
@ -36,8 +39,12 @@ index f92aeb9..831fc6b 100755
|
||||
+ help="mirrorlist repository (may be listed multiple times), append gpgkey URL in brackets to enable package verification",
|
||||
metavar="REPOSITORY", action="append", default=[])
|
||||
optional.add_argument("-t", "--variant",
|
||||
help="variant name", metavar="STRING")
|
||||
@@ -274,6 +274,11 @@ def get_dnf_base_object(installroot, repositories, mirrorlists=None,
|
||||
help="variant name", metavar="VARIANT")
|
||||
diff --git a/src/sbin/lorax b/src/sbin/lorax
|
||||
index df4994d..12061b4 100755
|
||||
--- a/src/sbin/lorax
|
||||
+++ b/src/sbin/lorax
|
||||
@@ -212,6 +212,11 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None,
|
||||
continue
|
||||
repo_name = "lorax-repo-%d" % i
|
||||
repo = dnf.repo.Repo(repo_name, cachedir)
|
||||
@ -49,7 +56,7 @@ index f92aeb9..831fc6b 100755
|
||||
repo.baseurl = [r]
|
||||
if proxy:
|
||||
repo.proxy = proxy
|
||||
@@ -294,6 +299,11 @@ def get_dnf_base_object(installroot, repositories, mirrorlists=None,
|
||||
@@ -232,6 +237,11 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None,
|
||||
continue
|
||||
repo_name = "lorax-mirrorlist-%d" % i
|
||||
repo = dnf.repo.Repo(repo_name, cachedir)
|
||||
@ -62,5 +69,5 @@ index f92aeb9..831fc6b 100755
|
||||
if proxy:
|
||||
repo.proxy = proxy
|
||||
--
|
||||
2.1.0
|
||||
2.7.4
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
From 78f834f8d5b5f1ff56e04bb2b40cbb4fc4c21a12 Mon Sep 17 00:00:00 2001
|
||||
From 5a1ce004b60d449f82d5f4a950ef3255024e1c1c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
|
||||
<marmarek@invisiblethingslab.com>
|
||||
Date: Thu, 21 Apr 2016 13:46:33 +0200
|
||||
Subject: [PATCH] verify packages signature
|
||||
Subject: [PATCH 2/3] verify packages signature
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -15,10 +15,10 @@ Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py
|
||||
index 7fc4d54..661790d 100644
|
||||
index 429c1c1..28b7ff9 100644
|
||||
--- a/src/pylorax/ltmpl.py
|
||||
+++ b/src/pylorax/ltmpl.py
|
||||
@@ -578,6 +578,24 @@ class LoraxTemplateRunner(object):
|
||||
@@ -624,6 +624,24 @@ class LoraxTemplateRunner(object):
|
||||
logger.error("Failed to download the following packages: %s", e)
|
||||
raise
|
||||
|
||||
@ -44,5 +44,5 @@ index 7fc4d54..661790d 100644
|
||||
try:
|
||||
display = LoraxRpmCallback()
|
||||
--
|
||||
2.1.0
|
||||
2.7.4
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
From 93d1aceb41bc2f57cbf3269d165c29438ced0fe7 Mon Sep 17 00:00:00 2001
|
||||
From 74415994cef3c5ea0331ac2bd3355c2c2dc62664 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
|
||||
<marmarek@invisiblethingslab.com>
|
||||
Date: Wed, 25 May 2016 11:24:14 +0200
|
||||
Subject: [PATCH] Update package verification for dnf API
|
||||
Subject: [PATCH 3/3] Update package verification for dnf API
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -15,10 +15,10 @@ Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py
|
||||
index 661790d..8454566 100644
|
||||
index 28b7ff9..eed01ae 100644
|
||||
--- a/src/pylorax/ltmpl.py
|
||||
+++ b/src/pylorax/ltmpl.py
|
||||
@@ -581,14 +581,14 @@ class LoraxTemplateRunner(object):
|
||||
@@ -627,14 +627,14 @@ class LoraxTemplateRunner(object):
|
||||
try:
|
||||
for po in pkgs_to_download:
|
||||
# before doing anything with the package, verify its signature
|
||||
@ -36,5 +36,5 @@ index 661790d..8454566 100644
|
||||
# Fatal error
|
||||
raise dnf.exceptions.Error(errmsg)
|
||||
--
|
||||
2.5.5
|
||||
2.7.4
|
||||
|
||||
|
@ -1,159 +0,0 @@
|
||||
From b3bf61bfddf80bfa7f9b152eb17d9b7b5393ecc5 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 9 Sep 2015 15:58:57 -0700
|
||||
Subject: [PATCH] Drop multiprocessing for do_transaction (#1208296)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Organization: Invisible Things Lab
|
||||
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
|
||||
When running the transaction in a separate process it crashes if you use
|
||||
a https repo source. There's really no need for threads or processes in
|
||||
lorax so drop it.
|
||||
|
||||
Also switched to using the DNF TransactionProgress API for progress
|
||||
reporting.
|
||||
|
||||
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
---
|
||||
src/pylorax/dnfhelper.py | 26 +++++++++++------------
|
||||
src/pylorax/ltmpl.py | 55 ++++++------------------------------------------
|
||||
2 files changed, 19 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/src/pylorax/dnfhelper.py b/src/pylorax/dnfhelper.py
|
||||
index 8e35776..a25d3f6 100644
|
||||
--- a/src/pylorax/dnfhelper.py
|
||||
+++ b/src/pylorax/dnfhelper.py
|
||||
@@ -85,23 +85,23 @@ class LoraxDownloadCallback(dnf.callback.DownloadProgress):
|
||||
self.total_size = total_size
|
||||
|
||||
|
||||
-class LoraxRpmCallback(dnf.callback.LoggingTransactionDisplay):
|
||||
- def __init__(self, queue):
|
||||
+class LoraxRpmCallback(dnf.callback.TransactionProgress):
|
||||
+ def __init__(self):
|
||||
super(LoraxRpmCallback, self).__init__()
|
||||
- self._queue = queue
|
||||
self._last_ts = None
|
||||
- self.cnt = 0
|
||||
|
||||
- def event(self, package, action, te_current, te_total, ts_current, ts_total):
|
||||
- if action == self.PKG_INSTALL and te_current == 0:
|
||||
+ def progress(self, package, action, ti_done, ti_total, ts_done, ts_total):
|
||||
+ if action == self.PKG_INSTALL:
|
||||
# do not report same package twice
|
||||
- if self._last_ts == ts_current:
|
||||
+ if self._last_ts == ts_done:
|
||||
return
|
||||
- self._last_ts = ts_current
|
||||
+ self._last_ts = ts_done
|
||||
|
||||
- msg = '(%d/%d) %s.%s' % \
|
||||
- (ts_current, ts_total, package.name, package.arch)
|
||||
- self.cnt += 1
|
||||
- self._queue.put(('install', msg))
|
||||
+ msg = '(%d/%d) %s.%s' % (ts_done, ts_total, package.name, package.arch)
|
||||
+ logger.info(msg)
|
||||
elif action == self.TRANS_POST:
|
||||
- self._queue.put(('post', None))
|
||||
+ msg = "Performing post-installation setup tasks"
|
||||
+ logger.info(msg)
|
||||
+
|
||||
+ def error(self, err_msg):
|
||||
+ logger.warning(err_msg)
|
||||
diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py
|
||||
index 93ecd14..053dec4 100644
|
||||
--- a/src/pylorax/ltmpl.py
|
||||
+++ b/src/pylorax/ltmpl.py
|
||||
@@ -32,15 +32,12 @@ from pylorax.dnfhelper import LoraxDownloadCallback, LoraxRpmCallback
|
||||
from pylorax.base import DataHolder
|
||||
from pylorax.executils import runcmd, runcmd_output
|
||||
from pylorax.imgutils import mkcpio
|
||||
-import pylorax.output as output
|
||||
|
||||
from mako.lookup import TemplateLookup
|
||||
from mako.exceptions import text_error_template
|
||||
import sys, traceback
|
||||
import struct
|
||||
import dnf
|
||||
-import multiprocessing
|
||||
-import queue
|
||||
import collections
|
||||
|
||||
class LoraxTemplate(object):
|
||||
@@ -501,40 +498,12 @@ class LoraxTemplateRunner(object):
|
||||
else:
|
||||
logger.debug("removepkg %s: no files to remove!", p)
|
||||
|
||||
- def get_token_checked(self, process, token_queue):
|
||||
- """Try to get token from queue checking that process is still alive"""
|
||||
-
|
||||
- try:
|
||||
- # wait at most a minute for the token
|
||||
- (token, msg) = token_queue.get(timeout=60)
|
||||
- except queue.Empty:
|
||||
- if process.is_alive():
|
||||
- try:
|
||||
- # process still alive, give it 2 minutes more
|
||||
- (token, msg) = token_queue.get(timeout=120)
|
||||
- except queue.Empty:
|
||||
- # waited for 3 minutes and got nothing
|
||||
- raise Exception("The transaction process got stuck somewhere (no message from it in 3 minutes)")
|
||||
- else:
|
||||
- raise Exception("The transaction process has ended abruptly")
|
||||
-
|
||||
- return (token, msg)
|
||||
-
|
||||
def run_pkg_transaction(self):
|
||||
'''
|
||||
run_pkg_transaction
|
||||
Actually install all the packages requested by previous 'installpkg'
|
||||
commands.
|
||||
'''
|
||||
-
|
||||
- def do_transaction(base, token_queue):
|
||||
- try:
|
||||
- display = LoraxRpmCallback(token_queue)
|
||||
- base.do_transaction(display=display)
|
||||
- except BaseException as e:
|
||||
- logger.error("The transaction process has ended abruptly: %s", e)
|
||||
- token_queue.put(('quit', str(e)))
|
||||
-
|
||||
try:
|
||||
logger.info("Checking dependencies")
|
||||
self.dbo.resolve()
|
||||
@@ -555,24 +524,12 @@ class LoraxTemplateRunner(object):
|
||||
raise
|
||||
|
||||
logger.info("Preparing transaction from installation source")
|
||||
- token_queue = multiprocessing.Queue()
|
||||
- msgout = output.LoraxOutput()
|
||||
- process = multiprocessing.Process(target=do_transaction, args=(self.dbo, token_queue))
|
||||
- process.start()
|
||||
- (token, msg) = self.get_token_checked(process, token_queue)
|
||||
-
|
||||
- while token not in ('post', 'quit'):
|
||||
- if token == 'install':
|
||||
- logging.info("%s", msg)
|
||||
- msgout.writeline(msg)
|
||||
- (token, msg) = self.get_token_checked(process, token_queue)
|
||||
-
|
||||
- if token == 'quit':
|
||||
- logger.error("Transaction failed.")
|
||||
- raise Exception("Transaction failed")
|
||||
-
|
||||
- logger.info("Performing post-installation setup tasks")
|
||||
- process.join()
|
||||
+ try:
|
||||
+ display = LoraxRpmCallback()
|
||||
+ self.dbo.do_transaction(display=display)
|
||||
+ except BaseException as e:
|
||||
+ logger.error("The transaction process has ended abruptly: %s", e)
|
||||
+ raise
|
||||
|
||||
# Reset the package sack to pick up the installed packages
|
||||
self.dbo.reset(repos=False)
|
||||
--
|
||||
2.1.0
|
||||
|
@ -20,7 +20,6 @@ URL: https://github.com/rhinstaller/lorax
|
||||
# git checkout -b archive-branch lorax-%%{version}-%%{release}
|
||||
# tito build --tgz
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Patch0: Drop-multiprocessing-for-do_transaction-1208296.patch
|
||||
Patch1: 0001-Allow-specify-gpg-key-for-a-repository.patch
|
||||
Patch2: 0002-verify-packages-signature.patch
|
||||
Patch3: 0003-Update-package-verification-for-dnf-API.patch
|
||||
@ -127,7 +126,6 @@ Lorax templates for creating the boot.iso and live isos are placed in
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user