# HG changeset patch # User Craig Dowell # Date 1233853769 28800 # Node ID ac3f284ebb49d9f785554f3ae876b87871b95e50 # Parent e66511bca0cc3cb95883f29daf7dfa71a67b479b suggested changes for allinone diff -r e66511bca0cc -r ac3f284ebb49 README --- a/README Sat Jan 24 16:00:50 2009 +0000 +++ b/README Thu Feb 05 09:09:29 2009 -0800 @@ -16,7 +16,23 @@ repository, this directory only contains components, including pybindgen, NSC, regression testing traces, along with cloning a ns-3 repository. By default, the main development ns-3 branch, ns-3-dev, will be cloned, but it can be - overridden via the -n command line option. + overridden via the -n command line option. For example, + + ./download.py -n craigdo/ns-3-tap + + will clone the repository http://code.nsnam.org/craigdo/ns-3-tap + into the allinone directory. + + By default, the regression traces will be cloned from the usual + http://code.nsnam.org/ns-3-dev-ref-traces into a directory + ns-3-dev-ref-traces in the allinone directory. You can override + this using the -r command line option. For example, + + ./download.py -n craigdo/ns-3-tap -r craigdo/ns-3-tap-ref-traces + + will clone the repository http://code.nsnam.org/craigdo/ns-3-tap + into the allinone directory and also clone the reference traces + from the http://code.nsnam.org/craigdo/ns-3-tap-ref-traces repo. build.py: diff -r e66511bca0cc -r ac3f284ebb49 build.py --- a/build.py Sat Jan 24 16:00:50 2009 +0000 +++ b/build.py Thu Feb 05 09:09:29 2009 -0800 @@ -13,10 +13,10 @@ def build_nsc(): run_command(['python', 'scons.py', kernel]) -def build_ns3(): +def build_ns3(regression_dir): cmd = [ "./waf", "configure", - "--with-regression-traces", os.path.join("..", constants.BRANCH + constants.REGRESSION_SUFFIX), + "--with-regression-traces", os.path.join("..", regression_dir), "--with-pybindgen", os.path.join("..", constants.LOCAL_PYBINDGEN_PATH), ] @@ -46,11 +46,12 @@ def main(argv): print "# Build NS-3" - d = os.path.join(os.path.dirname(__file__), os.path.split(constants.BRANCH)[-1]) + d = os.path.join(os.path.dirname(__file__), os.path.split(constants.NS3_BRANCH)[-1]) print "Entering directory `%s'" % d os.chdir(d) try: - build_ns3() + regression_dir = os.path.join(os.path.dirname(__file__), os.path.split(constants.REPO_BRANCH)[-1]) + build_ns3(regression_dir) finally: os.chdir(cwd) print "Leaving directory `%s'" % d diff -r e66511bca0cc -r ac3f284ebb49 constants.py --- a/constants.py Sat Jan 24 16:00:50 2009 +0000 +++ b/constants.py Thu Feb 05 09:09:29 2009 -0800 @@ -1,8 +1,13 @@ try: - BRANCH = file("BRANCH").read().strip() + NS3_BRANCH = file("NS3-BRANCH").read().strip() except IOError: - BRANCH = None + NS3_BRANCH = None + +try: + REPO_BRANCH = file("REPO-BRANCH").read().strip() +except IOError: + REPO_BRANCH = None NSNAM_CODE_BASE_URL = "http://code.nsnam.org/" PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen' diff -r e66511bca0cc -r ac3f284ebb49 download.py --- a/download.py Sat Jan 24 16:00:50 2009 +0000 +++ b/download.py Thu Feb 05 09:09:29 2009 -0800 @@ -28,36 +28,44 @@ def get_ns3(ns3_branch): run_command(['hg', '--cwd', ns3_dir, 'pull', '-u']) # For future reference (e.g. build.py script), the downloaded ns3 version becomes our version - f = file("BRANCH", "wt") + f = file("NS3-BRANCH", "wt") f.write("%s\n" % ns3_branch) f.close() return ns3_dir -def get_regression_traces(ns3_dir): +def get_regression_traces(ns3_dir, regression_branch): print """ # # Get the regression traces # """ - regression_traces_dir_name = ns3_dir + constants.REGRESSION_SUFFIX + # ns3_dir is the directory into which we cloned the repo + # regression_branch is the repo in which we will find the traces. Variations like this should work: + # ns-3-dev-ref-traces + # craigdo/ns-3-dev-ref-traces + # craigdo/ns-3-tap-ref-traces + regression_traces_dir = os.path.split(regression_branch)[-1] + regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch + print "Synchronizing reference traces using Mercurial." try: - if not os.path.exists(regression_traces_dir_name): - run_command(["hg", "clone", constants.REGRESSION_TRACES_REPO + regression_traces_dir_name, regression_traces_dir_name]) + if not os.path.exists(regression_traces_dir): + run_command(["hg", "clone", regression_branch_url, regression_traces_dir]) else: - run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir_name, - constants.REGRESSION_TRACES_REPO + regression_traces_dir_name]) - run_command(["hg", "-q", "update", "--cwd", regression_traces_dir_name]) + run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url]) + run_command(["hg", "-q", "update", "--cwd", regression_traces_dir]) except OSError: # this exception normally means mercurial is not found if not os.path.exists(regression_traces_dir_name): - traceball = regression_traces_dir_name + constants.TRACEBALL_SUFFIX + traceball = regression_tbranch + constants.TRACEBALL_SUFFIX print "Retrieving " + traceball + " from web." urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball) run_command(["tar", "-xjf", traceball]) print "Done." - + f = file("REPO-BRANCH", "wt") + f.write("%s\n" % regression_branch) + f.close() def get_pybindgen(ns3_dir): print """ @@ -167,7 +175,9 @@ def main(): def main(): parser = OptionParser() parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev", - help="Name of the NS-3 version", metavar="BRANCH_NAME") + help="Name of the ns-3 repository", metavar="BRANCH_NAME") + parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces", + help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME") (options, dummy_args) = parser.parse_args() # first of all, change to the directory of the script @@ -176,7 +186,7 @@ def main(): ns3_dir = get_ns3(options.ns3_branch) try: - get_regression_traces(ns3_dir) + get_regression_traces(ns3_dir, options.regression_branch) except CommandError: print " *** Problem fetching regression reference traces; regression testing will not work."