[PATCH 2/3] Use wb with transaction support
From: Joachim Breitner <mail@joachim-breitner.de>
---
scripts/wb | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/scripts/wb b/scripts/wb
index 8572d18..a30938b 100755
--- a/scripts/wb
+++ b/scripts/wb
@@ -242,7 +242,7 @@ def do_command(args, fatal_errors=True, transactional=False):
cmd = [ 'wanna-build', '-b', '%s/build-db' % arch ]
if transactional:
- cmd.extend([ '--act-on-behalve-of', str(os.getpid()) ])
+ cmd.extend([ '--transactional', '--act-on-behalve-of', str(os.getpid()) ])
if command in ['gb', 'dw', 'fail']:
builder = info.get('Builder', None)
@@ -302,7 +302,6 @@ def do_command(args, fatal_errors=True, transactional=False):
def get_transaction_locks():
for arch in DEFAULT_ARCHITECTURES:
cmd = [ 'wanna-build', '-b', '%s/build-db' % arch ]
-
cmd.extend(['--lock-for', str(os.getpid())])
p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
@@ -315,12 +314,39 @@ def get_transaction_locks():
if output:
print ''.join(' | ' + x for x in output)
+ cmd = [ 'wanna-build', '-b', '%s/build-db' % arch ]
+ cmd.extend(['--act-on-behalve-of', str(os.getpid()) ])
+ cmd.extend(['--start-transaction'])
+
+ p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
+ status = p.wait()
+ output = p.stdout.readlines() + p.stderr.readlines()
+
+ if status or output:
+ print '* Starting transaction for %s%s' % (arch,
+ status and ': exit status %d' % status or '')
+ if output:
+ print ''.join(' | ' + x for x in output)
+
##
def release_transaction_locks():
for arch in DEFAULT_ARCHITECTURES:
cmd = [ 'wanna-build', '-b', '%s/build-db' % arch ]
+ cmd.extend(['--act-on-behalve-of', str(os.getpid()) ])
+ cmd.extend(['--commit-transaction'])
+
+ p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
+ status = p.wait()
+ output = p.stdout.readlines() + p.stderr.readlines()
+ if status or output:
+ print '* Aborting transaction for %s%s' % (arch,
+ status and ': exit status %d' % status or '')
+ if output:
+ print ''.join(' | ' + x for x in output)
+
+ cmd = [ 'wanna-build', '-b', '%s/build-db' % arch ]
cmd.extend(['--unlock-for', str(os.getpid())])
p = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
@@ -339,7 +365,7 @@ def get_wb_info(pkg, dist, arch, transactional=False):
cmd = [ 'wanna-build', '-b', '%s/build-db' % arch, '-d', dist]
if transactional:
- cmd.extend([ '--act-on-behalve-of', str(os.getpid()) ])
+ cmd.extend([ '--transactional', '--act-on-behalve-of', str(os.getpid()) ])
cmd.extend(['--info', pkg])
--
1.6.3.3
Reply to: