mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-12 09:21:29 +00:00
Merge branch 'ubuntutools-misc' of git+ssh://git.launchpad.net/ubuntu-dev-tools
MR: https://code.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/372627 Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
commit
c8602ba8a2
12
debian/changelog
vendored
12
debian/changelog
vendored
@ -1,9 +1,13 @@
|
|||||||
ubuntu-dev-tools (0.174) UNRELEASED; urgency=medium
|
ubuntu-dev-tools (0.174) UNRLEASED; urgency=medium
|
||||||
|
|
||||||
* reverse-depends: Support Reverse-Testsuite-Triggers and
|
[ Stefano Rivera ]
|
||||||
Reverse-Build-Depends-Arch (LP: #1843614)
|
* reverse-depends:
|
||||||
|
+ Support reverse test dependencies as well. LP: #1843614
|
||||||
|
* ubuntutools.misc:
|
||||||
|
+ Replace Popen() calls with check_output(). Closes: #940040
|
||||||
|
+ Use a context manager to open file, to be sure to close them.
|
||||||
|
|
||||||
-- Stefano Rivera <stefanor@debian.org> Wed, 11 Sep 2019 16:00:27 -0300
|
-- Mattia Rizzolo <mattia@debian.org> Thu, 12 Sep 2019 14:34:16 +0200
|
||||||
|
|
||||||
ubuntu-dev-tools (0.173) unstable; urgency=medium
|
ubuntu-dev-tools (0.173) unstable; urgency=medium
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
from subprocess import Popen, PIPE
|
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from subprocess import check_output, CalledProcessError
|
||||||
|
|
||||||
import distro_info
|
import distro_info
|
||||||
|
|
||||||
@ -47,29 +47,22 @@ def system_distribution_chain():
|
|||||||
global _system_distribution_chain
|
global _system_distribution_chain
|
||||||
if len(_system_distribution_chain) == 0:
|
if len(_system_distribution_chain) == 0:
|
||||||
try:
|
try:
|
||||||
p = Popen(('dpkg-vendor', '--query', 'Vendor'),
|
vendor = check_output(('dpkg-vendor', '--query', 'Vendor'),
|
||||||
stdout=PIPE, encoding='utf-8')
|
encoding='utf-8').strip()
|
||||||
_system_distribution_chain.append(p.communicate()[0].strip())
|
_system_distribution_chain.append(vendor)
|
||||||
except OSError:
|
except CalledProcessError:
|
||||||
print('Error: Could not determine what distribution you are running.')
|
print('Error: Could not determine what distribution you are running.')
|
||||||
return []
|
return []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
p = Popen(('dpkg-vendor',
|
parent = check_output((
|
||||||
'--vendor', _system_distribution_chain[-1],
|
'dpkg-vendor', '--vendor', _system_distribution_chain[-1],
|
||||||
'--query', 'Parent'),
|
'--query', 'Parent'), encoding='utf-8').strip()
|
||||||
stdout=PIPE, encoding='utf-8')
|
except CalledProcessError:
|
||||||
parent = p.communicate()[0].strip()
|
# Vendor has no parent
|
||||||
# Don't check return code, because if a vendor has no
|
|
||||||
# parent, dpkg-vendor returns 1
|
|
||||||
if not parent:
|
|
||||||
break
|
break
|
||||||
_system_distribution_chain.append(parent)
|
_system_distribution_chain.append(parent)
|
||||||
except Exception:
|
|
||||||
print(('Error: Could not determine the parent of the '
|
|
||||||
'distribution %s' % _system_distribution_chain[-1]))
|
|
||||||
return []
|
|
||||||
|
|
||||||
return _system_distribution_chain
|
return _system_distribution_chain
|
||||||
|
|
||||||
@ -91,14 +84,18 @@ def host_architecture():
|
|||||||
architecture can't be determined, print an error message and return None.
|
architecture can't be determined, print an error message and return None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
arch = Popen(['dpkg', '--print-architecture'], stdout=PIPE,
|
try:
|
||||||
stderr=PIPE).communicate()[0].split()
|
arch = check_output(('dpkg', '--print-architecture'),
|
||||||
|
encoding='utf-8').strip()
|
||||||
|
except CalledProcessError:
|
||||||
|
arch = None
|
||||||
|
|
||||||
if not arch or 'not found' in arch[0]:
|
if not arch or 'not found' in arch:
|
||||||
print('Error: Not running on a Debian based system; could not detect its architecture.')
|
print('Error: Not running on a Debian based system; '
|
||||||
|
'could not detect its architecture.')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return arch[0]
|
return arch
|
||||||
|
|
||||||
|
|
||||||
def readlist(filename, uniq=True):
|
def readlist(filename, uniq=True):
|
||||||
@ -112,7 +109,8 @@ def readlist(filename, uniq=True):
|
|||||||
print('File "%s" does not exist.' % filename)
|
print('File "%s" does not exist.' % filename)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
content = open(filename).read().replace('\n', ' ').replace(',', ' ')
|
with open(filename) as f:
|
||||||
|
content = f.read().replace('\n', ' ').replace(',', ' ')
|
||||||
|
|
||||||
if not content.strip():
|
if not content.strip():
|
||||||
print('File "%s" is empty.' % filename)
|
print('File "%s" is empty.' % filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user