[elbe-devel] [PATCH 25/32] Nuke ASCIIDocLog from bin/src cdrom
dion at linutronix.de
dion at linutronix.de
Fri Jun 14 22:13:39 CEST 2019
From: Olivier Dion <dion at linutronix.de>
NOTE! In "cdroms.py" I often used 'pkd_id' by formating a package
name with its installed version. This _should_ be done in
'XMLPackage::__str__' or 'PackageBase::__str__'.
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/cdroms.py | 91 ++++++++++++--------------------------------
elbepack/commands/mkcdrom.py | 3 +-
elbepack/elbeproject.py | 2 -
3 files changed, 26 insertions(+), 70 deletions(-)
diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
index 6f6d80a8..aa52c565 100644
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@ -16,20 +16,14 @@ from elbepack.repomanager import CdromBinRepo
from elbepack.repomanager import CdromInitRepo
from elbepack.aptpkgutils import XMLPackage
from elbepack.filesystem import Filesystem, hostfs
-from elbepack.shellhelper import CommandError
+from elbepack.shellhelper import CommandError, do
+from elbepack.log import log
CDROM_SIZE = 640 * 1000 * 1000
-def mk_source_cdrom(
- rfs,
- arch,
- codename,
- init_codename,
- target,
- log,
- cdrom_size=CDROM_SIZE,
- xml=None):
+def mk_source_cdrom(rfs, arch, codename, init_codename, target,
+ cdrom_size=CDROM_SIZE, xml=None):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
@@ -66,22 +60,14 @@ def mk_source_cdrom(
# Do not include forbidden packages in src cdrom
if pkg.name in forbiddenPackages:
continue
+ pkg_id = "%s-%s" % (pkg.name, pkg.installed_version)
try:
dsc = cache.download_source(pkg.name, '/var/cache/elbe/sources')
repo.includedsc(dsc, force=True)
except ValueError:
- log.printo(
- "No sources for Package " +
- pkg.name +
- "-" +
- pkg.installed_version)
+ log.error("No sources for package '%s'" % pkg_id)
except FetchError:
- log.printo(
- "Source for Package " +
- pkg.name +
- "-" +
- pkg.installed_version +
- " could not be downloaded")
+ log.error("Source for package '%s' could not be downloaded" % pkg_id)
# elbe fetch_initvm_pkgs has downloaded all sources to
# /var/cache/elbe/sources
@@ -103,15 +89,8 @@ def mk_source_cdrom(
return repo.buildiso(os.path.join(target, "src-cdrom.iso"))
-def mk_binary_cdrom(
- rfs,
- arch,
- codename,
- init_codename,
- xml,
- target,
- log,
- cdrom_size=CDROM_SIZE):
+def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target,
+ cdrom_size=CDROM_SIZE):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
@@ -132,16 +111,17 @@ def mk_binary_cdrom(
# just copy it. the repo __init__() afterwards will
# not touch the repo config, nor generate a new key.
try:
- log.do('cp -av /var/cache/elbe/initvm-bin-repo "%s"' % repo_path)
+ do('cp -av /var/cache/elbe/initvm-bin-repo "%s"' % repo_path)
except CommandError:
# When /var/cache/elbe/initvm-bin-repo has not been created
# (because the initvm install was an old version or somthing,
# log an error, and continue with an empty directory.
- log.printo('ERROR: /var/cache/elbe/initvm-bin-repo does not exist')
- log.printo(' The generated CDROM will not contain initvm pkgs')
- log.printo(' This happened because the initvm was probably')
- log.printo(' generated with --skip-build-bin')
- log.do('mkdir -p "%s"' % repo_path)
+ log.error("The generated CDROM will not contain initvm pkgs\n"
+ "This happened because the initvm was probably\n"
+ "generated with --skip-build-bin",
+ header="/var/cache/elbe/initvm-bin-repo does not exist")
+
+ do('mkdir -p "%s"' % repo_path)
repo = CdromInitRepo(init_codename, repo_path, cdrom_size, mirror)
@@ -152,57 +132,36 @@ def mk_binary_cdrom(
cache = get_rpcaptcache(rfs, arch)
for p in xml.node("debootstrappkgs"):
pkg = XMLPackage(p, arch)
+ pkg_id = "%s-%s" % (pkg.name, pkg.installed_version)
try:
deb = cache.download_binary(pkg.name,
'/var/cache/elbe/binaries/main',
pkg.installed_version)
target_repo.includedeb(deb, 'main')
except ValueError:
- log.printo(
- "No Package " +
- pkg.name +
- "-" +
- pkg.installed_version)
+ log.error("No package '%s'" % pkg_id)
except FetchError:
- log.printo(
- "Package " +
- pkg.name +
- "-" +
- pkg.installed_version +
- " could not be downloaded")
+ log.error("Package '%s' could not be downloaded" % pkg_id)
except TypeError:
- log.printo(
- "Package " +
- pkg.name +
- "-" +
- pkg.installed_version +
- " missing name or version")
+ log.error("Package '%s' missing name or version" % pkg_id)
cache = get_rpcaptcache(rfs, arch)
pkglist = cache.get_installed_pkgs()
for pkg in pkglist:
+ pkg_id = "%s-%s" % (pkg.name, pkg.installed_version)
try:
deb = cache.download_binary(pkg.name,
'/var/cache/elbe/binaries/added',
pkg.installed_version)
target_repo.includedeb(deb, 'added', pkg.name, True)
except KeyError as ke:
- log.printo(str(ke))
+ log.error(str(ke))
except ValueError:
- log.printo("No Package " + pkg.name + "-" + pkg.installed_version)
+ log.error("No package %s" % pkg_id)
except FetchError:
- log.printo("Package " +
- pkg.name +
- "-" +
- str(pkg.installed_version) +
- " could not be downloaded")
+ log.error("Package %s could not be downloaded" % pkg_id)
except TypeError:
- log.printo(
- "Package " +
- pkg.name +
- "-" +
- pkg.installed_version +
- " missing name or version")
+ log.error("Package %s missing name or version")
target_repo.finalize()
diff --git a/elbepack/commands/mkcdrom.py b/elbepack/commands/mkcdrom.py
index 70a6ac0e..dc6806e2 100644
--- a/elbepack/commands/mkcdrom.py
+++ b/elbepack/commands/mkcdrom.py
@@ -94,7 +94,7 @@ def run_command(argv):
if opt.source:
with rfs:
generated_files += mk_source_cdrom(rfs, arch, codename,
- init_codename, builddir, log,
+ init_codename, builddir,
opt.cdrom_size)
if opt.binary:
@@ -105,7 +105,6 @@ def run_command(argv):
init_codename,
xml,
builddir,
- log,
opt.cdrom_size)
print("")
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index a4b25376..30fe59cd 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -462,7 +462,6 @@ class ElbeProject (object):
init_codename,
self.xml,
self.builddir,
- self.log,
cdrom_size=cdrom_size)
if build_sources:
elog.h1("Source CD %s" % sysrootstr)
@@ -472,7 +471,6 @@ class ElbeProject (object):
self.codename,
init_codename,
self.builddir,
- self.log,
cdrom_size=cdrom_size,
xml=self.xml)
except SystemError as e:
--
2.11.0
More information about the elbe-devel
mailing list