--- a/constants.py Wed Jun 19 09:18:52 2013 -0700
+++ b/constants.py Sun Aug 25 18:08:32 2013 -0700
@@ -15,3 +15,6 @@
NETANIM_RELEASE_URL = "http://www.nsnam.org/tools/netanim"
LOCAL_NETANIM_PATH = "netanim"
+
+# bake
+BAKE_REPO = "http://code.nsnam.org/bake"
--- a/dist.py Wed Jun 19 09:18:52 2013 -0700
+++ b/dist.py Sun Aug 25 18:08:32 2013 -0700
@@ -137,6 +137,24 @@
print "Adding %s as %s" % (netanim_dir, os.path.join(dist_dir, new_netanim_dir))
tar_add_tree(tar, netanim_dir, os.path.join(dist_dir, new_netanim_dir), dir_excl, file_excl)
+ # add bake
+ bake_dir = config.getElementsByTagName("bake")[0].getAttribute("dir");
+ new_bake_dir = config.getElementsByTagName("bake")[0].getAttribute("version")
+ assert new_bake_dir.startswith("bake")
+ new_config.getElementsByTagName("bake")[0].setAttribute("dir", new_bake_dir)
+ def dir_excl(reldirpath, dirname):
+ if dirname[0] == '.':
+ return True
+ return False
+ def file_excl(reldirpath, filename):
+ if filename.startswith('.'):
+ return True
+ if filename.endswith('~'):
+ return True
+ return False
+ print "Adding %s as %s" % (bake_dir, os.path.join(dist_dir, new_bake_dir))
+ tar_add_tree(tar, bake_dir, os.path.join(dist_dir, new_bake_dir), dir_excl, file_excl)
+
# add the build script files
print "Adding the build script files"
for filename in ["build.py", "constants.py", "util.py", "README"]:
--- a/download.py Wed Jun 19 09:18:52 2013 -0700
+++ b/download.py Sun Aug 25 18:08:32 2013 -0700
@@ -151,6 +151,30 @@
return (constants.LOCAL_NETANIM_PATH, required_netanim_version)
+def get_bake(ns3_dir):
+ print """
+ #
+ # Get bake
+ #
+ """
+
+ def bake_clone():
+ print "Retrieving bake from " + constants.BAKE_REPO
+ run_command(['hg', 'clone', constants.BAKE_REPO])
+ def bake_download():
+ # Bake does not provide download tarballs; clone instead
+ bake_clone()
+
+ def bake_update():
+ print "Pulling bake updates from " + constants.BAKE_REPO
+ run_command(['hg', '--cwd', 'bake', 'pull', '-u', constants.BAKE_REPO])
+
+ if not os.path.exists(os.path.join(ns3_dir, '.hg')):
+ bake_download()
+ elif not os.path.exists('bake'):
+ bake_clone()
+ else:
+ bake_update()
def main():
parser = OptionParser()
@@ -192,6 +216,16 @@
netanim_config.setAttribute("dir", netanim_dir)
netanim_config.setAttribute("version", netanim_version)
+ # -- download bake --
+ try:
+ get_bake(ns3_dir)
+ except (CommandError, IOError, RuntimeError):
+ print " *** Did not fetch bake build tool."
+ else:
+ bake_config = config.documentElement.appendChild(config.createElement("bake"))
+ bake_config.setAttribute("dir", "bake")
+ bake_config.setAttribute("version", "bake")
+
# write the config to a file
dot_config = open(".config", "wt")
config.writexml(dot_config, addindent=" ", newl="\n")