View | Details | Raw Unified | Return to bug 489
Collapse All | Expand All

(-)a/README (-1 / +17 lines)
 Lines 16-22   repository, this directory only contains Link Here 
16
     components, including pybindgen, NSC, regression testing traces,
16
     components, including pybindgen, NSC, regression testing traces,
17
     along with cloning a ns-3 repository.  By default, the main
17
     along with cloning a ns-3 repository.  By default, the main
18
     development ns-3 branch, ns-3-dev, will be cloned, but it can be
18
     development ns-3 branch, ns-3-dev, will be cloned, but it can be
19
     overridden via the -n command line option.
19
     overridden via the -n command line option.  For example,
20
     
21
       ./download.py -n craigdo/ns-3-tap
22
23
     will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
24
     into the allinone directory.
25
26
     By default, the regression traces will be cloned from the usual
27
     http://code.nsnam.org/ns-3-dev-ref-traces into a directory
28
     ns-3-dev-ref-traces in the allinone directory.  You can override
29
     this using the -r command line option.  For example,
30
31
       ./download.py -n craigdo/ns-3-tap -r craigdo/ns-3-tap-ref-traces
32
33
     will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
34
     into the allinone directory and also clone the reference traces
35
     from the http://code.nsnam.org/craigdo/ns-3-tap-ref-traces repo.
20
36
21
  build.py:
37
  build.py:
22
38
(-)a/build.py (-4 / +5 lines)
 Lines 13-22   def build_nsc(): Link Here 
13
        run_command(['python', 'scons.py', kernel])
13
        run_command(['python', 'scons.py', kernel])
14
    
14
    
15
15
16
def build_ns3():
16
def build_ns3(regression_dir):
17
    cmd = [
17
    cmd = [
18
        "./waf", "configure",
18
        "./waf", "configure",
19
        "--with-regression-traces", os.path.join("..", constants.BRANCH + constants.REGRESSION_SUFFIX),
19
        "--with-regression-traces", os.path.join("..", regression_dir),
20
        "--with-pybindgen", os.path.join("..", constants.LOCAL_PYBINDGEN_PATH),
20
        "--with-pybindgen", os.path.join("..", constants.LOCAL_PYBINDGEN_PATH),
21
        ]
21
        ]
22
22
 Lines 46-56   def main(argv): Link Here 
46
46
47
47
48
    print "# Build NS-3"
48
    print "# Build NS-3"
49
    d = os.path.join(os.path.dirname(__file__), os.path.split(constants.BRANCH)[-1])
49
    d = os.path.join(os.path.dirname(__file__), os.path.split(constants.NS3_BRANCH)[-1])
50
    print "Entering directory `%s'" % d
50
    print "Entering directory `%s'" % d
51
    os.chdir(d)
51
    os.chdir(d)
52
    try:
52
    try:
53
        build_ns3()
53
        regression_dir = os.path.join(os.path.dirname(__file__), os.path.split(constants.REPO_BRANCH)[-1])
54
        build_ns3(regression_dir)
54
    finally:
55
    finally:
55
        os.chdir(cwd)
56
        os.chdir(cwd)
56
    print "Leaving directory `%s'" % d
57
    print "Leaving directory `%s'" % d
(-)a/constants.py (-2 / +7 lines)
 Lines 1-8    Link Here 
1
1
2
try:
2
try:
3
    BRANCH = file("BRANCH").read().strip()
3
    NS3_BRANCH = file("NS3-BRANCH").read().strip()
4
except IOError:
4
except IOError:
5
    BRANCH = None
5
    NS3_BRANCH = None
6
7
try:
8
    REPO_BRANCH = file("REPO-BRANCH").read().strip()
9
except IOError:
10
    REPO_BRANCH = None
6
11
7
NSNAM_CODE_BASE_URL = "http://code.nsnam.org/"
12
NSNAM_CODE_BASE_URL = "http://code.nsnam.org/"
8
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
13
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
(-)a/download.py (-12 / +22 lines)
 Lines 28-63   def get_ns3(ns3_branch): Link Here 
28
        run_command(['hg', '--cwd', ns3_dir, 'pull', '-u'])
28
        run_command(['hg', '--cwd', ns3_dir, 'pull', '-u'])
