| from ClientForm import ParseResponse |
from ClientForm import ParseResponse |
| |
|
| debug=0 |
debug=0 |
| clean=1 |
clean=0 |
| dont_build=0 |
dont_build=1 |
| verbose=1 |
verbose=1 |
| |
|
| # parse host-specific configuration information from gkb.cfg |
# parse host-specific configuration information from gkb.cfg |
| log("calling gkb_getsource",kinfo) |
log("calling gkb_getsource",kinfo) |
| gkb_getsource(kinfo) |
gkb_getsource(kinfo) |
| |
|
| # now we'll go into the work |
# go into the work directory |
| |
chdir(workdir) |
| |
|
| |
# archive the clean source for later uploading |
| |
os.system("tar xjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"]) |
| |
|
| |
# now we'll go into the tree's work dir |
| chdir(kinfo["workdir"],kinfo) |
chdir(kinfo["workdir"],kinfo) |
| |
|
| # check for patches and apply if necessary |
# check for patches and apply if necessary |
| # of globally as it is only needed in this target |
# of globally as it is only needed in this target |
| gkb_runmake("modules_install", kinfo, premake, "INSTALL_MOD_PATH=%s %s" % (mybindir, makeopts)) |
gkb_runmake("modules_install", kinfo, premake, "INSTALL_MOD_PATH=%s %s" % (mybindir, makeopts)) |
| |
|
| |
# compress and upload source archive |
| |
chdir(kinfo["workdir"]+"/..",kinfo) |
| |
archive_name = "src-%s.tar.bz2" % kinfo["mastertree"], |
| |
|
| |
# compress and upload kernel binary |
| chdir(bindir,kinfo) |
chdir(bindir,kinfo) |
| archive_name = "linux-%s-%s.tar.bz2" % (kinfo["name"], myversion) |
archive_name = "linux-%s-%s.tar.bz2" % (kinfo["name"], myversion) |
| |
|
| |
|
| os.system("rm -rf %s" % mybindir) |
os.system("rm -rf %s" % mybindir) |
| |
|
| krn_upload(archive_name,myversion,kinfo) |
krn_upload(archive_name,"kernel",myversion,kinfo) |
| |
krn_querymgr("checkin",kinfo) |
| |
|
| |
if (os.fork() == 0): |
| |
#in child |
| |
krn_upload(workdir + "/" + kinfo["mastertree"] + ".tar.bz2", "source", myversion, kinfo) |
| |
|
| except BuildError, e: |
except BuildError, e: |
| log(e.message, kinfo) |
log(e.message, kinfo) |
| krn_querymgr("checkin",kinfo) |
krn_querymgr("checkin",kinfo) |
| p.StartElementHandler = start_element |
p.StartElementHandler = start_element |
| p.ParseFile(open(name)) |
p.ParseFile(open(name)) |
| |
|
| def krn_upload(file, version, kinfo): |
def krn_upload(file, type, version, kinfo): |
| """upload the indicated file to the distribution site (kernel archives)""" |
"""upload the indicated file to the distribution site (kernel archives)""" |
| forms = ParseResponse(urlopen(msite+"/fileupload.html")) |
|
| |
if type=="kernel": |
| |
log("uploading kernel version "+version+" to "+msite,kinfo) |
| |
elif type=="source": |
| |
log("uploading source "+kinfo["mastertree"]+" to "+msite,kinfo) |
| |
else: |
| |
raise BuildException, "invalid file upload type: " + type |
| |
|
| |
forms = ParseResponse(urlopen(msite+"/upload.html")) |
| form = forms[0] |
form = forms[0] |
| |
|
| form["host"] = host |
form["host"] = host |
| form["pass"] = passwd |
form["pass"] = passwd |
| |
form["type"] = type |
| |
form["tree"] = kinfo["mastertree"] |
| form["build"] = kinfo["name"] |
form["build"] = kinfo["name"] |
| form["version"] = version |
form["version"] = version |
| |
|
| form.add_file(open(file), "application/x-bzip2", os.path.basename(file)) |
form.add_file(open(file), "application/x-bzip2", os.path.basename(file)) |
| |
|
| log("uploading kernel version "+version+" to "+msite,kinfo) |
|
| # form.click() returns a urllib2.Request object |
# form.click() returns a urllib2.Request object |
| # (see HTMLForm.click.__doc__ if you don't have urllib2) |
# (see HTMLForm.click.__doc__ if you don't have urllib2) |
| response2 = urlopen(form.click("cmd")) |
response = urlopen(form.click("cmd")) |
| |
|
| |
if debug: |
| |
print response.geturl() |
| |
print response.info() # headers |
| |
print response.read() # body |
| |
|
| #print response2.geturl() |
log("response: " + response.read(),kinfo) |
| #print response2.info() # headers |
|
| #print response2.read() # body |
|
| log("response: " + response2.read(),kinfo) |
|
| |
|
| response2.close() |
response.close() |
| |
|
| def main(): |
def main(): |
| """ main program gets executed here """ |
""" main program gets executed here """ |