[elbe-devel] [PATCH] pbuild: remove existing package from repo before include

John Ogness john.ogness at linutronix.de
Mon Jul 25 14:42:35 CEST 2016


The elbe pbuild feature automatically includes the new package to
the elbe local repository. Since a new package with the same
name+suite of an existing package cannot be included in the repo,
commit 78969a6790813c2c57d8c5f96896665a1df27be6 tries to address
this by changing the version of the new package to be a timestamp.
But actually this does not solve the issue since the package name
within the suite has not changed.

With this patch, the automatic version changing is reverted and
any existing packages with the same name+suite are removed from
the local repository before including the new package.

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
 elbepack/elbeproject.py |  8 ++------
 elbepack/repomanager.py | 11 +++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 2f3949e..da6ff28 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -361,12 +361,6 @@ class ElbeProject (object):
                                                   "current_pdebuild.tar.gz"),
                                                 pbdir))
 
-        # generate an increasing debian package version and set correct suite
-        self.log.do ("cd %s; dch -v `date +'%y%m%d%H%M%S'` elbe pbuilder build" % pbdir)
-        self.log.do ("cd %s; dch -D %s" % (pbdir, self.suite))
-        self.log.do ("cd %s; dch -D %s" % (pbdir, self.suite))
-        self.log.do ("cd %s; git commit -sam 'version bump %s by elbe pbuilder'" % (pbdir, self.suite))
-
         self.pdebuild_build ()
         self.repo.finalize ()
 
@@ -382,6 +376,8 @@ class ElbeProject (object):
             self.log.printo ('Package fails to build.')
             self.log.printo ('Please make sure, that the submitted package builds in pbuilder')
 
+        self.repo.remove (os.path.join (self.builddir, "pdebuilder", "current", "debian", "control"))
+
         self.repo.include (os.path.join (self.builddir,
             "pbuilder", "result", "*.changes"))
 
diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index ea8aef2..ad0e32c 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -20,6 +20,7 @@ import os
 from elbepack.debianreleases import codename2suite
 from elbepack.filesystem import Filesystem
 from elbepack.pkgutils import get_dsc_size
+from debian.deb822 import Deb822
 
 class RepoAttributes(object):
     def __init__ (self, codename, arch, components,
@@ -154,6 +155,13 @@ class RepoBase(object):
     def _include( self, path, codename, component):
         self.log.do( 'reprepro --ignore=wrongdistribution --keepunreferencedfiles --export=never --basedir "' + self.fs.path  + '" -C ' + component + ' -P normal -S misc include ' + codename + ' ' + path )
 
+    def _remove( self, path, codename, component):
+        for p in Deb822.iter_paragraphs(file(path)):
+            if 'Source' in p:
+                self.log.do( "reprepro --basedir %s removesrc %s %s" % (self.fs.path, codename, p['Source']))
+            elif 'Package' in p:
+                self.log.do( "reprepro --basedir %s remove %s %s" % (self.fs.path, codename, p['Package']))
+
     def _includedsc( self, path, codename, component):
         if self.maxsize:
             new_size = self.fs.disk_usage("") + get_dsc_size( path )
@@ -171,6 +179,9 @@ class RepoBase(object):
     def include( self, path, component="main"):
         self._include (path, self.repo_attr.codename, component)
 
+    def remove( self, path, component="main"):
+        self._remove (path, self.repo_attr.codename, component)
+
     def include_init_dsc( self, path, component="main"):
         self._includedsc (path, self.init_attr.codename, component)
 
-- 
2.1.4




More information about the elbe-devel mailing list