Difference between revisions of "User:Kr/Concurrent Checkout"
From Apache OpenOffice Wiki
< User:Kr
m (Removed "async", added "jobs".) |
m (Now supports check outs of any particular CWS.) |
||
Line 2: | Line 2: | ||
The following script may be invoked as: | The following script may be invoked as: | ||
− | ./conco -v modules=smoketestoo_native -v CVS="anoncvs@anoncvs.services.openoffice.org" -v | + | ./conco -v modules=smoketestoo_native -v CVS="anoncvs@anoncvs.services.openoffice.org" -v Master=SRC680 -v CWS=bunoexttm |
+ | |||
+ | respectively | ||
+ | ./conco -v modules=smoketestoo_native -v CVS="anoncvs@anoncvs.services.openoffice.org" -v Master=SRC680 -v Milestone=m203 | ||
+ | |||
+ | It now supports the checkout of any particular CWS. | ||
The handling of concurrent check outs is far from optimal, there is much room for improvement :-) | The handling of concurrent check outs is far from optimal, there is much room for improvement :-) | ||
Line 9: | Line 14: | ||
#!/usr/bin/awk -f | #!/usr/bin/awk -f | ||
− | function | + | function coModules(modules,dirname,tag,module,amodules,i,j) { |
− | + | cvscmd = "cvs '-d:pserver:%s:/cvs' co %s %s > /dev/null &\n" | |
− | + | ||
− | cvscmd = "cvs '-d:pserver:%s:/cvs' co | + | |
split(modules,amodules) | split(modules,amodules) | ||
Line 19: | Line 22: | ||
if (j <= 0) { | if (j <= 0) { | ||
j = jobs # Maximum number of concurrent jobs. | j = jobs # Maximum number of concurrent jobs. | ||
− | printf("wait\n") | | + | printf("wait\n") | Shell |
} | } | ||
− | printf(cvscmd,CVS,tag, | + | |
+ | module = amodules[i] | ||
+ | |||
+ | if (split(module,temp,"@") == 2) { | ||
+ | dirname = temp[1] | ||
+ | tag = "-r"temp[2] | ||
+ | } | ||
+ | else | ||
+ | dirname = module | ||
+ | |||
+ | printf(cvscmd,CVS,tag,dirname) | ||
+ | printf(cvscmd,CVS,tag,dirname) | Shell | ||
j -- | j -- | ||
} | } | ||
− | printf("wait\n") | | + | printf("wait\n") | Shell |
− | close( | + | close(Shell) |
} | } | ||
− | + | function queryMilestone(cws,milestone) { | |
− | print " | + | print "export SOLARENV=./solenv" |& Shell |
− | print " | + | print "export VCSID=kr" |& Shell |
− | print " | + | print "$SOLARENV/bin/cwsquery -m " Master " -c " cws " current" |& Shell |
− | + | Shell |& getline milestone | |
+ | close(Shell) | ||
− | + | return milestone | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | function queryModules(modules) { | |
− | + | print "export WORK_STAMP=" Master |& Shell | |
+ | print "export CWS_WORK_STAMP=" CWS |& Shell | ||
+ | print "export SOLARENV=./solenv" |& Shell | ||
+ | print "export VCSID=kr" |& Shell | ||
+ | print "echo `$SOLARENV/bin/cwsquery modules`" |& Shell | ||
+ | Shell |& getline modules | ||
+ | close(Shell) | ||
− | + | return modules | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |||
− | |||
− | |||
− | function walkDependencies(modules,cnt,recs,line,nf,i,j,module) { | + | function walkDependencies(modules,tags,smodules,amodules,cnt,recs,line,nf,i,j,module) { |
if (length(modules) <= 0) | if (length(modules) <= 0) | ||
return | return | ||
Line 66: | Line 73: | ||
# CO "build.lst" of wanted modules. | # CO "build.lst" of wanted modules. | ||
− | + | modules="" | |
for (i in amodules) { | for (i in amodules) { | ||
− | + | module = amodules[i] | |
− | smodules[ | + | |
− | + | if (!(module in smodules) || smodules[module] == 0) { | |
+ | smodules[module] = 1 # mark this module as tested | ||
+ | |||
+ | if (!(module in tags)) # no tagged yet? | ||
+ | tags[module] = Master Milestone | ||
+ | |||
+ | modules=modules " " module"/prj/build.lst@" tags[module] | ||
} | } | ||
} | } | ||
− | print "getting build.lst for " | + | print "getting build.lst for " modules " ..." |
− | + | coModules(modules) | |
+ | |||
modules="" | modules="" | ||
Line 82: | Line 96: | ||
# Check if the module is there now, otherwise ignore it. | # Check if the module is there now, otherwise ignore it. | ||
if (getline < (amodules[i]"/prj/build.lst") >= 0) { | if (getline < (amodules[i]"/prj/build.lst") >= 0) { | ||
− | |||
close(amodules[i]"/prj/build.lst") | close(amodules[i]"/prj/build.lst") | ||
+ | |||
+ | smodules[amodules[i]] = 2 # Mark this module as valid. | ||
# Get dependencies. | # Get dependencies. | ||
Line 96: | Line 111: | ||
j = 4 | j = 4 | ||
while(j < nf) { | while(j < nf) { | ||
− | + | if (split(recs[j],temp,":") == 2) | |
− | + | module = temp[2] | |
− | + | else | |
− | else | + | module = temp[1] |
− | + | ||
− | |||
if (!(module in smodules)) { | if (!(module in smodules)) { | ||
modules = modules " " module | modules = modules " " module | ||
Line 116: | Line 129: | ||
} | } | ||
− | walkDependencies(modules) | + | walkDependencies(modules,tags,smodules) |
+ | } | ||
+ | |||
+ | function findDependencies(modules,tags,smodules,temp) { | ||
+ | walkDependencies(modules,tags,smodules) | ||
+ | |||
+ | modules="" | ||
+ | asorti(smodules,temp) | ||
+ | for (i in temp) { | ||
+ | if (smodules[temp[i]] == 2) { | ||
+ | modules=modules " " temp[i] | ||
+ | |||
+ | if (temp[i] in tags) # need to tag | ||
+ | modules = modules "@" tags[temp[i]] | ||
+ | else | ||
+ | modules = modules "@" Master Milestone | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return modules | ||
+ | } | ||
+ | |||
+ | BEGIN { | ||
+ | Shell="/bin/sh" | ||
+ | |||
+ | if (jobs == "") { | ||
+ | if (CVS == "anoncvs@anoncvs.services.openoffice.org") | ||
+ | jobs = 3 | ||
+ | else | ||
+ | jobs = 35 | ||
+ | } | ||
+ | |||
+ | # solenv does not get tagged for Milestones | ||
+ | coModules("solenv@" Master) | ||
+ | if (CWS != "") { | ||
+ | |||
+ | Milestone = "_" queryMilestone(CWS) | ||
+ | |||
+ | cwsModules = queryModules() | ||
+ | |||
+ | split(cwsModules,temp) | ||
+ | for (i in temp) { | ||
+ | tags[temp[i]] = "cws_" tolower(Master) "_" tolower(CWS) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | print "modules: " modules | ||
+ | print "CVS: " CVS | ||
+ | print "Master:" Master | ||
+ | print "cws:" CWS | ||
+ | print "jobs: " jobs | ||
+ | print "milestone:" Milestone | ||
+ | |||
+ | |||
+ | # Unfortunately, there are some modules, which somehow are not reachable by | ||
+ | # the dependencies. | ||
+ | smodules["config_office" ]=2 | ||
+ | smodules["dmake" ]=2 | ||
+ | smodules["default_images" ]=2 | ||
+ | smodules["external_images"]=2 | ||
+ | smodules["lingucomponent" ]=2 | ||
+ | modules=findDependencies(modules,tags,smodules) | ||
+ | |||
+ | print "checking out needed modules: " modules " ..." | ||
+ | coModules(modules, Master) | ||
} | } | ||
</pre> | </pre> |
Revision as of 16:54, 8 March 2007
This script has been pointed to by an GullFOSS entry.
The following script may be invoked as:
./conco -v modules=smoketestoo_native -v CVS="anoncvs@anoncvs.services.openoffice.org" -v Master=SRC680 -v CWS=bunoexttm
respectively
./conco -v modules=smoketestoo_native -v CVS="anoncvs@anoncvs.services.openoffice.org" -v Master=SRC680 -v Milestone=m203
It now supports the checkout of any particular CWS.
The handling of concurrent check outs is far from optimal, there is much room for improvement :-)
#!/usr/bin/awk -f function coModules(modules,dirname,tag,module,amodules,i,j) { cvscmd = "cvs '-d:pserver:%s:/cvs' co %s %s > /dev/null &\n" split(modules,amodules) j = 0 # Maximum number of concurrent jobs. for (i in amodules) { if (j <= 0) { j = jobs # Maximum number of concurrent jobs. printf("wait\n") | Shell } module = amodules[i] if (split(module,temp,"@") == 2) { dirname = temp[1] tag = "-r"temp[2] } else dirname = module printf(cvscmd,CVS,tag,dirname) printf(cvscmd,CVS,tag,dirname) | Shell j -- } printf("wait\n") | Shell close(Shell) } function queryMilestone(cws,milestone) { print "export SOLARENV=./solenv" |& Shell print "export VCSID=kr" |& Shell print "$SOLARENV/bin/cwsquery -m " Master " -c " cws " current" |& Shell Shell |& getline milestone close(Shell) return milestone } function queryModules(modules) { print "export WORK_STAMP=" Master |& Shell print "export CWS_WORK_STAMP=" CWS |& Shell print "export SOLARENV=./solenv" |& Shell print "export VCSID=kr" |& Shell print "echo `$SOLARENV/bin/cwsquery modules`" |& Shell Shell |& getline modules close(Shell) return modules } function walkDependencies(modules,tags,smodules,amodules,cnt,recs,line,nf,i,j,module) { if (length(modules) <= 0) return split(modules,amodules) # CO "build.lst" of wanted modules. modules="" for (i in amodules) { module = amodules[i] if (!(module in smodules) || smodules[module] == 0) { smodules[module] = 1 # mark this module as tested if (!(module in tags)) # no tagged yet? tags[module] = Master Milestone modules=modules " " module"/prj/build.lst@" tags[module] } } print "getting build.lst for " modules " ..." coModules(modules) modules="" # Walk the dependencies. for (i in amodules) { # Check if the module is there now, otherwise ignore it. if (getline < (amodules[i]"/prj/build.lst") >= 0) { close(amodules[i]"/prj/build.lst") smodules[amodules[i]] = 2 # Mark this module as valid. # Get dependencies. do { cnt = getline line < (amodules[i]"/prj/build.lst") } while(cnt >= 0 && line ~ /^#.*/) close(amodules[i]"/prj/build.lst") if (cnt >= 0) { nf = split(line, recs) j = 4 while(j < nf) { if (split(recs[j],temp,":") == 2) module = temp[2] else module = temp[1] if (!(module in smodules)) { modules = modules " " module smodules[module] = 0 } j=j + 1 } } } else smodules[amodules[i]] = 1 # Mark this module as invalid. } walkDependencies(modules,tags,smodules) } function findDependencies(modules,tags,smodules,temp) { walkDependencies(modules,tags,smodules) modules="" asorti(smodules,temp) for (i in temp) { if (smodules[temp[i]] == 2) { modules=modules " " temp[i] if (temp[i] in tags) # need to tag modules = modules "@" tags[temp[i]] else modules = modules "@" Master Milestone } } return modules } BEGIN { Shell="/bin/sh" if (jobs == "") { if (CVS == "anoncvs@anoncvs.services.openoffice.org") jobs = 3 else jobs = 35 } # solenv does not get tagged for Milestones coModules("solenv@" Master) if (CWS != "") { Milestone = "_" queryMilestone(CWS) cwsModules = queryModules() split(cwsModules,temp) for (i in temp) { tags[temp[i]] = "cws_" tolower(Master) "_" tolower(CWS) } } print "modules: " modules print "CVS: " CVS print "Master:" Master print "cws:" CWS print "jobs: " jobs print "milestone:" Milestone # Unfortunately, there are some modules, which somehow are not reachable by # the dependencies. smodules["config_office" ]=2 smodules["dmake" ]=2 smodules["default_images" ]=2 smodules["external_images"]=2 smodules["lingucomponent" ]=2 modules=findDependencies(modules,tags,smodules) print "checking out needed modules: " modules " ..." coModules(modules, Master) }