| from urllib2 import urlopen |
from urllib2 import urlopen |
| from ClientForm import ParseResponse |
from ClientForm import ParseResponse |
| |
|
| |
|
| debug=0 |
debug=0 |
| clean=1 |
clean=1 |
| dont_build=0 |
dont_build=0 |
| if verbose==1: |
if verbose==1: |
| print myoutput |
print myoutput |
| |
|
| def clean(text): |
def cleantext(text): |
| """clean a string of passwords, etc. to make it suitable for logging""" |
"""clean a string of passwords, etc. to make it suitable for logging""" |
| result = string.replace(text,passwd,"XXXXXXXX") |
result = string.replace(text,passwd,"XXXXXXXX") |
| return result |
return result |
| |
|
| def runcmd(cmd, kinfo=None, outfile=None, append=False, infile=None): |
def runcmd(cmd, kinfo=None, outfile=None, append=False, infile=None): |
| """run the specified command, with the optional input and output documents""" |
"""run the specified command, with the optional input and output documents""" |
| log(" \_ running " + clean(cmd), kinfo) |
log(" \_ running " + cleantext(cmd), kinfo) |
| |
|
| p4obj = popen2.Popen4(cmd) |
p4obj = popen2.Popen4(cmd) |
| |
|
| gkb_getsource(kinfo) |
gkb_getsource(kinfo) |
| |
|
| # go into the work directory |
# go into the work directory |
| chdir(workdir, kinfo) |
#chdir(workdir, kinfo) |
| |
|
| # archive the clean source for later uploading |
# archive the clean source for later uploading |
| log("archiving source to " + kinfo["mastertree"] + ".tar.bz2", kinfo) |
#log("archiving source to " + kinfo["mastertree"] + ".tar.bz2", kinfo) |
| runcmd("tar cjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"], kinfo) |
#runcmd("tar cjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"], kinfo) |
| |
|
| # now we'll go into the tree's work dir |
# now we'll go into the tree's work dir |
| chdir(kinfo["workdir"],kinfo) |
chdir(kinfo["workdir"],kinfo) |
| krn_upload(archive_name,"kernel",myversion,kinfo) |
krn_upload(archive_name,"kernel",myversion,kinfo) |
| krn_querymgr("checkin",kinfo) |
krn_querymgr("checkin",kinfo) |
| |
|
| if (os.fork() == 0): |
if os.fork() == 0: |
| #in child |
#in child |
| |
try: |
| |
# sync the source to make sure we are up to date ... |
| |
log("re-fetching latest source",kinfo) |
| |
gkb_getsource(kinfo) |
| |
|
| |
# go into the work directory |
| |
chdir(workdir, kinfo) |
| |
|
| |
# archive the clean source for later uploading |
| |
log("archiving source to " + kinfo["mastertree"] + ".tar.bz2", kinfo) |
| |
runcmd("tar cjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"], kinfo) |
| |
|
| krn_upload(workdir + "/" + kinfo["mastertree"] + ".tar.bz2", "source", myversion, kinfo) |
krn_upload(workdir + "/" + kinfo["mastertree"] + ".tar.bz2", "source", myversion, kinfo) |
| |
finally: |
| sys.exit(0) |
sys.exit(0) |
| |
|
| except BuildError, e: |
except BuildError, e: |
| print response.info() # headers |
print response.info() # headers |
| print response.read() # body |
print response.read() # body |
| |
|
| log("response: " + response.read(),kinfo) |
log(" \_ response: " + response.read(),kinfo) |
| |
|
| response.close() |
response.close() |
| |
|