1.1 --- a/README Sat Jan 24 16:00:50 2009 +0000
1.2 +++ b/README Tue Feb 10 10:59:02 2009 +0000
1.3 @@ -16,7 +16,23 @@
1.4 components, including pybindgen, NSC, regression testing traces,
1.5 along with cloning a ns-3 repository. By default, the main
1.6 development ns-3 branch, ns-3-dev, will be cloned, but it can be
1.7 - overridden via the -n command line option.
1.8 + overridden via the -n command line option. For example,
1.9 +
1.10 + ./download.py -n craigdo/ns-3-tap
1.11 +
1.12 + will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
1.13 + into the allinone directory.
1.14 +
1.15 + By default, the regression traces will be cloned from the usual
1.16 + http://code.nsnam.org/ns-3-dev-ref-traces into a directory
1.17 + ns-3-dev-ref-traces in the allinone directory. You can override
1.18 + this using the -r command line option. For example,
1.19 +
1.20 + ./download.py -n craigdo/ns-3-tap -r craigdo/ns-3-tap-ref-traces
1.21 +
1.22 + will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
1.23 + into the allinone directory and also clone the reference traces
1.24 + from the http://code.nsnam.org/craigdo/ns-3-tap-ref-traces repo.
1.25
1.26 build.py:
1.27
2.1 --- a/build.py Sat Jan 24 16:00:50 2009 +0000
2.2 +++ b/build.py Tue Feb 10 10:59:02 2009 +0000
2.3 @@ -13,10 +13,10 @@
2.4 run_command(['python', 'scons.py', kernel])
2.5
2.6
2.7 -def build_ns3():
2.8 +def build_ns3(regression_dir):
2.9 cmd = [
2.10 "./waf", "configure",
2.11 - "--with-regression-traces", os.path.join("..", constants.BRANCH + constants.REGRESSION_SUFFIX),
2.12 + "--with-regression-traces", os.path.join("..", regression_dir),
2.13 "--with-pybindgen", os.path.join("..", constants.LOCAL_PYBINDGEN_PATH),
2.14 ]
2.15
2.16 @@ -46,11 +46,12 @@
2.17
2.18
2.19 print "# Build NS-3"
2.20 - d = os.path.join(os.path.dirname(__file__), os.path.split(constants.BRANCH)[-1])
2.21 + d = os.path.join(os.path.dirname(__file__), os.path.split(constants.NS3_BRANCH)[-1])
2.22 print "Entering directory `%s'" % d
2.23 os.chdir(d)
2.24 try:
2.25 - build_ns3()
2.26 + regression_dir = os.path.join(os.path.dirname(__file__), os.path.split(constants.REPO_BRANCH)[-1])
2.27 + build_ns3(regression_dir)
2.28 finally:
2.29 os.chdir(cwd)
2.30 print "Leaving directory `%s'" % d
3.1 --- a/constants.py Sat Jan 24 16:00:50 2009 +0000
3.2 +++ b/constants.py Tue Feb 10 10:59:02 2009 +0000
3.3 @@ -1,8 +1,13 @@
3.4
3.5 try:
3.6 - BRANCH = file("BRANCH").read().strip()
3.7 + NS3_BRANCH = file("NS3-BRANCH").read().strip()
3.8 except IOError:
3.9 - BRANCH = None
3.10 + NS3_BRANCH = None
3.11 +
3.12 +try:
3.13 + REPO_BRANCH = file("REPO-BRANCH").read().strip()
3.14 +except IOError:
3.15 + REPO_BRANCH = None
3.16
3.17 NSNAM_CODE_BASE_URL = "http://code.nsnam.org/"
3.18 PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
4.1 --- a/download.py Sat Jan 24 16:00:50 2009 +0000
4.2 +++ b/download.py Tue Feb 10 10:59:02 2009 +0000
4.3 @@ -28,36 +28,44 @@
4.4 run_command(['hg', '--cwd', ns3_dir, 'pull', '-u'])
4.5
4.6 # For future reference (e.g. build.py script), the downloaded ns3 version becomes our version
4.7 - f = file("BRANCH", "wt")
4.8 + f = file("NS3-BRANCH", "wt")
4.9 f.write("%s\n" % ns3_branch)
4.10 f.close()
4.11 return ns3_dir
4.12
4.13
4.14 -def get_regression_traces(ns3_dir):
4.15 +def get_regression_traces(ns3_dir, regression_branch):
4.16 print """
4.17 #
4.18 # Get the regression traces
4.19 #
4.20 """
4.21 - regression_traces_dir_name = ns3_dir + constants.REGRESSION_SUFFIX
4.22 + # ns3_dir is the directory into which we cloned the repo
4.23 + # regression_branch is the repo in which we will find the traces. Variations like this should work:
4.24 + # ns-3-dev-ref-traces
4.25 + # craigdo/ns-3-dev-ref-traces
4.26 + # craigdo/ns-3-tap-ref-traces
4.27 + regression_traces_dir = os.path.split(regression_branch)[-1]
4.28 + regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch
4.29 +
4.30 print "Synchronizing reference traces using Mercurial."
4.31 try:
4.32 - if not os.path.exists(regression_traces_dir_name):
4.33 - run_command(["hg", "clone", constants.REGRESSION_TRACES_REPO + regression_traces_dir_name, regression_traces_dir_name])
4.34 + if not os.path.exists(regression_traces_dir):
4.35 + run_command(["hg", "clone", regression_branch_url, regression_traces_dir])
4.36 else:
4.37 - run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir_name,
4.38 - constants.REGRESSION_TRACES_REPO + regression_traces_dir_name])
4.39 - run_command(["hg", "-q", "update", "--cwd", regression_traces_dir_name])
4.40 + run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url])
4.41 + run_command(["hg", "-q", "update", "--cwd", regression_traces_dir])
4.42 except OSError: # this exception normally means mercurial is not found
4.43 if not os.path.exists(regression_traces_dir_name):
4.44 - traceball = regression_traces_dir_name + constants.TRACEBALL_SUFFIX
4.45 + traceball = regression_tbranch + constants.TRACEBALL_SUFFIX
4.46 print "Retrieving " + traceball + " from web."
4.47 urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball)
4.48 run_command(["tar", "-xjf", traceball])
4.49 print "Done."
4.50
4.51 -
4.52 + f = file("REPO-BRANCH", "wt")
4.53 + f.write("%s\n" % regression_branch)
4.54 + f.close()
4.55
4.56 def get_pybindgen(ns3_dir):
4.57 print """
4.58 @@ -167,7 +175,9 @@
4.59 def main():
4.60 parser = OptionParser()
4.61 parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
4.62 - help="Name of the NS-3 version", metavar="BRANCH_NAME")
4.63 + help="Name of the ns-3 repository", metavar="BRANCH_NAME")
4.64 + parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces",
4.65 + help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME")
4.66 (options, dummy_args) = parser.parse_args()
4.67
4.68 # first of all, change to the directory of the script
4.69 @@ -176,7 +186,7 @@
4.70 ns3_dir = get_ns3(options.ns3_branch)
4.71
4.72 try:
4.73 - get_regression_traces(ns3_dir)
4.74 + get_regression_traces(ns3_dir, options.regression_branch)
4.75 except CommandError:
4.76 print " *** Problem fetching regression reference traces; regression testing will not work."
4.77