~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to setup/build.py

[Uber-commit of holiday work because I lacked a local copy of the branch.]

 ivle.makeuser: Don't use jailconf.py as a header for the in-jail conf.py;
     generate the whole thing using string formatting operators and include
     the template inline.

 ivle.makeuser.make_conf_py: XXX the inclusion of ivle.conf.jail_base in
     the jail. It is simply there to placate ivle.studpath, and needs
     to go before we can entirely remove the in-jail config.

 ivle-buildjail:
   - Add. Converted from setup.buildjail.
   - Build the jail in __base_build__ and rsync it to __base__ when
     done, rather than operating only in ./jail
   - Rename --rebuildjail/-j to --recreate/-r, as the whole script
     is now for jail rebuilding. Also add a warning to the usage string about
     the large volume likely to be downloaded.
   - Check existence before removing trees.
   - Don't copy jailconf.py over conf.py in the jail. Also make
     sure that we remove conf.pyc.

 setup.configure:
   - Stop generating jailconf.py at all.
   - Add a jail_system_build setting, defaulting to __base_build__ next to
     the existing __base__.
   - Don't use an OptionParser before calling the real function, as that
     adds options dynamically.

 setup.install:
   - Add an option (-R) to avoid writing out svn revision info to
     $PREFIX/share/ivle/revision.txt.
   - Remove jail-copying things.
   - Install all services to the host, rather than just usrmgt-server. We do
     this so we can build the jail from the host without the source tree.
   - Shuffle some things, and don't install phpBB3 twice.
   - Add a --root argument, to take an alternate root directory to install
     into (as given to autotools in $DESTDIR).

 setup.build:
   - Allow running as non-root.
   - Take a --no-compile option to not byte-compile Python files.

 setup.util:
   - Include usrmgt-server in the list of services.
   - Add make_install_path(), a wrapper around os.path.join() that ensures
     the second path is relative.
   - Install ivle-buildjail with the other binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    parser.add_option("--no-compile",
44
44
        action="store_true", dest="nocompile",
45
45
        help="Don't byte-compile .py files.")
46
 
    parser.add_option("-t", "--trampoline-uids",
47
 
        action="store", dest="tuids", default="33",
48
 
        help="Comma-separated list of UIDs allowed to use trampoline. "
49
 
             "(default: 33)")
50
46
    (options, args) = parser.parse_args(args)
51
47
 
52
48
    # Call the real function
53
 
    return __build(options.dry, options.nocompile, options.tuids)
 
49
    return __build(options.dry, options.nocompile)
54
50
 
55
 
def __build(dry=False, no_compile=None, tuids=None):
 
51
def __build(dry=False, no_compile=None):
 
52
    # We need to import the one in the working copy, not in the system path.
 
53
    confmodule = __import__("ivle/conf/conf")
56
54
    install_list = util.InstallList()
57
55
 
58
56
    if dry:
59
57
        print "Dry run (no actions will be executed)\n"
60
58
 
61
 
    # Create trampoline configuration.
62
 
    conf_hfile = os.path.join(os.getcwd(), "bin/trampoline/conf.h")
63
 
    conf_h = open(conf_hfile, "w")
64
 
 
65
 
    conf_h.write("""/* IVLE Configuration File
66
 
 * conf.h
67
 
 * Administrator settings required by trampoline.
68
 
 * Note: trampoline will have to be rebuilt in order for changes to this file
69
 
 * to take effect.
70
 
 */
71
 
 
72
 
#define IVLE_AUFS_JAILS
73
 
 
74
 
/* Which user IDs are allowed to run the trampoline.
75
 
 * This list should be limited to the web server user.
76
 
 * (Note that root is an implicit member of this list).
77
 
 */
78
 
static const int allowed_uids[] = { %s };
79
 
""" % tuids)
80
 
    conf_h.close()
81
 
 
82
59
    # Compile the trampoline
83
60
    curdir = os.getcwd()
84
61
    os.chdir('bin/trampoline')
93
70
 
94
71
    # Compile .py files into .pyc or .pyo files
95
72
    if not no_compile:
 
73
        compileall.compile_dir('www', quiet=True)
96
74
        compileall.compile_dir('ivle', quiet=True)
97
75
        compileall.compile_dir('services', quiet=True)
98
76