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

(-)ns-3-allinone/build.py (-9 lines)
 Lines 22-36    Link Here 
22
        ]
22
        ]
23
23
24
    try:
24
    try:
25
        ns3_traces, = config.getElementsByTagName("ns-3-traces")
26
    except ValueError:
27
        print "Note: configuring ns-3 without regression traces"
28
    else:
29
        cmd.extend([
30
                "--with-regression-traces", os.path.join("..", ns3_traces.getAttribute("dir")),
31
                ])
32
33
    try:
34
        pybindgen, = config.getElementsByTagName("pybindgen")
25
        pybindgen, = config.getElementsByTagName("pybindgen")
35
    except ValueError:
26
    except ValueError:
36
        print "Note: configuring ns-3 without pybindgen"
27
        print "Note: configuring ns-3 without pybindgen"
(-)ns-3-allinone/constants.py (-32 lines)
 Lines 3-40    Link Here 
3
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
3
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
4
LOCAL_PYBINDGEN_PATH = 'pybindgen'
4
LOCAL_PYBINDGEN_PATH = 'pybindgen'
5
5
6
#
7
# The directory in which the tarball of the reference traces lives.  This is
8
# used if Mercurial is not on the system.
9
#
10
REGRESSION_TRACES_URL = "http://www.nsnam.org/releases/"
11
12
#
13
# The path to the Mercurial repository used to find the reference traces if
14
# we find "hg" on the system.  We expect that the repository will be named
15
# identically to refDirName below
16
#
17
REGRESSION_TRACES_REPO = "http://code.nsnam.org/"
18
19
#
20
# Name of the local directory where the regression code lives.
21
#
22
REGRESSION_DIR = "regression"
23
24
#
25
# The last part of the path name to use to find the regression traces.  The
26
# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX, e.g.,
27
# ns-3-dev-ref-traces
28
#
29
REGRESSION_SUFFIX = "-ref-traces"
30
31
#
32
# The last part of the path name to use to find the regression traces tarball.
33
# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX,
34
# e.g., ns-3-dev-ref-traces.tar.bz2
35
#
36
TRACEBALL_SUFFIX = ".tar.bz2"
37
38
# network simulation cradle
6
# network simulation cradle
39
NSC_REPO = "https://secure.wand.net.nz/mercurial/nsc"
7
NSC_REPO = "https://secure.wand.net.nz/mercurial/nsc"
40
NSC_RELEASE_URL = "http://research.wand.net.nz/software/nsc"
8
NSC_RELEASE_URL = "http://research.wand.net.nz/software/nsc"
(-)ns-3-allinone/dist.py (-16 lines)
 Lines 112-133    Link Here 
112
112
113
113
114
114
115
    # add regression traces
116
    traces_dir = config.getElementsByTagName("ns-3-traces")[0].getAttribute("dir")
117
    new_traces_dir = "ns-%s-ref-traces" % ns3_version
118
    new_config.getElementsByTagName("ns-3-traces")[0].setAttribute("dir", new_traces_dir)    
119
    def dir_excl(reldirpath, dirname):
120
        if dirname[0] == '.':
121
            return True
122
        return False
123
    def file_excl(reldirpath, filename):
124
        if filename.startswith('.'):
125
            return True
126
        return False
127
    print "Adding %s as %s" % (traces_dir, os.path.join(dist_dir, new_traces_dir))
128
    tar_add_tree(tar, traces_dir, os.path.join(dist_dir, new_traces_dir), dir_excl, file_excl)
129
130
131
    # add network simulation cradle
115
    # add network simulation cradle
132
    nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("dir")
116
    nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("dir")
133
    new_nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("version")
117
    new_nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("version")
(-)ns-3-allinone/download.py (-44 lines)
 Lines 31-68    Link Here 
31
    return ns3_dir
31
    return ns3_dir
32
32
33
    
33
    
34
def get_regression_traces(ns3_dir, regression_branch):
35
    print """
36
    #
37
    # Get the regression traces
38
    #
39
    """
40
    # ns3_dir is the directory into which we cloned the repo
41
    # regression_branch is the repo in which we will find the traces.  Variations like this should work:
42
    #  ns-3-dev-ref-traces
43
    #  craigdo/ns-3-dev-ref-traces
44
    #  craigdo/ns-3-tap-ref-traces
45
    regression_traces_dir = os.path.split(regression_branch)[-1]
46
    regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch
47
48
    print "Synchronizing reference traces using Mercurial."
49
    try:
50
        if not os.path.exists(regression_traces_dir):
51
            run_command(["hg", "clone", regression_branch_url, regression_traces_dir])
52
        else:
53
            run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url])
54
            run_command(["hg", "-q", "update", "--cwd", regression_traces_dir])
55
    except OSError: # this exception normally means mercurial is not found
56
        if not os.path.exists(regression_traces_dir_name):
57
            traceball = regression_tbranch + constants.TRACEBALL_SUFFIX
58
            print "Retrieving " + traceball + " from web."
59
            urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball)
60
            run_command(["tar", "-xjf", traceball])
61
            print "Done."
62
63
    return regression_traces_dir
64
65
66
def get_pybindgen(ns3_dir):
34
def get_pybindgen(ns3_dir):
67
    print """
35
    print """
68
    #
36
    #
 Lines 184-191    Link Here 
184
    parser = OptionParser()
152
    parser = OptionParser()
185
    parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
153
    parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
186
                      help="Name of the ns-3 repository", metavar="BRANCH_NAME")
154
                      help="Name of the ns-3 repository", metavar="BRANCH_NAME")
187
    parser.add_option("-r", "--regression-branch", dest="regression_branch", default="ns-3-dev-ref-traces",
188
                      help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME")
189
    (options, dummy_args) = parser.parse_args()
155
    (options, dummy_args) = parser.parse_args()
190
156
191
    # first of all, change to the directory of the script
157
    # first of all, change to the directory of the script
 Lines 202-217    Link Here 
202
    ns3_config.setAttribute("dir", ns3_dir)
168
    ns3_config.setAttribute("dir", ns3_dir)
203
    ns3_config.setAttribute("branch", options.ns3_branch)
169
    ns3_config.setAttribute("branch", options.ns3_branch)
204
170
205
    # -- download regression reference traces for NS-3 --
206
    try:
207
        traces_dir = get_regression_traces(ns3_dir, options.regression_branch)
208
    except CommandError:
209
        print " *** Did not fetch regression reference traces; regression testing will not be available."
210
    else:
211
        traces_config = config.documentElement.appendChild(config.createElement("ns-3-traces"))
212
        traces_config.setAttribute("dir", traces_dir)
213
        traces_config.setAttribute("branch", options.regression_branch)
214
215
    # -- download pybindgen --
171
    # -- download pybindgen --
216
    try:
172
    try:
217
        pybindgen_dir, pybindgen_version = get_pybindgen(ns3_dir)
173
        pybindgen_dir, pybindgen_version = get_pybindgen(ns3_dir)
(-)ns-3-allinone/README (-16 / +5 lines)
 Lines 13-41    Link Here 
13
  download.py:
13
  download.py:
14
   
14
   
15
     This script will take care of downloading all necessary
15
     This script will take care of downloading all necessary
16
     components, including pybindgen, NSC, regression testing traces,
16
     components, including pybindgen and NSC, along with cloning an
17
     along with cloning a ns-3 repository.  By default, the main
17
     ns-3 repository.  By default, the main development ns-3 branch,
18
     development ns-3 branch, ns-3-dev, will be cloned, but it can be
18
     ns-3-dev, will be cloned, but it can be overridden via the -n
19
     overridden via the -n command line option.  For example,
19
     command line option.  For example,
20
     
20
     
21
       ./download.py -n craigdo/ns-3-tap
21
       ./download.py -n craigdo/ns-3-tap
22
22
23
     will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
23
     will clone the repository http://code.nsnam.org/craigdo/ns-3-tap
24
     into the allinone directory.
24
     into the allinone directory.
25
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.
36
37
  build.py:
26
  build.py:
38
27
39
     This script will be all external components that need to be
28
     This script will get all external components that need to be
40
     built, and then will build ns-3 using the downloaded components.
29
     built, and then will build ns-3 using the downloaded components.
41
30

Return to bug 791