コード例 #1
0
ファイル: buildsdk.py プロジェクト: Linutronix/elbe
def run_command(argv):
    oparser = OptionParser(
        usage="usage: %prog buildsdk [options] <builddir>")
    oparser.add_option("--skip-validation", action="store_true",
                       dest="skip_validation", default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--buildtype", dest="buildtype",
                       help="Override the buildtype")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    try:
        project = ElbeProject(args[0], override_buildtype=opt.buildtype,
                              skip_validate=opt.skip_validation)
    except ValidationError as e:
        print(str(e))
        print("xml validation failed. Bailing out")
        sys.exit(20)

    project.build_sdk()
コード例 #2
0
def run_command(argv):
    oparser = OptionParser(
        usage="usage: %prog buildsysroot [options] <builddir>")
    oparser.add_option("--skip-validation",
                       action="store_true",
                       dest="skip_validation",
                       default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--buildtype",
                       dest="buildtype",
                       help="Override the buildtype")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    with elbe_logging({"streams": sys.stdout}):
        try:
            project = ElbeProject(args[0],
                                  override_buildtype=opt.buildtype,
                                  skip_validate=opt.skip_validation)
        except ValidationError:
            logging.exception("XML validation failed.  Bailing out")
            sys.exit(20)

        project.build_sysroot()
