From 772dd5eaf40b1f012df19d1cae83f47cf6aad97a Mon Sep 17 00:00:00 2001 From: Albert Date: Tue, 27 Oct 2015 16:38:58 +0100 Subject: [PATCH] Update `initialize.py` from master copy SeattleTestbed/buildscripts hosts the latest versions of the build scripts. --- scripts/initialize.py | 70 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/scripts/initialize.py b/scripts/initialize.py index 22687523..4c6241bd 100644 --- a/scripts/initialize.py +++ b/scripts/initialize.py @@ -1,23 +1,56 @@ """ initialize.py + + + August 2014. + + Albert Rafetseder + Chintan Choksi + - This script does a ``git clone'' of all the dependent repositories + This script does a "git clone" of all the dependent repositories of a Seattle component. * Clone the repository you would like to build on your machine, e.g. using - ``git clone https://github.com/SeattleTestbed/seash'' - * Change into the ``scripts'' subdirectory - * Run this script: - ``python initialize.py'' - * The dependencies will be checked out into ``../DEPENDENCIES''. + "git clone https://github.com/SeattleTestbed/seash" + + * Change into the "scripts" subdirectory + + * Run this script: "python initialize.py [-s]" + + * The dependencies will be checked out into "../DEPENDENCIES" + + *"initialize.py" will get the list of dependencies to check-out from + "config_initialize.txt" file. + + * During check-out, if there is a readme file associated with a repository, + then it will be printed on terminal. Once this is done, run the build.py + script to import the necessary files into a desired target folder. Run + build file as: "python build.py" + + The "-s" command-line option is optional, and activates skip mode. Skip + mode is useful to + + (1) Save you from re-downloading stuff that you have on your local machine + (and can copy over via "cp -R" or similar). + + (2) Test local modifications that you have in your working copy without + having to first commit them somewhere and then hack the init config, but + + Skip mode does not check whether the repos that exist in "DEPENDENCIES/" are + complete, in a working state, or are on the branch specified in + "config_initialize.txt". Consequently, while skip mode sounds like a good + thing to have if you want to pick up the initialization process again after + interrupting it, it is also pretty dangerous (as in: weird build/runtime + problems) and should be used with extreme care. While this file is redistributed with every buildable Seattle repo, - the ``master copy'' (and thus the most up-to-date version) is kept - at https://github.com/SeattleTestbed/buildscripts + the "master copy" (and thus the most up-to-date version) is kept + at: https://github.com/SeattleTestbed/buildscripts """ import subprocess @@ -25,8 +58,16 @@ import sys +# config_initialize.txt contains links to repository and the directory where it +# gets checked-out. +# E.g.: https://github.com/SeattleTestbed/seash ../DEPENDENCIES/seash config_file = open("config_initialize.txt") +if len(sys.argv) == 2 and sys.argv[1] == '-s': + ignore_git_errors = True +else: + ignore_git_errors = False + for line in config_file.readlines(): # Ignore comments and blank lines if line.startswith("#") or line.strip() == '': @@ -42,13 +83,14 @@ # to see if it performed correctly, and halt the program (giving debug # output) if not. if git_process.returncode == 0: - print "Done!" + print "Done!" else: print "*** Error checking out repo. Git returned status code", git_process.returncode print "*** Git messages on stdout: '" + stdout_data + "'." print "*** Git messages on stderr: '" + stderr_data + "'." print - print """These errors need to be fixed before the build process can proceed. In + if not ignore_git_errors: + print """Since the skip-mode is off, these errors need to be fixed before the build process can proceed. In doubt, please contact the Seattle development team at seattle-devel@googlegroups.com @@ -56,8 +98,12 @@ and supply all of the above information. Thank you! """ - sys.exit(1) - + print + sys.exit(1) + else: + print "Continuing with the cloning of directories as skip-mode is active" + print + continue # If there is a readme file, show it to the user. try: