[cvs] / gkb / gkb.py  

cvs: gkb/gkb.py

Diff for /gkb/gkb.py between version 1.15 and 1.16

version 1.15, Sat Aug 14 19:58:46 2004 UTC version 1.16, Sun Aug 15 03:27:39 2004 UTC
Line 91 
Line 91 
         if verbose==1:          if verbose==1:
                 print myoutput                  print myoutput
   
 def system(cmd):  def linkpipes(input, output):
           data = input.read(2048)
           while data:
                   output.write(data)
   
   def runcmd(cmd, outfile=None, append=False, infile=None):
         log("running " + cmd)          log("running " + cmd)
         err = os.system(cmd)  
           (pin, pouterr) = os.popen4(cmd)
   
           if infile != None:
                   inobj = open(infile, "r")
                   linkpipes(inobj, pin)
                   inobj.close()
   
           if outfile != None:
                   if append:
                           mode = "a"
                   else:
                           mode = "w"
   
                   outobj = open(outfile, mode)
                   linkpipes(file,pouterr)
                   outobj.close()
   
           err = file.close()
   
           if err == None:
                   err = 0
   
         log("result code: %i" %  err)          log("result code: %i" %  err)
   
         return err          return err
   
 def log(text,kinfo=0):  def log(text,kinfo=0):
Line 163 
Line 191 
   
         # 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)
         system("tar xjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"])          runcmd("tar xjf " + kinfo["mastertree"] + ".tar.bz2 " + kinfo["mastertree"])
   
         # 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)
Line 238 
Line 266 
   
                         log("compressing binary archive "+archive_name,kinfo)                          log("compressing binary archive "+archive_name,kinfo)
   
                         if system("tar cjf "+archive_name+" "+os.path.basename(mybindir)):                          if runcmd("tar cjf "+archive_name+" "+os.path.basename(mybindir)):
                                 raise BuildError("failed to `tar cjf %s`" %  archive_name)                                  raise BuildError("failed to `tar cjf %s`" %  archive_name)
   
                         system("rm -rf %s" % mybindir)                          runcmd("rm -rf %s" % mybindir)
   
                         krn_upload(archive_name,"kernel",myversion,kinfo)                          krn_upload(archive_name,"kernel",myversion,kinfo)
                         krn_querymgr("checkin",kinfo)                          krn_querymgr("checkin",kinfo)
Line 285 
Line 313 
         syncline=args+" "+kinfo["workdir"]          syncline=args+" "+kinfo["workdir"]
   
         log("running rsync : %s %s" % (syncoptions, syncline),kinfo)          log("running rsync : %s %s" % (syncoptions, syncline),kinfo)
         if system("%s %s > %s/%s/rsync.log 2>&1" % (syncoptions, syncline, logdir, kinfo["name"])):          if runcmd("%s %s" % (syncoptions, syncline), "%s/%s/rsync.log" % (logdir, kinfo["name"])):
                 raise BuildError("sync failed, tried %s.  See log for details." %  syncline)                  raise BuildError("sync failed, tried %s.  See log for details." %  syncline)
   
 def get_wget(kinfo):  def get_wget(kinfo):
Line 296 
Line 324 
         log("fetching source archive " % args,kinfo)          log("fetching source archive " % args,kinfo)
         mysourcefile="%s/%s.tar.bz2" % (kinfo["workdir"],kinfo["name"])          mysourcefile="%s/%s.tar.bz2" % (kinfo["workdir"],kinfo["name"])
   
         if system("wget --quiet --output-document=%s %s/configs/%s" % (myconfigfile,msite,kinfo["name"])):          if runcmd("wget --quiet --output-document=%s %s/configs/%s" % (myconfigfile,msite,kinfo["name"])):
                 raise BuildError("unable to download configfile, aborting.")                  raise BuildError("unable to download configfile, aborting.")
   
         log("decompressing source file",kinfo)          log("decompressing source file",kinfo)
         if system("tar xjf " % (myconfigfile,msite,kinfo["name"])):          if runcmd("tar xjf " % (myconfigfile,msite,kinfo["name"])):
                 raise BuildError("unable to decompress source file, aborting.")                  raise BuildError("unable to decompress source file, aborting.")
   
 def get_vanilla(kinfo):  def get_vanilla(kinfo):
Line 309 
Line 337 
         log("fetching source archive %s" % args)          log("fetching source archive %s" % args)
         mysourcefile="%s/%s.tar.bz2" % (workdir,kinfo["name"])          mysourcefile="%s/%s.tar.bz2" % (workdir,kinfo["name"])
   
         if system("wget -c --output-document=%s %s" % (mysourcefile,args)):          if runcmd("wget -c --output-document=%s %s" % (mysourcefile,args)):
                 raise BuildError("unable to download source file %s, aborting." %  args)                  raise BuildError("unable to download source file %s, aborting." %  args)
   
         log("decompressing source file %s" % mysourcefile,kinfo)          log("decompressing source file %s" % mysourcefile,kinfo)
