ostbuild: Drop down to Python 2.6
Hopefully this gets us working on RHEL6.
This commit is contained in:
parent
4aa8ff61de
commit
341096f18a
|
|
@ -24,6 +24,7 @@ import json
|
|||
from . import builtins
|
||||
from . import buildutil
|
||||
from .ostbuildlog import log, fatal
|
||||
from .subprocess_helpers import run_sync, run_sync_get_output
|
||||
|
||||
class OstbuildAutodiscoverMeta(builtins.Builtin):
|
||||
name = "autodiscover-meta"
|
||||
|
|
@ -76,14 +77,13 @@ class OstbuildAutodiscoverMeta(builtins.Builtin):
|
|||
|
||||
def _discover_branch_from_git(self):
|
||||
if os.path.isdir('.git'):
|
||||
try:
|
||||
try:
|
||||
ref = subprocess.check_output(['git', 'symbolic-ref', 'HEAD'], stderr=open('/dev/null', 'w'))
|
||||
return ref.replace('refs/heads/', '').strip()
|
||||
except subprocess.CalledProcessError, e:
|
||||
return subprocess.check_output(['git', 'describe', '--tags', '--exact-match', 'HEAD']).strip()
|
||||
except subprocess.CalledProcessError, e:
|
||||
return None
|
||||
devnull=open('/dev/null', 'w')
|
||||
ref = run_sync_get_output(['git', 'symbolic-ref', 'HEAD'], stderr=devnull, none_on_error=True)
|
||||
if ref is not None:
|
||||
return ref.replace('refs/heads/', '').strip()
|
||||
ref = run_sync_get_output(['git', 'describe', '--tags', '--exact-match', 'HEAD'], stderr=devnull, none_on_error=True)
|
||||
if ref is not None:
|
||||
return ref
|
||||
return None
|
||||
|
||||
builtins.register(OstbuildAutodiscoverMeta)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import json
|
|||
from . import builtins
|
||||
from . import buildutil
|
||||
from .ostbuildlog import log, fatal
|
||||
from .subprocess_helpers import run_sync
|
||||
from .subprocess_helpers import run_sync, run_sync_get_output
|
||||
|
||||
class OstbuildChrootCompileOne(builtins.Builtin):
|
||||
name = "chroot-compile-one"
|
||||
|
|
@ -41,7 +41,7 @@ class OstbuildChrootCompileOne(builtins.Builtin):
|
|||
(args, rest_args) = parser.parse_known_args(argv)
|
||||
|
||||
if args.meta is None:
|
||||
output = subprocess.check_output(['ostbuild', 'autodiscover-meta'])
|
||||
output = run_sync_get_output(['ostbuild', 'autodiscover-meta'])
|
||||
self.metadata = json.loads(output)
|
||||
else:
|
||||
f = open(args.meta)
|
||||
|
|
@ -67,8 +67,8 @@ class OstbuildChrootCompileOne(builtins.Builtin):
|
|||
shutil.rmtree(child_tmpdir)
|
||||
os.mkdir(child_tmpdir)
|
||||
|
||||
rev = subprocess.check_output(['ostree', '--repo=' + args.repo, 'rev-parse', args.buildroot])
|
||||
rev=rev.strip()
|
||||
rev = run_sync_get_output(['ostree', '--repo=' + args.repo, 'rev-parse', args.buildroot])
|
||||
rev = rev.strip()
|
||||
|
||||
self.metadata['buildroot'] = args.buildroot
|
||||
self.metadata['buildroot-version'] = rev
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import select,time
|
|||
|
||||
from . import builtins
|
||||
from .ostbuildlog import log, fatal
|
||||
from .subprocess_helpers import run_sync
|
||||
from .subprocess_helpers import run_sync, run_sync_get_output
|
||||
|
||||
PREFIX = '/usr'
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class OstbuildCompileOne(builtins.Builtin):
|
|||
self.metadata = {}
|
||||
|
||||
if self.ostbuild_meta is None:
|
||||
output = subprocess.check_output(['ostbuild', 'autodiscover-meta'])
|
||||
output = run_sync_get_output(['ostbuild', 'autodiscover-meta'])
|
||||
self.metadata = json.loads(output)
|
||||
else:
|
||||
f = open(self.ostbuild_meta)
|
||||
|
|
|
|||
Loading…
Reference in New Issue