29
29
30
    # For future reference (e.g. build.py script), the downloaded ns3 version becomes our version
30
    # For future reference (e.g. build.py script), the downloaded ns3 version becomes our version
31
    f = file("BRANCH", "wt")
31
    f = file("NS3-BRANCH", "wt")
32
    f.write("%s\n" % ns3_branch)
32
    f.write("%s\n" % ns3_branch)
33
    f.close()
33
    f.close()
34
    return ns3_dir
34
    return ns3_dir
35
35
36
    
36
    
37
def get_regression_traces(ns3_dir):
37
def get_regression_traces(ns3_dir, regression_branch):
38
    print """
38
    print """
39
    #
39
    #
40
    # Get the regression traces
40
    # Get the regression traces
41
    #
41
    #
42
    """
42
    """
43
    regression_traces_dir_name = ns3_dir + constants.REGRESSION_SUFFIX
43
    # ns3_dir is the directory into which we cloned the repo
44
    # regression_branch is the repo in which we will find the traces.  Variations like this should work:
45
    #  ns-3-dev-ref-traces
46
    #  craigdo/ns-3-dev-ref-traces
47
    #  craigdo/ns-3-tap-ref-traces
48
    regression_traces_dir = os.path.split(regression_branch)[-1]
49
    regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch
50
44
    print "Synchronizing reference traces using Mercurial."
51
    print "Synchronizing reference traces using Mercurial."
45
    try:
52
    try:
46
        if not os.path.exists(regression_traces_dir_name):
53
        if not os.path.exists(regression_traces_dir):
47
            run_command(["hg", "clone", constants.REGRESSION_TRACES_REPO + regression_traces_dir_name, regression_traces_dir_name])
54
            run_command(["hg", "clone", regression_branch_url, regression_traces_dir])
48
        else:
55
        else:
49
            run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir_name,
56
            run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url])
50
                         constants.REGRESSION_TRACES_REPO + regression_traces_dir_name])
57
            run_command(["hg", "-q", "update", "--cwd", regression_traces_dir])
51
            run_command(["hg", "-q", "update", "--cwd", regression_traces_dir_name])
52
    except OSError: # this exception normally means mercurial is not found
58
    except OSError: # this exception normally means mercurial is not found
53
        if not os.path.exists(regression_traces_dir_name):
59
        if not os.path.exists(regression_traces_dir_name):
54
            traceball = regression_traces_dir_name + constants.TRACEBALL_SUFFIX
60
            traceball = regression_tbranch + constants.TRACEBALL_SUFFIX
55
            print "Retrieving " + traceball + " from web."
61
            print "Retrieving " + traceball + " from web."
56
            urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball)
62
            urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball)
57
            run_command(["tar", "-xjf", traceball])
63
            run_command(["tar", "-xjf", traceball])
58
            print "Done."
64
            print "Done."
59
65
60
66
    f = file("REPO-BRANCH", "wt")
67
    f.write("%s\n" % regression_branch)
68
    f.close()
61
69
62
def get_pybindgen(ns3_dir):
70
def get_pybindgen(ns3_dir):
63
    print """
71
    print """
 Lines 167-173   def main(): Link Here 
167
def main():
175
def main():
168
    parser = OptionParser()
176
    parser = OptionParser()
169
    parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
177
    parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
170
                      help="Name of the NS-3 version", metavar="BRANCH_NAME")
178
                      help="Name of the ns-3 repository", metavar="BRANCH_NAME")
179
    parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces",
180
                      help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME")
171
    (options, dummy_args) = parser.parse_args()
181
    (options, dummy_args) = parser.parse_args()
172
182
173
    # first of all, change to the directory of the script
183
    # first of all, change to the directory of the script
 Lines 176-182   def main(): Link Here 
176
    ns3_dir = get_ns3(options.ns3_branch)
186
    ns3_dir = get_ns3(options.ns3_branch)
177
187
178
    try:
188
    try:
179
        get_regression_traces(ns3_dir)
189
        get_regression_traces(ns3_dir, options.regression_branch)
180
    except CommandError:
190
    except CommandError:
181
        print " *** Problem fetching regression reference traces; regression testing will not work."
191
        print " *** Problem fetching regression reference traces; regression testing will not work."
182
192

Return to bug 489