| |
|
| 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 " + clean(cmd), kinfo) |
| |
|
| p4obj = popen2.Popen4(cmd) |
p4obj = popen2.Popen4(cmd) |
| |
|
| if err == None: |
if err == None: |
| err = 0 |
err = 0 |
| |
|
| log(" result code: %i" % err, kinfo) |
log(" \_ exit code: %i" % err, kinfo) |
| |
|
| return err |
return err |
| |
|
| """Supporting method to verify a given exists, if not it will create it""" |
"""Supporting method to verify a given exists, if not it will create it""" |
| log("verifying directory " + mydir,kinfo) |
log("verifying directory " + mydir,kinfo) |
| if not os.path.isdir(mydir): |
if not os.path.isdir(mydir): |
| log("%s doesn't exist, creating" % mydir,kinfo) |
log(" \_ %s doesn't exist, creating" % mydir,kinfo) |
| os.mkdir(mydir) |
os.mkdir(mydir) |
| return mydir |
return mydir |
| |
|
| version=krn_localversion(kinfo) |
version=krn_localversion(kinfo) |
| log("querying distribution site manager with command '%s' (kernel version=%s)" % (command,version),kinfo) |
log("querying distribution site manager with command '%s' (kernel version=%s)" % (command,version),kinfo) |
| result=getoutput("wget --quiet --output-document=- \"%s/manager.php?cmd=%s&host=%s&pass=%s&build=%s&version=%s\"" % (msite,command,host,passwd,kinfo["name"],version)) |
result=getoutput("wget --quiet --output-document=- \"%s/manager.php?cmd=%s&host=%s&pass=%s&build=%s&version=%s\"" % (msite,command,host,passwd,kinfo["name"],version)) |
| log("result: '"+result+"'",kinfo) |
log(" \_ result: '"+result+"'",kinfo) |
| return result=="1" |
return result=="1" |
| |
|
| def krn_localversion(kinfo): |
def krn_localversion(kinfo): |
| verifydir("%s/%s" % (patchdir, kinfo["name"]),kinfo) |
verifydir("%s/%s" % (patchdir, kinfo["name"]),kinfo) |
| |
|
| # sync the source to make sure we are up to date ... |
# sync the source to make sure we are up to date ... |
| log("calling gkb_getsource",kinfo) |
log("fetching latest source",kinfo) |
| gkb_getsource(kinfo) |
gkb_getsource(kinfo) |
| |
|
| # go into the work directory |
# go into the work directory |
| today=getoutput("date +%D") |
today=getoutput("date +%D") |
| buildtime=getoutput("date +'%R:%S %Z'") |
buildtime=getoutput("date +'%R:%S %Z'") |
| |
|
| print "GKB started %s %s" % (today,buildtime) |
print "GNU Kernel Builder started %s %s" % (today,buildtime) |
| |
|
| # verify the existence important directories, and create if necessary |
# verify the existence important directories, and create if necessary |
| verifydir(logdir) |
verifydir(logdir) |
| verifydir("%s/work" % buildroot) # build dir, make sure it exists |
verifydir("%s/work" % buildroot) # build dir, make sure it exists |
| |
|
| # download the build jobs from the master site |
# download the build jobs from the master site |
| |
log("fetching build jobs from master site") |
| if runcmd("wget --quiet --output-document=gkb.xml \"%s/manager.php?cmd=getjobs&host=%s&pass=%s\"" % (msite,host,passwd)): |
if runcmd("wget --quiet --output-document=gkb.xml \"%s/manager.php?cmd=getjobs&host=%s&pass=%s\"" % (msite,host,passwd)): |
| raise FatalError, "Unable to download build config from master site %s, aborting." % msite |
raise FatalError, "Unable to download build jobs from master site %s, aborting." % msite |
| |
|
| # sets up 'mastertrees' and 'builds' dicts |
# sets up 'mastertrees' and 'builds' dicts |
| gkb_parsexml('gkb.xml') |
gkb_parsexml('gkb.xml') |