Files
rpmdistro-gitoverlay/rdgo/main.in
Colin Walters a4ff7e3ca2 Add a clone operation, resolve/clone inherit basetask_resolve
I want to support two related but distinct things:

 - Performing both i386 and x86_64 builds of the same source.
   This is the base `clone` operation.
 - Testing builds of a contributed patch or github PR.  This
   requires modifying one (or more) of the sources, and hence
   is known as `--full`.

Closes: #16
Approved by: cgwalters
2016-04-26 13:47:28 +00:00

69 lines
2.2 KiB
Plaintext
Executable File

#!@PYTHON@
#
# Copyright (C) 2015 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
import os
import sys
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
else:
datadir = "@datarootdir@"
if sys.version_info[0] < 3:
import __builtin__
__builtin__.__dict__['DATADIR'] = datadir
__builtin__.__dict__['PKGLIBDIR'] = '@pkglibdir@'
else:
import builtins
builtins.__dict__['DATADIR'] = datadir
builtins.__dict__['PKGLIBDIR'] = '@pkglibdir@'
# This is a private directory, we don't want to pollute the global
# namespace.
path = os.path.join('@pkglibdir@')
sys.path.insert(0, path)
from rdgo import task_init, task_resolve, task_build, task_clone
commands = {
"init" : [lambda: task_init.TaskInit(), "Initialize the directory"],
"build" : [lambda: task_build.TaskBuild(), "Build the packages"],
"resolve" : [lambda: task_resolve.TaskResolve(), "Perform a git mirror"],
"clone" : [lambda: task_clone.TaskClone(), "Create a new build directory, sharing source"],
}
def usage(iserr):
stream = sys.stderr if iserr else sys.stdout
stream.write("Builtins:\n")
for i, j in commands.items():
stream.write("%s: %s\n" % (i, j[1]))
sys.exit(1 if iserr else 0)
def main():
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
usage(False)
cmd = commands.get(sys.argv.pop(1))
if cmd is None:
sys.stderr.write("""Unknown argument: %s\n""" % (cmd, ))
usage(True)
else:
cmd[0]().run(sys.argv[1:])
if __name__ == '__main__':
main()
pass