コード例 #3
0
ファイル: chroot.py プロジェクト: AndreySV/elbe
def run_command(argv):
    oparser = OptionParser(
        usage="usage: %prog chroot [options] <builddir> [cmd]")
    oparser.add_option("--skip-validation",
                       action="store_true",
                       dest="skip_validation",
                       default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--target",
                       action="store_true",
                       dest="target",
                       help="chroot into target instead of buildenv",
                       default=False)
    oparser.add_option("--buildtype",
                       dest="buildtype",
                       help="Override the buildtype")

    (opt, args) = oparser.parse_args(argv)

    if len(args) < 1:
        print("wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    try:
        project = ElbeProject(args[0],
                              override_buildtype=opt.buildtype,
                              skip_validate=opt.skip_validation,
                              url_validation=ValidationMode.NO_CHECK)
    except ValidationError as e:
        print(str(e))
        print("xml validation failed. Bailing out")
        sys.exit(20)

    os.environ["LANG"] = "C"
    os.environ["LANGUAGE"] = "C"
    os.environ["LC_ALL"] = "C"
    # TODO: howto set env in chroot?
    os.environ["PS1"] = project.xml.text('project/name') + ': \w\$'

    cmd = "/bin/bash"

    if len(args) > 1:
        cmd = ""
        cmd2 = args[1:]
        for c in cmd2:
            cmd += (c + " ")

    if opt.target:
        try:
            with project.targetfs:
                system("/usr/sbin/chroot %s %s" % (project.targetpath, cmd))
        except CommandError as e:
            print(repr(e))
    else:
        try:
            with project.buildenv:
                system("/usr/sbin/chroot %s %s" % (project.chrootpath, cmd))
        except CommandError as e:
            print(repr(e))
コード例 #4
0
def run_command(argv):
    oparser = OptionParser(usage="usage: %prog genlicence [options] <project>")
    oparser.add_option("--output", dest="output", help="outputfilename")
    oparser.add_option("--xml",
                       dest="xml",
                       default=None,
                       help="xml outputfilename")
    oparser.add_option("--buildtype",
                       dest="buildtype",
                       help="Override the buildtype")
    oparser.add_option("--skip-validation",
                       action="store_true",
                       dest="skip_validation",
                       default=False,
                       help="Skip xml schema validation")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    with elbe_logging({"streams": sys.stdout}):
        try:
            project = ElbeProject(args[0],
                                  override_buildtype=opt.buildtype,
                                  skip_validate=opt.skip_validation,
                                  url_validation=ValidationMode.NO_CHECK)
        except ValidationError:
            logging.exception("XML validation failed.  Bailing out")
            sys.exit(20)

        if opt.output:
            f = io.open(opt.output, "w+", encoding='utf-8')
        else:
            f = io.open('licence.txt', "w+", encoding='utf-8')

        pkglist = project.get_rpcaptcache().get_installed_pkgs()
        pkgnames = [p.name for p in pkglist]

        project.buildenv.rfs.write_licenses(f, pkgnames, opt.xml)
        f.close()
コード例 #5
0
ファイル: hdimg.py プロジェクト: lwalewski/elbe
def run_command( argv ):

    oparser = OptionParser( usage="usage: %prog hdimg --target <dir> --output <out> <xmlfile>")
    oparser.add_option( "--target", dest="target",
                        help="target directory",
                        metavar="FILE" )
    oparser.add_option( "-o", "--output", dest="output",
                        help="name of logfile" )
    oparser.add_option( "--buildtype", dest="buildtype",
                        help="Override the buildtype" )
    oparser.add_option( "--skip-validation", action="store_true",
                        dest="skip_validation", default=False,
                        help="Skip xml schema validation" )
    oparser.add_option( "--skip-grub", action="store_true",
                        dest="skip_grub", default=False,
                        help="Skip grub install" )
    oparser.add_option( "--grub-version", type="int",
                        dest="grub_version", default=202,
                        help="use specific grub version (possible values are 0, 199 and 202)" )

    (opt,args) = oparser.parse_args(argv)

    if len(args) != 1:
        print "Wrong number of arguments"
        oparser.print_help()
        sys.exit(20)

    if not opt.target:
        print "No directory specified!"
        oparser.print_help()
        sys.exit(20)

    if not opt.output:
        print "No Log output"
        oparser.print_help()
        sys.exit(20)

    if opt.skip_grub:
        opt.grub_version = 0

    if opt.grub_version not in [0,199,202]:
        print "invalid grub version"
        oparser.print_help()
        sys.exit(20)

    try:
        project = ElbeProject( opt.target, override_buildtype=opt.buildtype,
                xmlpath=args[0], logpath=opt.output,
                skip_validate=opt.skip_validation )
    except ValidationError as e:
        print str(e)
        print "xml validation failed. Bailing out"
        sys.exit(20)

    project.targetfs.part_target(opt.target, opt.grub_version)
コード例 #6
0
    def load_project(self,
                     builddir,
                     logpath=None,
                     url_validation=ValidationMode.CHECK_ALL):

        # pass exceptions if hook-scripts can't be loaded (they're optional)
        postbuild_file = None
        try:
            postbuild = self.get_project_file(builddir, 'postbuild.sh')
            postbuild_file = postbuild.builddir + '/' + postbuild.name
        except ElbeDBError:
            pass

        presh_file = None
        try:
            presh_handle = self.get_project_file(builddir, 'pre.sh')
            presh_file = presh_handle.builddir + '/' + presh_handle.name
        except ElbeDBError:
            pass

        postsh_file = None
        try:
            postsh_handle = self.get_project_file(builddir, 'post.sh')
            postsh_file = postsh_handle.builddir + '/' + postsh_handle.name
        except ElbeDBError:
            pass

        savesh_file = None
        try:
            savesh_handle = self.get_project_file(builddir, 'save.sh')
            savesh_file = savesh_handle.builddir + '/' + savesh_handle.name
        except ElbeDBError:
            pass

        with session_scope(self.session) as s:
            try:
                p = s.query(Project). \
                    filter(Project.builddir == builddir).one()

                return ElbeProject(p.builddir,
                                   name=p.name,
                                   logpath=logpath,
                                   postbuild_file=postbuild_file,
                                   presh_file=presh_file,
                                   postsh_file=postsh_file,
                                   savesh_file=savesh_file,
                                   url_validation=url_validation)
            except NoResultFound:
                raise ElbeDBError(
                    "project %s is not registered in the database" % builddir)
コード例 #7
0
def run_command( argv ):
    oparser = OptionParser(usage="usage: %prog gen_update [options] [xmlfile]")
    oparser.add_option( "-t", "--target", dest="target",
                        help="directoryname of target" )
    oparser.add_option( "-o", "--output", dest="output",
                        help="filename of the update package" )
    oparser.add_option( "-n", "--name", dest="name",
                        help="name of the project (included in the report)" )
    oparser.add_option( "-p", "--pre-sh", dest="presh_file",
                        help="script that is executed before the update will be applied" )
    oparser.add_option( "-P", "--post-sh", dest="postsh_file",
                        help="script that is executed after the update was applied" )
    oparser.add_option( "-c", "--cfg-dir", dest="cfg_dir",
                        help="files that are copied to target" )
    oparser.add_option( "-x", "--cmd-dir", dest="cmd_dir",
                        help="scripts that are executed on the target" )
    oparser.add_option( "--skip-validation", action="store_true",
                        dest="skip_validation", default=False,
                        help="Skip xml schema validation" )
    oparser.add_option( "--buildtype", dest="buildtype",
                        help="Override the buildtype" )
    oparser.add_option( "--debug", action="store_true", dest="debug",
                        default=False,
                        help="Enable various features to debug the build" )

    (opt,args) = oparser.parse_args(argv)

    if len(args) != 1:
        if not opt.cfg_dir and not opt.cmd_dir:
            oparser.print_help()
            sys.exit(20)

    if len(args) == 1 and not opt.target:
        print "No target specified"
        sys.exit(20)

    if not opt.output:
        print "No output file specified"
        sys.exit(20)

    if opt.buildtype:
        buildtype = opt.buildtype
    else:
        buildtype = None

    try:
        project = ElbeProject (opt.target, name=opt.name,
                override_buildtype=buildtype,
                skip_validate=opt.skip_validation)
    except ValidationError as e:
        print str(e)
        print "xml validation failed. Bailing out"
        sys.exit(20)

    if opt.presh_file:
        try:
            project.presh_file = open (opt.presh_file)
        except IOError as e:
            print 'pre.sh file invalid: %s' % str (e)
            sys.exit(20)

    if opt.postsh_file:
        try:
            project.postsh_file = open (opt.postsh_file)
        except IOError as e:
            print 'post.sh file invalid: %s' % str (e)
            sys.exit(20)

    update_xml = None
    if len(args) >= 1:
        update_xml = args[ 0 ]

    try:
        gen_update_pkg( project, update_xml, opt.output, buildtype,
                opt.skip_validation, opt.debug,
                cfg_dir = opt.cfg_dir, cmd_dir = opt.cmd_dir )

    except ValidationError as e:
        print str(e)
        print "xml validation failed. Bailing out"
        sys.exit(20)
    except MissingData as e:
        print str(e)
        sys.exit(20)

    if project.postsh_file:
        project.postsh_file.close ()

    if project.presh_file:
        project.presh_file.close ()
コード例 #8
0
ファイル: mkcdrom.py プロジェクト: koberbe/elbe
def run_command(argv):

    # pylint disable=too-many-statements

    oparser = OptionParser(usage="usage: %prog mkcdrom [options] <builddir>")
    oparser.add_option("--skip-validation",
                       action="store_true",
                       dest="skip_validation",
                       default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--buildtype",
                       dest="buildtype",
                       help="Override the buildtype")
    oparser.add_option("--arch", dest="arch", help="Override the architecture")
    oparser.add_option("--codename",
                       dest="codename",
                       help="Override the codename")
    oparser.add_option("--init_codename",
                       dest="init_codename",
                       help="Override the initvm codename")
    oparser.add_option("--rfs-only",
                       action="store_true",
                       dest="rfs_only",
                       default=False,
                       help="builddir points to RFS")
    oparser.add_option("--log", dest="log", help="Log to filename")
    oparser.add_option("--binary",
                       action="store_true",
                       dest="binary",
                       default=False,
                       help="build binary cdrom")
    oparser.add_option("--source",
                       action="store_true",
                       dest="source",
                       default=False,
                       help="build source cdrom")
    oparser.add_option("--cdrom-size",
                       action="store",
                       dest="cdrom_size",
                       default=CDROM_SIZE,
                       help="Source ISO CD size in bytes")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("wrong number of arguments", file=sys.stderr)
        oparser.print_help()
        sys.exit(20)

    with elbe_logging({"files": opt.log}):

        if not opt.rfs_only:
            try:
                project = ElbeProject(args[0],
                                      override_buildtype=opt.buildtype,
                                      skip_validate=opt.skip_validation)
            except ValidationError:
                logging.exception("XML validation failed.  Bailing out")
                sys.exit(20)

            builddir = project.builddir
            rfs = project.buildenv.rfs
            xml = project.xml
            arch = xml.text("project/arch", key="arch")
            codename = xml.text("project/suite")
            init_codename = xml.get_initvm_codename()
        else:
            builddir = os.path.abspath(os.path.curdir)
            rfs = ChRootFilesystem(args[0])
            arch = opt.arch
            codename = opt.codename
            init_codename = opt.init_codename
            xml = None

        generated_files = []
        if opt.source:
            with rfs:
                cache = get_rpcaptcache(rfs, arch)
                components = {
                    "main":
                    (rfs, cache, cache.get_corresponding_source_packages())
                }
                generated_files += mk_source_cdrom(components, codename,
                                                   init_codename, builddir,
                                                   opt.cdrom_size)

        if opt.binary:
            with rfs:
                generated_files += mk_binary_cdrom(rfs, arch, codename,
                                                   init_codename, xml,
                                                   builddir)

        logging.info("Image Build finished.")
        logging.info("Files generated:\n%s",
                     "\n".join([str(f) for f in generated_files]))
コード例 #9
0
def run_command( argv ):
    oparser = OptionParser(usage="usage: %prog buildchroot [options] <xmlfile>")

    oparser.add_option( "-t", "--target", dest="target",
                        help="directoryname of target" )

    oparser.add_option( "-o", "--output", dest="output",
                        help="name of logfile" )

    oparser.add_option( "-n", "--name", dest="name",
                        help="name of the project (included in the report)" )

    oparser.add_option( "--skip-pbuild", action="store_true",
                        dest="skip_pbuild", default=False,
                        help="skip building packages from <pbuilder> list" )

    oparser.add_option( "--build-bin", action="store_true",
                        dest="build_bin", default=False,
                        help="Build Binary Repository CDROM, for exact Reproduction" )

    oparser.add_option( "--build-sources", action="store_true",
                        dest="build_sources", default=False,
                        help="Build Source CD" )

    oparser.add_option( "--proxy", dest="proxy",
                        help="Override the http proxy" )

    oparser.add_option( "--debug", action="store_true", dest="debug",
                        default=False,
                        help="Enable various features to debug the build" )

    oparser.add_option( "--buildtype", dest="buildtype",
                        help="Override the buildtype" )

    oparser.add_option( "--cdrom-size", action="store",
                        dest="cdrom_size", default=CDROM_SIZE, help="ISO CD size in MB" )

    oparser.add_option( "--skip-validation", action="store_true",
                        dest="skip_validation", default=False,
                        help="Skip xml schema validation" )

    oparser.add_option( "--skip-debootstrap", action="store_true",
                        dest="skip_debootstrap", default=False,
                        help="Skip debootstrap" )

    oparser.add_option( "--skip-pkglist", action="store_true",
                        dest="skip_pkglist", default=False,
                        help="ignore changes of the package list" )

    oparser.add_option( "--skip-cdrom", action="store_true",
                        dest="skip_cdrom", default=False,
                        help="(now obsolete) Skip cdrom iso generation" )

    (opt,args) = oparser.parse_args(argv)

    if len(args) != 1:
        print "wrong number of arguments"
        oparser.print_help()
        sys.exit(20)

    if not opt.target:
        print "No target specified"
        sys.exit(20)

    if opt.skip_cdrom:
        print "WARNING: Skip CDROMS is now the default, use --build-bin to build binary CDROM"

    try:
        project = ElbeProject( opt.target, args[0], opt.output, opt.name,
                opt.buildtype, opt.skip_validation )
    except ValidationError as e:
        print str(e)
        print "xml validation failed. Bailing out"
        sys.exit(20)

    try:
        project.build( opt.skip_debootstrap, opt.build_bin,
                opt.build_sources, opt.cdrom_size, opt.debug, opt.skip_pkglist,
                opt.skip_pbuild )
    except CommandError as ce:
        print "command in project build failed:", ce.cmd
        sys.exit(20)

    try:
        db = ElbeDB()
        db.save_project (project)
    except OperationalError:
        print "failed to save project in database"
        sys.exit(20)
コード例 #10
0
def run_command(argv):

    # pylint: disable=too-many-statements
    # pylint: disable=too-many-branches

    oparser = OptionParser(usage="usage: %prog gen_update [options] [xmlfile]")
    oparser.add_option("-t", "--target", dest="target",
                       help="directoryname of target")
    oparser.add_option("-o", "--output", dest="output",
                       help="filename of the update package")
    oparser.add_option("-n", "--name", dest="name",
                       help="name of the project (included in the report)")
    oparser.add_option(
        "-p",
        "--pre-sh",
        dest="presh_file",
        help="script that is executed before the update will be applied")
    oparser.add_option(
        "-P",
        "--post-sh",
        dest="postsh_file",
        help="script that is executed after the update was applied")
    oparser.add_option("-c", "--cfg-dir", dest="cfg_dir",
                       help="files that are copied to target")
    oparser.add_option("-x", "--cmd-dir", dest="cmd_dir",
                       help="scripts that are executed on the target")
    oparser.add_option("--skip-validation", action="store_true",
                       dest="skip_validation", default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--buildtype", dest="buildtype",
                       help="Override the buildtype")
    oparser.add_option("--debug", action="store_true", dest="debug",
                       default=False,
                       help="Enable various features to debug the build")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        if not opt.cfg_dir and not opt.cmd_dir:
            oparser.print_help()
            sys.exit(20)

    if len(args) == 1 and not opt.target:
        print("No target specified")
        sys.exit(20)

    if not opt.output:
        print("No output file specified")
        sys.exit(20)

    if opt.buildtype:
        buildtype = opt.buildtype
    else:
        buildtype = None

    with elbe_logging({"streams":sys.stdout}):
        try:
            project = ElbeProject(opt.target, name=opt.name,
                                  override_buildtype=buildtype,
                                  skip_validate=opt.skip_validation)
        except ValidationError:
            logging.exception("XML validation failed.  Bailing out")
            sys.exit(20)

    if opt.presh_file:
        if not os.path.isfile(opt.presh_file):
            logging.error('pre.sh file does not exist')
            sys.exit(20)
        project.presh_file = opt.presh_file

    if opt.postsh_file:
        if not os.path.isfile(opt.postsh_file):
            logging.error('post.sh file does not exist')
            sys.exit(20)
        project.postsh_file = opt.postsh_file

    update_xml = None
    if len(args) >= 1:
        update_xml = args[0]

    with elbe_logging({"projects":project.builddir}):
        try:
            gen_update_pkg(project, update_xml, opt.output, buildtype,
                           opt.skip_validation, opt.debug,
                           cfg_dir=opt.cfg_dir, cmd_dir=opt.cmd_dir)

        except ValidationError:
            logging.exception("XML validation failed.  Bailing out")
            sys.exit(20)
        except MissingData:
            logging.exception("Missing Data")
            sys.exit(20)
コード例 #11
0
def run_command(argv):

    # pylint disable=too-many-statements

    oparser = OptionParser(usage="usage: %prog mkcdrom [options] <builddir>")
    oparser.add_option("--skip-validation",
                       action="store_true",
                       dest="skip_validation",
                       default=False,
                       help="Skip xml schema validation")
    oparser.add_option("--buildtype",
                       dest="buildtype",
                       help="Override the buildtype")
    oparser.add_option("--arch", dest="arch", help="Override the architecture")
    oparser.add_option("--codename",
                       dest="codename",
                       help="Override the codename")
    oparser.add_option("--init_codename",
                       dest="init_codename",
                       help="Override the initvm codename")
    oparser.add_option("--rfs-only",
                       action="store_true",
                       dest="rfs_only",
                       default=False,
                       help="builddir points to RFS")
    oparser.add_option("--log", dest="log", help="Log to filename")
    oparser.add_option("--binary",
                       action="store_true",
                       dest="binary",
                       default=False,
                       help="build binary cdrom")
    oparser.add_option("--source",
                       action="store_true",
                       dest="source",
                       default=False,
                       help="build source cdrom")
    oparser.add_option("--cdrom-size",
                       action="store",
                       dest="cdrom_size",
                       default=CDROM_SIZE,
                       help="ISO CD size in MB")

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("wrong number of arguments", file=sys.stderr)
        oparser.print_help()
        sys.exit(20)

    if not opt.rfs_only:
        try:
            project = ElbeProject(args[0],
                                  logpath=opt.log,
                                  override_buildtype=opt.buildtype,
                                  skip_validate=opt.skip_validation)
        except ValidationError as e:
            print(str(e), file=sys.stderr)
            print("xml validation failed. Bailing out", file=sys.stderr)
            sys.exit(20)

        builddir = project.builddir
        rfs = project.buildenv.rfs
        xml = project.xml
        arch = xml.text("project/arch", key="arch")
        codename = xml.text("project/suite")
        log = project.log
        init_codename = xml.get_initvm_codename()
    else:
        builddir = os.path.abspath(os.path.curdir)
        rfs = ChRootFilesystem(args[0])
        arch = opt.arch
        codename = opt.codename
        init_codename = opt.init_codename
        xml = None
        if opt.log:
            log = ASCIIDocLog(opt.log)
        else:
            log = StdoutLog()

    generated_files = []
    if opt.source:
        with rfs:
            generated_files += mk_source_cdrom(rfs, arch, codename,
                                               init_codename, builddir, log,
                                               opt.cdrom_size)

    if opt.binary:
        with rfs:
            generated_files += mk_binary_cdrom(rfs, arch, codename,
                                               init_codename, xml, builddir,
                                               log, opt.cdrom_size)

    print("")
    print("Image Build finished !")
    print("")
    print("Files generated:")
    for f in generated_files:
        print(" %s" % f)
コード例 #12
0
ファイル: buildchroot.py プロジェクト: Linutronix/elbe
def run_command(argv):
    oparser = OptionParser(usage="usage: %prog buildchroot [options] <xmlfile>")

    oparser.add_option("-t", "--target", dest="target", help="directoryname of target")

    oparser.add_option("-o", "--output", dest="output", help="name of logfile")

    oparser.add_option("-n", "--name", dest="name", help="name of the project (included in the report)")

    oparser.add_option(
        "--build-bin",
        action="store_true",
        dest="build_bin",
        default=False,
        help="Build Binary Repository CDROM, for exact Reproduction",
    )

    oparser.add_option(
        "--build-sources", action="store_true", dest="build_sources", default=False, help="Build Source CD"
    )

    oparser.add_option("--proxy", dest="proxy", help="Override the http proxy")

    oparser.add_option(
        "--debug", action="store_true", dest="debug", default=False, help="Enable various features to debug the build"
    )

    oparser.add_option("--buildtype", dest="buildtype", help="Override the buildtype")

    oparser.add_option("--cdrom-size", action="store", dest="cdrom_size", default=CDROM_SIZE, help="ISO CD size in MB")

    oparser.add_option(
        "--skip-validation",
        action="store_true",
        dest="skip_validation",
        default=False,
        help="Skip xml schema validation",
    )

    oparser.add_option(
        "--skip-debootstrap", action="store_true", dest="skip_debootstrap", default=False, help="Skip debootstrap"
    )

    oparser.add_option(
        "--skip-pkglist",
        action="store_true",
        dest="skip_pkglist",
        default=False,
        help="ignore changes of the package list",
    )

    oparser.add_option(
        "--skip-cdrom",
        action="store_true",
        dest="skip_cdrom",
        default=False,
        help="(now obsolete) Skip cdrom iso generation",
    )

    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print "wrong number of arguments"
        oparser.print_help()
        sys.exit(20)

    if not opt.target:
        print "No target specified"
        sys.exit(20)

    if opt.skip_cdrom:
        print "WARNING: Skip CDROMS is now the default, use --build-bin to build binary CDROM"

    try:
        project = ElbeProject(opt.target, args[0], opt.output, opt.name, opt.buildtype, opt.skip_validation)
    except ValidationError as e:
        print str(e)
        print "xml validation failed. Bailing out"
        sys.exit(20)

    try:
        project.build(
            opt.skip_debootstrap, opt.build_bin, opt.build_sources, opt.cdrom_size, opt.debug, opt.skip_pkglist
        )
    except CommandError as ce:
        print "command in project build failed:", ce.cmd
        sys.exit(20)

    try:
        db = ElbeDB()
        db.save_project(project)
    except OperationalError:
        print "failed to save project in database"
        sys.exit(20)