projects
/
invirt/packages/invirt-dev.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renamed init script to 'invirtibuilder'
[invirt/packages/invirt-dev.git]
/
invirt-submit-build
diff --git
a/invirt-submit-build
b/invirt-submit-build
index
caa949f
..
8175865
100755
(executable)
--- a/
invirt-submit-build
+++ b/
invirt-submit-build
@@
-18,6
+18,7
@@
keeping.
import datetime
import datetime
+import optparse
import os
import sys
import tempfile
import os
import sys
import tempfile
@@
-27,7
+28,12
@@
import invirt.builder as b
def main():
def main():
- pocket, package, commit = sys.argv[1:4]
+ parser = optparse.OptionParser('Usage: %prog pocket package commit')
+ opts, args = parser.parse_args()
+ if len(args) != 3:
+ parser.print_help()
+ return 1
+ pocket, package, commit = args
principal = os.environ['REMOTE_USER']
request_time = datetime.datetime.utcnow()
q_path = os.path.join(b._QUEUE_DIR,
principal = os.environ['REMOTE_USER']
request_time = datetime.datetime.utcnow()
q_path = os.path.join(b._QUEUE_DIR,
@@
-35,7
+41,7
@@
def main():
uuid.uuid4()))
try:
uuid.uuid4()))
try:
- validateBuild(pocket, package, commit)
+ b.validateBuild(pocket, package, commit)
except b.InvalidBuild, e:
print >>sys.stderr, "E: %s" % e
sys.exit(1)
except b.InvalidBuild, e:
print >>sys.stderr, "E: %s" % e
sys.exit(1)
@@
-43,9
+49,11
@@
def main():
# To keep from triggering the Invirtibuilder before we've actually
# written the file out, first write the queue entry to a temporary
# file, and then move it into the queue directory.
# To keep from triggering the Invirtibuilder before we've actually
# written the file out, first write the queue entry to a temporary
# file, and then move it into the queue directory.
- q = tempfile.NamedTemporaryFile(delete=False)
+ q_fd, q_name = tempfile.mkstemp()
+ q = os.fdopen(q_fd, 'r+')
print >>q, "%s %s %s %s" % (pocket, package, commit, principal)
print >>q, "%s %s %s %s" % (pocket, package, commit, principal)
- os.rename(q.name, q_path)
+ q.close()
+ os.rename(q_name, q_path)
if __name__ == '__main__':
if __name__ == '__main__':