X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=blobdiff_plain;f=builder;h=edea55936d13807e33c082cc7abeb4e6a7b3b230;hp=87a2aba850f1f553442da1bbfa813c1b8a0a61cb;hb=60450f58765da6ab187477a5cbfcb8fbd6c3b485;hpb=3aafbabcb9a988f50b7425a9df35369a7bd5eeda diff --git a/builder b/builder index 87a2aba..edea559 100755 --- a/builder +++ b/builder @@ -20,6 +20,10 @@ root_command = "fakeroot" schroot_command = "" +bz2_packages=["opensaml2", + "xmltooling", + "shibboleth/sp"] + class CommandError(exceptions.StandardError): pass @@ -68,21 +72,34 @@ def command_output(args) : def build(package): with current_directory(package): - run_cmd(('autoreconf', '-i', '-f')) - configure_command = ' '.join([ - './configure'] + configure_opts) + try: os.makedirs( "m4") + except OSError: pass + #On Centos, freeradius produces an invalid configure script + # They check in a configure script anyway so we don't need autoconf + if package != "freeradius-server": + run_cmd(('autoreconf', '-i', '-f')) + configure_command = [ + './configure'] + configure_opts if len(schroot_command) > 0: - configure_command = schroot_command + " -- " \ + configure_command = schroot_command.split(' ') \ + configure_command - print configure_command + print ' '.join(configure_command) sys.stdout.flush() - run_cmd(configure_command, shell=True) + run_cmd(configure_command, shell=False) if dist: try: os.mkdir('doc/api') except: pass - run_cmd(schroot_command +' make dist-gzip', shell=True) - run_cmd('cp *.tar.gz ' +dist_dir, shell=True) - run_cmd(schroot_command + ' make', shell=True) + #Currently freeradius's make dist is broken + if package == "freeradius-server": + run_cmd(root_command + " git archive --prefix=freeradius-server/ HEAD |gzip -9 >freeradius-server.tar.gz", shell=True) + run_cmd('cp *.tar.gz freeradius-server.spec ' +dist_dir, shell=True) + elif package in bz2_packages: + run_cmd(root_command +' make dist-bzip2', shell=True) + run_cmd('cp *.tar.bz2 ' +dist_dir, shell=True) + else: #not specially handled + run_cmd(root_command +' make dist-gzip', shell=True) + run_cmd('cp *.tar.gz ' +dist_dir, shell=True) + run_cmd(schroot_command + ' make -j3', shell=True) def make_install(package): with current_directory(package): @@ -128,27 +145,34 @@ opt.add_option( '--dist', action='store_true', default=False, dest='dist', help = 'make dist-gzip in addition to the build' ) +opt.add_option('--tar-file', + dest='tar_file', + help = 'Tar up resulting distributions in given tar file', + default = None) opt.usage = "%prog [options] [packages]" (options, packages) = opt.parse_args() prefix = options.prefix root_command = options.root_command dist = options.dist configure_opts = ['--prefix', prefix, - "LDFLAGS='-Wl,-L"+prefix+"/lib -Wl,-L/usr/lib/freeradius" - + " -Wl,-rpath="+prefix+"/lib'", - 'CPPFLAGS="-I '+prefix+'/include"', + "LDFLAGS=-Wl,-L"+prefix+"/lib -Wl,--rpath="+prefix+"/lib", + 'CPPFLAGS=-I '+prefix+'/include', '--with-system-libtool', '--with-system-libltdl', '--enable-tls', '--with-gssapi='+prefix, "--with-xmltooling="+prefix, + '--with-systemdsystemunitdir=' + prefix+'/lib/systemd', ] if options.configure_opts is not None: configure_opts.extend(options.configure_opts) +tar_file = options.tar_file +if tar_file is not None: dist = True our_schroot = None if options.schroot is not None: our_schroot = Schroot(options.schroot) - schroot_command = "schroot -r -c " + our_schroot.name - root_command = schroot_command + " -u root" + schroot_command_base = "schroot -r -c " + our_schroot.name + root_command = schroot_command_base + " -u root --" + schroot_command = schroot_command_base + ' --' all_packages = read_packages() if len(packages) == 0: packages = all_packages @@ -163,12 +187,14 @@ if dist: try: for p in all_packages: if p in packages: build(p) + if packages[-1] == p : break make_install(p) + if tar_file is not None: + with current_directory(dist_dir): + run_cmd(['tar', '-cf', tar_file, + '.']) except CommandError as c: print "Error:" + str(c.args) our_schroot = None exit(1) finally: del our_schroot - - -