mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-05 23:23:39 +02:00
- fix deprecation warnings on factory (python26)
This commit is contained in:
24
osc/build.py
24
osc/build.py
@@ -15,6 +15,7 @@ from osc.fetch import *
|
||||
from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig
|
||||
import osc.conf
|
||||
import oscerr
|
||||
import subprocess
|
||||
try:
|
||||
from xml.etree import cElementTree as ET
|
||||
except ImportError:
|
||||
@@ -194,13 +195,16 @@ class Pac:
|
||||
|
||||
def get_built_files(pacdir, pactype):
|
||||
if pactype == 'rpm':
|
||||
b_built = os.popen('find %s -name \*.rpm' \
|
||||
% os.path.join(pacdir, 'RPMS')).read().strip()
|
||||
s_built = os.popen('find %s -name \*.rpm' \
|
||||
% os.path.join(pacdir, 'SRPMS')).read().strip()
|
||||
b_built = subprocess.Popen('find %s -name \*.rpm' \
|
||||
% os.path.join(pacdir, 'RPMS'),
|
||||
stdout=subprocess.PIPE, shell=True).stdout.read().strip()
|
||||
s_built = subprocess.Popen('find %s -name \*.rpm' \
|
||||
% os.path.join(pacdir, 'SRPMS'),
|
||||
stdout=subprocess.PIPE, shell=True).stdout.read().strip()
|
||||
else:
|
||||
b_built = os.popen('find %s -name \*.deb' \
|
||||
% os.path.join(pacdir, 'DEBS')).read().strip()
|
||||
b_built = subprocess.Popen('find %s -name \*.deb' \
|
||||
% os.path.join(pacdir, 'DEBS'),
|
||||
stdout=subprocess.PIPE, shell=True).stdout.read().strip()
|
||||
s_built = None
|
||||
return s_built, b_built
|
||||
|
||||
@@ -218,9 +222,9 @@ def get_prefer_pkgs(dirs, wanted_arch):
|
||||
continue
|
||||
if path.find('-debuginfo-') > 0:
|
||||
continue
|
||||
arch, name = os.popen('rpm -qp --nosignature --nodigest --qf "%%{arch} %%{name}\\n" %s' \
|
||||
% path).read().split()
|
||||
# instead of this assumption, we should probably rather take the
|
||||
arch, name = subprocess.Popen('rpm -qp --nosignature --nodigest --qf "%%{arch} %%{name}\\n" %s' \
|
||||
% path, stdout=subprocess.PIPE, shell=True).stdout.read().split()
|
||||
# instead of thip assumption, we should probably rather take the
|
||||
# requested arch for this package from buildinfo
|
||||
# also, it will ignore i686 packages, how to handle those?
|
||||
if arch == wanted_arch or arch == 'noarch':
|
||||
@@ -408,7 +412,7 @@ def main(opts, argv):
|
||||
cmd = change_personality[bi.buildarch] + ' ' + cmd
|
||||
|
||||
print cmd
|
||||
rc = os.system(cmd)
|
||||
rc = subprocess.call(cmd, shell=True)
|
||||
if rc:
|
||||
print
|
||||
print 'The buildroot was:', config['build-root']
|
||||
|
@@ -22,6 +22,7 @@ from cStringIO import StringIO
|
||||
import shutil
|
||||
import oscerr
|
||||
import conf
|
||||
import subprocess
|
||||
try:
|
||||
from xml.etree import cElementTree as ET
|
||||
except ImportError:
|
||||
@@ -814,7 +815,7 @@ class Package:
|
||||
# diff3 OPTIONS... MINE OLDER YOURS
|
||||
merge_cmd = 'diff3 -m -E %s %s %s > %s' % (myfilename, storefilename, upfilename, filename)
|
||||
# we would rather use the subprocess module, but it is not availablebefore 2.4
|
||||
ret = os.system(merge_cmd) / 256
|
||||
ret = subprocess.call(merge_cmd, shell=True) / 256
|
||||
|
||||
# "An exit status of 0 means `diff3' was successful, 1 means some
|
||||
# conflicts were found, and 2 means trouble."
|
||||
@@ -1760,7 +1761,7 @@ def edit_meta(metatype,
|
||||
if edit:
|
||||
editor = os.getenv('EDITOR', default='vim')
|
||||
while 1:
|
||||
os.system('%s %s' % (editor, f.filename))
|
||||
subprocess.call('%s %s' % (editor, f.filename), shell=True)
|
||||
if change_is_required == True:
|
||||
try:
|
||||
f.sync()
|
||||
@@ -1886,7 +1887,7 @@ def edit_message(footer=''):
|
||||
|
||||
editor = os.getenv('EDITOR', default='vim')
|
||||
while 1:
|
||||
os.system('%s %s' % (editor, filename))
|
||||
subprocess.call('%s %s' % (editor, filename), shell=True)
|
||||
hash = dgst(filename)
|
||||
|
||||
if hash != hash_orig:
|
||||
@@ -3174,7 +3175,7 @@ def unpack_srcrpm(srpm, dir, *files):
|
||||
else:
|
||||
os.chdir(dir)
|
||||
cmd = 'rpm2cpio %s | cpio -i %s &> /dev/null' % (srpm, ' '.join(files))
|
||||
ret = os.system(cmd)
|
||||
ret = subprocess.call(cmd, shell=True)
|
||||
if ret != 0:
|
||||
print >>sys.stderr, 'error \'%s\' - cannot extract \'%s\'' % (ret, srpm)
|
||||
sys.exit(1)
|
||||
|
11
osc/fetch.py
11
osc/fetch.py
@@ -134,26 +134,25 @@ def verify_pacs(pac_list):
|
||||
Check all packages in one go, since this takes only 6 seconds on my Athlon 700
|
||||
instead of 20 when calling 'rpm -K' for each of them.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
|
||||
if not pac_list:
|
||||
return
|
||||
|
||||
# we can use os.popen4 because we don't care about the return value.
|
||||
# we check the output anyway, and rpm always writes to stdout.
|
||||
# don't care about the return value because we check the
|
||||
# output anyway, and rpm always writes to stdout.
|
||||
|
||||
# save locale first (we rely on English rpm output here)
|
||||
saved_LC_ALL = os.environ.get('LC_ALL')
|
||||
os.environ['LC_ALL'] = 'en_EN'
|
||||
|
||||
(i, o) = os.popen4(['/bin/rpm', '-K'] + pac_list)
|
||||
o = subprocess.Popen(['/bin/rpm', '-K'] + pac_list, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, close_fds=True).stdout
|
||||
|
||||
# restore locale
|
||||
if saved_LC_ALL: os.environ['LC_ALL'] = saved_LC_ALL;
|
||||
else: os.environ.pop('LC_ALL')
|
||||
|
||||
i.close()
|
||||
|
||||
for line in o.readlines():
|
||||
|
||||
if not 'OK' in line:
|
||||
|
Reference in New Issue
Block a user