Difference between revisions of "User:Kr/Concurrent Checkout"
From Apache OpenOffice Wiki
< User:Kr
m (Fixed typo.) |
m (Removed "async", added "jobs".) |
||
Line 12: | Line 12: | ||
shell="/bin/sh" | shell="/bin/sh" | ||
− | cvscmd = "cvs '-d:pserver:%s:/cvs' co -r%s %s > /dev/null | + | cvscmd = "cvs '-d:pserver:%s:/cvs' co -r%s %s > /dev/null &\n" |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
split(modules,amodules) | split(modules,amodules) | ||
j = 0 # Maximum number of concurrent jobs. | j = 0 # Maximum number of concurrent jobs. | ||
for (i in amodules) { | for (i in amodules) { | ||
− | if (j | + | if (j <= 0) { |
− | j = | + | j = jobs # Maximum number of concurrent jobs. |
printf("wait\n") | shell | printf("wait\n") | shell | ||
} | } | ||
Line 37: | Line 33: | ||
print "CVS: " CVS | print "CVS: " CVS | ||
print "tag:" tag | print "tag:" tag | ||
− | print " | + | print "jobs: " jobs |
+ | |||
+ | if (jobs == "") { | ||
+ | if (CVS == "anoncvs@anoncvs.services.openoffice.org") | ||
+ | jobs = 3 | ||
+ | else | ||
+ | jobs = 35 | ||
+ | } | ||
# smodules: The module status array. | # smodules: The module status array. |
Revision as of 09:02, 7 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 async=f -v tag=SRC680_m203
The handling of concurrent check outs is far from optimal, there is much room for improvement :-)
#!/usr/bin/awk -f function co(modules,amodules,i,j) { shell="/bin/sh" cvscmd = "cvs '-d:pserver:%s:/cvs' co -r%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 } printf(cvscmd,CVS,tag,amodules[i]) | shell j -- } printf("wait\n") | shell close(shell) } BEGIN { print "modules: " modules print "CVS: " CVS print "tag:" tag print "jobs: " jobs if (jobs == "") { if (CVS == "anoncvs@anoncvs.services.openoffice.org") jobs = 3 else jobs = 35 } # smodules: The module status array. walkDependencies(modules) # Unfortunately, there are some modules, which somehow are not reachable by # the dependencies. bmodules="config_office dmake default_images external_images lingucomponent" asorti(smodules,dest) for (i in dest) { if (smodules[dest[i]] == 2) { bmodules=bmodules " " dest[i] } } print "checking out needed modules: " bmodules " ..." co(bmodules) } function walkDependencies(modules,cnt,recs,line,nf,i,j,module) { if (length(modules) <= 0) return split(modules,amodules) # CO "build.lst" of wanted modules. bmodules="" for (i in amodules) { if (!(amodules[i] in smodules) || smodules[amodules[i]] == 0) { smodules[amodules[i]] = 1 # mark this module as tested bmodules=bmodules " " amodules[i]"/prj/build.lst" } } print "getting build.lst for " bmodules " ..." co(bmodules) 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) { smodules[amodules[i]] = 2 # Mark this module as valid. close(amodules[i]"/prj/build.lst") # 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) { tmp=index(recs[j],":") if (tmp == 0) tmp=1 else tmp=tmp+1 module=substr(recs[j],tmp) 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) }