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