[elbe-devel] [PATCH 2/4] Generate licenses for most of the RFS
Olivier Dion
dion at linutronix.de
Thu Mar 5 06:23:37 CET 2020
elbe_report now return the list of packages for the target to the
caller. Indeed, we need this list just after to generate the licenses
for the target.
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/dump.py | 4 +++-
elbepack/elbeproject.py | 37 ++++++++++++++++++-------------------
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/elbepack/dump.py b/elbepack/dump.py
index cb59d747..0e7f60fc 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -300,7 +300,7 @@ def elbe_report(xml, buildenv, cache, targetfs):
f.close()
if not xml.has("archive") or xml.text("archive") is None:
- return
+ return list(tgt_pkg_list)
validation.info("")
validation.info("Archive validation")
@@ -323,3 +323,5 @@ def elbe_report(xml, buildenv, cache, targetfs):
if errors == 0:
validation.info("No Errors found")
+
+ return list(tgt_pkg_list)
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 4a445f86..1d82c8bf 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -266,22 +266,25 @@ class ElbeProject (object):
with self.sysrootenv:
try:
- self.get_rpcaptcache(env=self.sysrootenv).update()
+ cache = self.get_rpcaptcache(env=self.sysrootenv)
+ cache.update()
except Exception as e:
raise AptCacheUpdateError(e)
try:
- self.get_rpcaptcache(
- env=self.sysrootenv).mark_install_devpkgs(
- set(ignore_pkgs), set(ignore_dev_pkgs))
+ cache.mark_install_devpkgs(set(ignore_pkgs),
+ set(ignore_dev_pkgs))
except SystemError as e:
logging.exception("Mark install devpkgs failed")
try:
- self.get_rpcaptcache(env=self.sysrootenv).commit()
+ cache.commit()
except SystemError as e:
logging.exception("Commiting changes failed")
raise AptCacheCommitError(str(e))
+ self.gen_licenses("sysroot-target", self.sysrootenv,
+ [p.name for p in cache.get_installed_pkgs()])
+
try:
self.sysrootenv.rfs.dump_elbeversion(self.xml)
except IOError:
@@ -306,6 +309,7 @@ class ElbeProject (object):
do("tar cfJ %s/sysroot.tar.xz -C %s -T %s" %
(self.builddir, self.sysrootpath, sysrootfilelist))
+
def build_host_sysroot(self, pkgs, hostsysrootpath):
do('rm -rf %s; mkdir "%s"' % (hostsysrootpath, hostsysrootpath))
@@ -322,7 +326,6 @@ class ElbeProject (object):
try:
cache = self.get_rpcaptcache(env=self.host_sysrootenv,
norecommend=True)
-
cache.update()
except Exception as e:
raise AptCacheUpdateError(e)
@@ -343,6 +346,9 @@ class ElbeProject (object):
logging.exception("Commiting changes failed")
raise AptCacheCommitError(str(e))
+ self.gen_licenses("sysroot-host", self.host_sysrootenv,
+ [p.name for p in cache.get_installed_pkgs()])
+
# This is just a sysroot, some directories
# need to be removed.
#
@@ -582,21 +588,14 @@ class ElbeProject (object):
logging.exception("Write source.xml failed (archive to huge?)")
# Elbe report
- elbe_report(self.xml, self.buildenv, self.get_rpcaptcache(),
- self.targetfs)
-
- # Collect Licence Files
- lic_txt_fname = os.path.join(self.builddir, "licence.txt")
- lic_xml_fname = os.path.join(self.builddir, "licence.xml")
+ cache = self.get_rpcaptcache()
+ tgt_pkgs = elbe_report(self.xml, self.buildenv, cache, self.targetfs)
- pkglist = self.get_rpcaptcache().get_installed_pkgs()
- pkgnames = [p.name for p in pkglist]
+ # chroot' licenses
+ self.gen_licenses("chroot", self.buildenv,
+ [p.name for p in cache.get_installed_pkgs()])
- with io.open(lic_txt_fname,
- 'w+',
- encoding='utf-8',
- errors='replace') as f:
- self.buildenv.rfs.write_licenses(f, pkgnames, lic_xml_fname)
+ self.gen_licenses("target", self.buildenv, tgt_pkgs)
# Use some handwaving to determine grub version
grub_arch = "ia32" if self.arch == "i386" else self.arch
--
2.25.1
More information about the elbe-devel
mailing list