[elbe-devel] [PATCH] Add package tag "on_src_cd" in xml scheme

Philipp Arras philipp.arras at linutronix.de
Mon May 15 15:04:14 CEST 2017


If it is set to false, ELBE does not include the source of the package on
the source CDROM.

Signed-off-by: Philipp Arras <philipp.arras at linutronix.de>
---
 elbepack/cdroms.py      | 19 ++++++++++++++++++-
 elbepack/dbsfed.xsd     |  7 +++++++
 elbepack/elbeproject.py |  3 ++-
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
index b1538d3..51c5cdf 100644
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@ -31,7 +31,7 @@ from apt import Cache
 
 CDROM_SIZE = 640*1000*1000
 
-def mk_source_cdrom(rfs, arch, codename, init_codename, target, log, cdrom_size=CDROM_SIZE):
+def mk_source_cdrom(rfs, arch, codename, init_codename, target, log, cdrom_size=CDROM_SIZE, xml=None):
 
     hostfs.mkdir_p( '/var/cache/elbe/sources' )
     rfs.mkdir_p( '/var/cache/elbe/sources' )
@@ -45,7 +45,21 @@ def mk_source_cdrom(rfs, arch, codename, init_codename, target, log, cdrom_size=
 
     pkglist = cache.get_installed_pkgs()
 
+    forbiddenPackages = []
+    if xml != None and xml.has('target/pkg-list'):
+        for i in xml.node('target/pkg-list'):
+            try:
+                if i.tag == 'pkg' and i.et.attrib['on_src_cd'] == 'False':
+                   forbiddenPackages.append(i.text('.').strip())
+
+            except KeyError:
+                pass
+
+
     for pkg in pkglist:
+        # Do not include forbidden packages in src cdrom
+        if pkg.name in forbiddenPackages:
+            continue
         try:
             dsc = cache.download_source( pkg.name, '/var/cache/elbe/sources' )
             repo.includedsc( dsc, force=True )
@@ -61,6 +75,9 @@ def mk_source_cdrom(rfs, arch, codename, init_codename, target, log, cdrom_size=
     cache.open ()
 
     for pkg in pkglist:
+        # Do not include forbidden packages in src cdrom
+        if pkg.name in forbiddenPackages:
+            continue
         try:
             p = cache[pkg.name]
             if pkg.name == 'elbe-bootstrap':
diff --git a/elbepack/dbsfed.xsd b/elbepack/dbsfed.xsd
index aae68ac..74eb732 100644
--- a/elbepack/dbsfed.xsd
+++ b/elbepack/dbsfed.xsd
@@ -1891,6 +1891,13 @@
             </documentation>
           </annotation>
         </attribute>
+        <attribute name="on_src_cd" type="string" use="optional">
+          <annotation>
+            <documentation>
+                If set to "False" the source will not be included on the source cdrom.
+            </documentation>
+          </annotation>
+        </attribute>
       </extension>
     </simpleContent>
   </complexType>
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 7197b5f..6d22eee 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -339,7 +339,8 @@ class ElbeProject (object):
                                                         init_codename,
                                                         self.builddir,
                                                         self.log,
-                                                        cdrom_size=cdrom_size )
+                                                        cdrom_size=cdrom_size,
+                                                        xml=self.xml)
                 except SystemError as e:
                     # e.g. no deb-src urls specified
                     self.log.printo( str (e) )
-- 
2.1.4





More information about the elbe-devel mailing list