[elbe-devel] pylint merge
Torben Hohn
torben.hohn at linutronix.de
Mon Jun 15 14:35:45 CEST 2020
Hi...
i have tried to merge the pylint branch.
Here is output from git show
As you already stated, there are some errors.
--------------------------------------------------------------------------------------------
commit b93015c28fbcf945322651ddf8f3113a3a85f0b3
Merge: e0d0d05b1 2d3c88a5b
Author: Torben Hohn <torben.hohn at linutronix.de>
Date: Mon Jun 15 14:26:50 2020 +0200
Merge branch 'master' into devel/dion/pylint
Due to the size of this Queue, its not rebased.
A merge commit can be reviewed easier.
# By Olivier Dion
* master:
commands mkcdrom: Generate source list for building source cdrom
elbeproject: Generate source list for building source cdrom
cdroms: Change call to download_source
rpcaptcache: Make download_source better
rpcaptcache: Add get_corresponding_source_packages
commands init: Ignore files for elbe-devel.tar.bz2
initvmaction: Add sync action
initvmaction: Cleanup actions registration
filesystem: Add doctests
tests doctests: Add filesystem doctests
shellhelper: Fix get_command_out()
shellhelper: Add doctests
tests test_doctest: Add unittest for doctests
tests test_efilesystem: Add copyright
log: Fix async_logging()
[torbenh: fix conflicts in
elbepack/cdroms.py
elbepack/elbeproject.py
elbepack/log.py
elbepack/rpcaptcache.py
elbepack/shellhelper.py]
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
diff --cc elbepack/cdroms.py
index a13a0fba6,a09e05259..d3ce0975b
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@@ -31,10 -30,8 +31,10 @@@ def add_source_pkg(repo, component, cac
return
pkg_id = "%s-%s" % (pkg, version)
try:
- dsc = cache.download_source(pkg, version, '/var/cache/elbe/sources')
+ dsc = cache.download_source(pkg,
+ '/var/cache/elbe/sources',
+ version=version)
- repo.includedsc(dsc, components=component, force=True)
+ repo.includedsc(dsc, component=component, force=True)
except ValueError:
logging.error("No sources for package '%s'", pkg_id)
except FetchError:
diff --cc elbepack/log.py
index 6556733cd,54da8bd7e..2ef144c7a
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@@ -262,22 -268,9 +271,8 @@@ class AsyncLogging(object)
self.lines[-1] += rest
self.block.info("\n".join(self.lines))
- def read(self, rest):
- buff = rest + os.read(self.fd, self.atmost)
- j = 0
- count = 0
- # pylint: disable=consider-using-enumerate
- for i in range(len(buff)):
- if buff[i] == '\n':
- self.lines.append(buff[j:i])
- count += 1
- j = i + 1
- if count:
- self.stream.info("\n".join(self.lines[-count:]))
- return buff[j:]
-
-
- def async_logging(r, w, stream, block, atmost=80):
+
-
+ def async_logging(r, w, stream, block, atmost=4096):
t = threading.Thread(target=AsyncLogging(atmost, stream, block),
args=(r, w))
t.daemon = True
diff --cc elbepack/rpcaptcache.py
index bfe8acfb3,847b41cda..902ea54fe
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@@ -291,8 -289,38 +292,39 @@@ class RPCAPTCache(InChRootObject)
APTPackage(
self.cache[p]) for p in sorted(
self.cache.keys()) if pkgname in p.lower()]
+
+ def get_corresponding_source_packages(self, pkg_lst=None):
+
+ if pkg_lst is None:
+ pkg_lst = {p.name for p in self.cache if p.is_installed}
+
+ src_set = set()
+
+ with TagFile('/var/lib/dpkg/status') as tagfile:
+ for section in tagfile:
+
+ pkg = section['Package']
+
+ if pkg not in pkg_lst:
+ continue
+
+ tmp = self.cache[pkg].installed or self.cache[pkg].candidate
+
+ src_set.add((tmp.source_name, tmp.source_version))
+
+ if "Built-Using" not in section:
+ continue
+
+ built_using_lst = section["Built-Using"].split(', ')
+ for built_using in built_using_lst:
+ name, version = built_using.split(' ', 1)
+ version = version.strip('(= )')
+ src_set.add((name, version))
+
+ return list(src_set)
+
+ @staticmethod
- def compare_versions(ver1, ver2):
+ def compare_versions(self, ver1, ver2):
return version_compare(ver1, ver2)
def download_binary(self, pkgname, path, version=None):
diff --cc elbepack/shellhelper.py
index 9ef237cef,bc5f608b5..21f234db7
--- a/elbepack/shellhelper.py
+++ b/elbepack/shellhelper.py
@@@ -131,12 -264,34 +266,36 @@@ def chroot(directory, cmd, env_add=None
chcmd = 'chroot %s %s' % (directory, cmd)
do(chcmd, env_add=new_env, **kwargs)
-def get_command_out(cmd, stdin=None, allow_fail=False, env_add={}):
+def get_command_out(cmd, stdin=None, allow_fail=False, env_add=None):
+ """get_command_out() - Like do() but returns stdout.
+
+ --
+
+ Let's quiet the loggers
+
+ >>> import os
+ >>> from elbepack.log import open_logging
+ >>> open_logging({"files":os.devnull})
+
+ >>> get_command_out("echo ELBE")
+ b'ELBE\\n'
+
+ >>> get_command_out("false") # doctest: +ELLIPSIS
+ Traceback (most recent call last):
+ ...
+ elbepack.shellhelper.CommandError: ...
+
+ >>> get_command_out("false", allow_fail=True)
+ b''
+
+ >>> get_command_out("cat -", stdin=b"ELBE", env_add={"TRUE":"true"})
+ b'ELBE'
+ """
new_env = os.environ.copy()
- new_env.update(env_add)
+
+ if env_add:
+ new_env.update(env_add)
logging.info(cmd, extra={"context":"[CMD] "})
--------------------------------------------------------------------------------------------
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list