Line 330 
Line 358 
         fnames=split(data)          fnames=split(data)
         name=fnames[0]          name=fnames[0]
   
         system("rm -rf %s" % kinfo["workdir"])          runcmd("rm -rf %s" % kinfo["workdir"])
         move(work + "/" + dirname, kinfo["workdir"])          move(work + "/" + dirname, kinfo["workdir"])
   
         #restore the previous working ectory          #restore the previous working ectory
Line 348 
Line 376 
                         mypatchfile="%s/%s/%s.patch" % (patchdir,kinfo["name"],patch)                          mypatchfile="%s/%s/%s.patch" % (patchdir,kinfo["name"],patch)
   
                         # download pathfile or bail                          # download pathfile or bail
                         if system("wget --quiet --output-document=%s %s/patches/%s/%s" % (mypatchfile,msite,kinfo["name"],patch)):                          if runcmd("wget --quiet --output-document=%s %s/patches/%s/%s" % (mypatchfile,msite,kinfo["name"],patch)):
                                 raise BuildError("unable to download patchfile %s, aborting." % patch)                                  raise BuildError("unable to download patchfile %s, aborting." % patch)
   
                         # we have a patch file, apply it or bail                          # we have a patch file, apply it or bail
                         log("perfoming patch with %s" % patch,kinfo)                          log("perfoming patch with %s" % patch,kinfo)
                         patchcommand="patch -p1 < %s > %s/%s/patch-%s.log 2>&1" % (mypatchfile,logdir,kinfo["name"],patch)  
                         log("using %s from %s" % (patchcommand,kinfo["workdir"]),kinfo)                          # former patchcommand was:
                           #patchcommand="patch -p1 < %s > %s/%s/patch-%s.log 2>&1" % (mypatchfile,logdir,kinfo["name"],patch)
                           #log("using %s from %s" % (patchcommand,kinfo["workdir"]),kinfo)
   
                         chdir(kinfo["workdir"],kinfo)                          chdir(kinfo["workdir"],kinfo)
                         if system(patchcommand):                          if runcmd("patch -p1", "%s/%s/patch-%s.log" % (logdir,kinfo["name"],patch), False, mypatchfile):
                                 raise BuildError("patchfile %s failed, aborting.  See patch log for details." % patch)                                  raise BuildError("patchfile %s failed, aborting.  See patch log for details." % patch)
         else:          else:
                 log("no patchfiles, continuing",kinfo)                  log("no patchfiles, continuing",kinfo)
Line 368 
Line 399 
                 log("fetching config file",kinfo)                  log("fetching config file",kinfo)
                 myconfigfile="%s/%s.config" % (configdir,kinfo["name"])                  myconfigfile="%s/%s.config" % (configdir,kinfo["name"])
   
                 if system("wget --quiet --output-document=%s %s/configs/%s" % (myconfigfile,msite,kinfo["name"])):                  if runcmd("wget --quiet --output-document=%s %s/configs/%s" % (myconfigfile,msite,kinfo["name"])):
                         raise BuildError("unable to download configfile, aborting.")                          raise BuildError("unable to download configfile, aborting.")
   
                 log("copying config file to %s/.config" % kinfo["workdir"],kinfo)                  log("copying config file to %s/.config" % kinfo["workdir"],kinfo)
Line 378 
Line 409 
 def gkb_runmake(command, kinfo, premake, makeopts):  def gkb_runmake(command, kinfo, premake, makeopts):
         """Supporting method for build() ... a stub to run a make target and auto log it, given make target (command) and name (kernel name)"""          """Supporting method for build() ... a stub to run a make target and auto log it, given make target (command) and name (kernel name)"""
         log("running make %s" % command,kinfo)          log("running make %s" % command,kinfo)
         if system("%s make %s %s > %s/%s/make-%s.log 2>&1" % (premake, makeopts, command, logdir, kinfo["name"], command)):          if runcmd("%s make %s %s" % (premake, makeopts, command), "%s/%s/make-%s.log" % (logdir, kinfo["name"], command)):
                 raise BuildError("unable to run make %s, aborting." % command)                  raise BuildError("unable to run make %s, aborting." % command)
   
 def gkb_parsexml(name):  def gkb_parsexml(name):
Line 448 
Line 479 
         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
         if system("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 config from master site %s, aborting." % msite
   
         # sets up 'mastertrees' and 'builds' dicts          # sets up 'mastertrees' and 'builds' dicts


Generate output suitable for use with a patch program
Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

Tobias McNulty

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help