コード例 #1
0
def extract_cdrom(cdrom):
    """ Extract cdrom iso image
        returns a TmpdirFilesystem() object containing
        the source.xml, which is also validated.
    """

    tmp = TmpdirFilesystem()
    system('7z x -o%s "%s" source.xml' % (tmp.path, cdrom))

    print("", file=sys.stderr)

    if not tmp.isfile('source.xml'):
        print("Iso image does not contain a source.xml file", file=sys.stderr)
        print("This is not supported by 'elbe initvm'", file=sys.stderr)
        print("", file=sys.stderr)
        print("Exiting !!!", file=sys.stderr)
        sys.exit(20)

    try:
        exml = ElbeXML(tmp.fname('source.xml'),
                       url_validation=ValidationMode.NO_CHECK)
    except ValidationError as e:
        print("Iso image does contain a source.xml file.", file=sys.stderr)
        print("But that xml does not validate correctly", file=sys.stderr)
        print("", file=sys.stderr)
        print("Exiting !!!", file=sys.stderr)
        print(e)
        sys.exit(20)

    print("Iso Image with valid source.xml detected !")
    print("Image was generated using Elbe Version %s" %
          exml.get_elbe_version())

    return tmp
コード例 #2
0
ファイル: initvmaction.py プロジェクト: Linutronix/elbe
def extract_cdrom(cdrom):
    """ Extract cdrom iso image
        returns a TmpdirFilesystem() object containing
        the source.xml, which is also validated.
    """

    tmp = TmpdirFilesystem()
    os.system('7z x -o%s "%s" source.xml' % (tmp.path, cdrom))

    print("", file=sys.stderr)

    if not tmp.isfile('source.xml'):
        print(
            "Iso image does not contain a source.xml file",
            file=sys.stderr)
        print(
            "This is not supported by 'elbe initvm'",
            file=sys.stderr)
        print("", file=sys.stderr)
        print("Exiting !!!", file=sys.stderr)
        sys.exit(20)

    try:
        exml = ElbeXML(
            tmp.fname('source.xml'),
            url_validation=ValidationMode.NO_CHECK)
    except ValidationError as e:
        print(
            "Iso image does contain a source.xml file.",
            file=sys.stderr)
        print(
            "But that xml does not validate correctly",
            file=sys.stderr)
        print("", file=sys.stderr)
        print("Exiting !!!", file=sys.stderr)
        print(e)
        sys.exit(20)

    print("Iso Image with valid source.xml detected !")
    print(
        "Image was generated using Elbe Version %s" %
        exml.get_elbe_version())

    return tmp
コード例 #3
0
    def execute(self, initvmdir, opt, args):
        try:
            have_session = os.system(
                "tmux has-session -t ElbeInitVMSession >/dev/null 2>&1")
        except CommandError as e:
            print(
                "tmux execution failed, tmux version 1.9 or higher is required"
            )
            sys.exit(20)
        if have_session == 256:
            print("ElbeInitVMSession does not exist in tmux.", file=sys.stderr)
            print("Try 'elbe initvm start' to start the session.",
                  file=sys.stderr)
            sys.exit(20)

        try:
            system('%s initvm ensure --directory "%s"' % (elbe_exe, initvmdir))
        except CommandError:
            print("Starting the initvm Failed", file=sys.stderr)
            print("Giving up", file=sys.stderr)
            sys.exit(20)

        # Init cdrom to None, if we detect it, we set it
        cdrom = None

        if len(args) == 1:
            if args[0].endswith('.xml'):
                # We have an xml file, use that for elbe init
                xmlfile = args[0]
            elif args[0].endswith('.iso'):
                # We have an iso image, extract xml from there.
                tmp = TmpdirFilesystem()
                os.system('7z x -o%s "%s" source.xml' % (tmp.path, args[0]))

                print('', file=sys.stderr)

                if not tmp.isfile('source.xml'):
                    print('Iso image does not contain a source.xml file',
                          file=sys.stderr)
                    print('This is not supported by "elbe initvm"',
                          file=sys.stderr)
                    print('', file=sys.stderr)
                    print('Exiting !!!', file=sys.stderr)
                    sys.exit(20)

                try:
                    exml = ElbeXML(tmp.fname('source.xml'), skip_urlcheck=True)
                except ValidationError as e:
                    print('Iso image does contain a source.xml file.',
                          file=sys.stderr)
                    print('But that xml does not validate correctly',
                          file=sys.stderr)
                    print('', file=sys.stderr)
                    print('Exiting !!!', file=sys.stderr)
                    sys.exit(20)

                print('Iso Image with valid source.xml detected !')
                print('Image was generated using Elbe Version %s' %
                      exml.get_elbe_version())

                xmlfile = tmp.fname('source.xml')
                cdrom = args[0]
            else:
                print('Unknown file ending (use either xml or iso)',
                      file=sys.stderr)
                sys.exit(20)

            ret, prjdir, err = command_out_stderr(
                '%s control create_project --retries 60 "%s"' %
                (elbe_exe, xmlfile))
            if ret != 0:
                print("elbe control create_project failed.", file=sys.stderr)
                print(err, file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            prjdir = prjdir.strip()

            if cdrom is not None:
                print("Uploading CDROM. This might take a while")
                try:
                    system('%s control set_cdrom "%s" "%s"' %
                           (elbe_exe, prjdir, cdrom))
                except CommandError:
                    print("elbe control set_cdrom Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)

                print("Upload finished")

            build_opts = ''
            if opt.build_bin:
                build_opts += '--build-bin '
            if opt.build_sources:
                build_opts += '--build-sources '

            try:
                system('%s control build "%s" %s' %
                       (elbe_exe, prjdir, build_opts))
            except CommandError:
                print("elbe control build Failed", file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            print("Build started, waiting till it finishes")

            try:
                system('%s control wait_busy "%s"' % (elbe_exe, prjdir))
            except CommandError:
                print("elbe control wait_busy Failed", file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            print("")
            print("Build finished !")
            print("")
            try:
                system('%s control dump_file "%s" validation.txt' %
                       (elbe_exe, prjdir))
            except CommandError:
                print("Project failed to generate validation.txt",
                      file=sys.stderr)
                print("Getting log.txt", file=sys.stderr)
                try:
                    system('%s control dump_file "%s" log.txt' %
                           (elbe_exe, prjdir))
                except CommandError:

                    print("Failed to dump log.txt", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                sys.exit(20)

            if opt.skip_download:
                print("")
                print("Listing available files:")
                print("")
                try:
                    system('%s control get_files "%s"' % (elbe_exe, prjdir))
                except CommandError:
                    print("elbe control get_files Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)

                print("")
                print('Get Files with: elbe control get_file "%s" <filename>' %
                      prjdir)
            else:
                print("")
                print("Getting generated Files")
                print("")

                ensure_outdir(wdfs, opt)

                try:
                    system('%s control get_files --output "%s" "%s"' %
                           (elbe_exe, opt.outdir, prjdir))
                except CommandError:
                    print("elbe control get_files Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)

                if not opt.keep_files:
                    try:
                        system('%s control del_project "%s"' %
                               (elbe_exe, prjdir))
                    except CommandError:
                        print("remove project from initvm failed",
                              file=sys.stderr)
                        sys.exit(20)
コード例 #4
0
    def execute(self, initvmdir, opt, args):
        try:
            have_session = os.system(
                "tmux has-session -t ElbeInitVMSession >/dev/null 2>&1")
        except CommandError as e:
            print(
                "tmux execution failed, tmux version 1.9 or higher is required"
            )
            sys.exit(20)
        if have_session == 0:
            print("ElbeInitVMSession already exists in tmux.", file=sys.stderr)
            print("", file=sys.stderr)
            print(
                "There can only exist a single ElbeInitVMSession, and this session",
                file=sys.stderr)
            print("can also be used to make your build.", file=sys.stderr)
            print(
                "See 'elbe initvm submit', 'elbe initvm attach' and 'elbe control'",
                file=sys.stderr)
            sys.exit(20)

        # Init cdrom to None, if we detect it, we set it
        cdrom = None

        if len(args) == 1:
            if args[0].endswith('.xml'):
                # We have an xml file, use that for elbe init
                exampl = args[0]
                try:
                    xml = etree(exampl)
                except ValidationError as e:
                    print('XML file is inavlid: ' + str(e))
                # Use default XML if no initvm was specified
                if not xml.has("initvm"):
                    exampl = os.path.join(elbepack.__path__[0],
                                          "init/default-init.xml")

            elif args[0].endswith('.iso'):
                # We have an iso image, extract xml from there.
                tmp = TmpdirFilesystem()
                os.system('7z x -o%s "%s" source.xml' % (tmp.path, args[0]))

                if not tmp.isfile('source.xml'):
                    print('Iso image does not contain a source.xml file',
                          file=sys.stderr)
                    print('This is not supported by "elbe initvm"',
                          file=sys.stderr)
                    print('', file=sys.stderr)
                    print('Exiting !!!', file=sys.stderr)
                    sys.exit(20)

                try:
                    exml = ElbeXML(tmp.fname('source.xml'), skip_urlcheck=True)
                except ValidationError as e:
                    print('Iso image does contain a source.xml file.',
                          file=sys.stderr)
                    print('But that xml does not validate correctly',
                          file=sys.stderr)
                    print('', file=sys.stderr)
                    print('Exiting !!!', file=sys.stderr)
                    sys.exit(20)

                print('Iso Image with valid source.xml detected !')
                print('Image was generated using Elbe Version %s' %
                      exml.get_elbe_version())

                exampl = tmp.fname('source.xml')
                cdrom = args[0]
            else:
                print('Unknown file ending (use either xml or iso)',
                      file=sys.stderr)
                sys.exit(20)
        else:
            # No xml File was specified, build the default elbe-init-with-ssh
            exampl = os.path.join(elbepack.__path__[0],
                                  "init/default-init.xml")

        try:
            if opt.devel:
                devel = ' --devel'
            else:
                devel = ''

            if cdrom:
                system('%s init %s --directory "%s" --cdrom "%s" "%s"' %
                       (elbe_exe, devel, initvmdir, cdrom, exampl))
            else:
                system('%s init %s --directory "%s" "%s"' %
                       (elbe_exe, devel, initvmdir, exampl))

        except CommandError:
            print("'elbe init' Failed", file=sys.stderr)
            print("Giving up", file=sys.stderr)
            sys.exit(20)

        try:
            system('cd "%s"; make' % (initvmdir))
        except CommandError:
            print("Building the initvm Failed", file=sys.stderr)
            print("Giving up", file=sys.stderr)
            sys.exit(20)

        try:
            system('%s initvm start --directory "%s"' % (elbe_exe, initvmdir))
        except CommandError:
            print("Starting the initvm Failed", file=sys.stderr)
            print("Giving up", file=sys.stderr)
            sys.exit(20)

        if len(args) == 1:
            # if provided xml file has no initvm section exampl is set to a
            # default initvm XML file. But we need the original file here
            if args[0].endswith('.xml'):
                # stop here if no project node was specified
                try:
                    x = ElbeXML(args[0])
                except ValidationError as e:
                    print('XML file is inavlid: ' + str(e))
                    sys.exit(20)
                if not x.has('project'):
                    print(
                        'elbe initvm ready: use "elbe initvm submit myproject.xml" to build a project'
                    )
                    sys.exit(0)

                ret, prjdir, err = command_out_stderr(
                    '%s control create_project "%s"' % (elbe_exe, args[0]))
            else:
                ret, prjdir, err = command_out_stderr(
                    '%s control create_project "%s"' % (elbe_exe, exampl))

            if ret != 0:
                print("elbe control create_project failed.", file=sys.stderr)
                print(err, file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            prjdir = prjdir.strip()

            if cdrom is not None:
                print("Uploading CDROM. This might take a while")
                try:
                    system('%s control set_cdrom "%s" "%s"' %
                           (elbe_exe, prjdir, cdrom))
                except CommandError:
                    print("elbe control set_cdrom Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)

                print("Upload finished")

            build_opts = ''
            if opt.build_bin:
                build_opts += '--build-bin '
            if opt.build_sources:
                build_opts += '--build-sources '

            try:
                system('%s control build "%s" %s' %
                       (elbe_exe, prjdir, build_opts))
            except CommandError:
                print("elbe control build Failed", file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            try:
                system('%s control wait_busy "%s"' % (elbe_exe, prjdir))
            except CommandError:
                print("elbe control wait_busy Failed", file=sys.stderr)
                print("Giving up", file=sys.stderr)
                sys.exit(20)

            print("")
            print("Build finished !")
            print("")
            try:
                system('%s control dump_file "%s" validation.txt' %
                       (elbe_exe, prjdir))
            except CommandError:
                print("Project failed to generate validation.txt",
                      file=sys.stderr)
                print("Getting log.txt", file=sys.stderr)
                try:
                    system('%s control dump_file "%s" log.txt' %
                           (elbe_exe, prjdir))
                except CommandError:

                    print("Failed to dump log.txt", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                sys.exit(20)

            if opt.skip_download:
                print("")
                print("Listing available files:")
                print("")
                try:
                    system('%s control get_files "%s"' % (elbe_exe, prjdir))
                except CommandError:
                    print("elbe control Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)

                print("")
                print('Get Files with: elbe control get_file "%s" <filename>' %
                      prjdir)
            else:
                ensure_outdir(wdfs, opt)

                try:
                    system('%s control get_files --output "%s" "%s"' %
                           (elbe_exe, opt.outdir, prjdir))
                except CommandError:
                    print("elbe control get_files Failed", file=sys.stderr)
                    print("Giving up", file=sys.stderr)
                    sys.exit(20)
コード例 #5
0
ファイル: initvmaction.py プロジェクト: atoz-chevara/elbe
    def execute(self, initvmdir, opt, args):
        try:
            have_session = os.system( "tmux has-session -t ElbeInitVMSession >/dev/null 2>&1" )
        except CommandError as e:
            print ("tmux execution failed, tmux version 1.9 or higher is required")
            sys.exit(20)
        if have_session == 256:
            print ("ElbeInitVMSession does not exist in tmux.", file=sys.stderr)
            print ("Try 'elbe initvm start' to start the session.", file=sys.stderr)
            sys.exit(20)

        try:
            system ('%s initvm ensure --directory "%s"' % (elbe_exe, initvmdir))
        except CommandError:
            print ("Starting the initvm Failed", file=sys.stderr)
            print ("Giving up", file=sys.stderr)
            sys.exit(20)

        # Init cdrom to None, if we detect it, we set it
        cdrom = None

        if len(args) == 1:
            if args[0].endswith ('.xml'):
                # We have an xml file, use that for elbe init
                xmlfile = args[0]
            elif args[0].endswith ('.iso'):
                # We have an iso image, extract xml from there.
                tmp = TmpdirFilesystem ()
                os.system ('7z x -o%s "%s" source.xml' % (tmp.path, args[0]))

                print ('', file=sys.stderr)

                if not tmp.isfile ('source.xml'):
                    print ('Iso image does not contain a source.xml file', file=sys.stderr)
                    print ('This is not supported by "elbe initvm"', file=sys.stderr)
                    print ('', file=sys.stderr)
                    print ('Exiting !!!', file=sys.stderr)
                    sys.exit (20)

                try:
                    exml = ElbeXML (tmp.fname ('source.xml'), skip_urlcheck=True)
                except ValidationError as e:
                    print ('Iso image does contain a source.xml file.', file=sys.stderr)
                    print ('But that xml does not validate correctly', file=sys.stderr)
                    print ('', file=sys.stderr)
                    print ('Exiting !!!', file=sys.stderr)
                    sys.exit (20)

                print ('Iso Image with valid source.xml detected !')
                print ('Image was generated using Elbe Version %s' % exml.get_elbe_version ())

                xmlfile = tmp.fname ('source.xml')
                cdrom = args[0]
            else:
                print ('Unknown file ending (use either xml or iso)', file=sys.stderr)
                sys.exit (20)

            ret, prjdir, err = command_out_stderr ('%s control create_project --retries 60 "%s"' % (elbe_exe, xmlfile))
            if ret != 0:
                print ("elbe control create_project failed.", file=sys.stderr)
                print (err, file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            prjdir = prjdir.strip()

            if cdrom is not None:
                print ("Uploading CDROM. This might take a while")
                try:
                    system ('%s control set_cdrom "%s" "%s"' % (elbe_exe, prjdir, cdrom) )
                except CommandError:
                    print ("elbe control set_cdrom Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)

                print ("Upload finished")

            build_opts = ''
            if opt.build_bin:
                build_opts += '--build-bin '
            if opt.build_sources:
                build_opts += '--build-sources '

            try:
                system ('%s control build "%s" %s' % (elbe_exe, prjdir, build_opts) )
            except CommandError:
                print ("elbe control build Failed", file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            print ("Build started, waiting till it finishes")

            try:
                system ('%s control wait_busy "%s"' % (elbe_exe, prjdir) )
            except CommandError:
                print ("elbe control wait_busy Failed", file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            print ("")
            print ("Build finished !")
            print ("")
            try:
                system ('%s control dump_file "%s" validation.txt' % (elbe_exe, prjdir) )
            except CommandError:
                print ("Project failed to generate validation.txt", file=sys.stderr)
                print ("Getting log.txt", file=sys.stderr)
                try:
                    system ('%s control dump_file "%s" log.txt' % (elbe_exe, prjdir) )
                except CommandError:

                    print ("Failed to dump log.txt", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                sys.exit(20)

            if opt.skip_download:
                print ("")
                print ("Listing available files:")
                print ("")
                try:
                    system ('%s control get_files "%s"' % (elbe_exe, prjdir) )
                except CommandError:
                    print ("elbe control get_files Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)

                print ("")
                print ('Get Files with: elbe control get_file "%s" <filename>' % prjdir)
            else:
                print ("")
                print ("Getting generated Files")
                print ("")

                ensure_outdir (wdfs, opt)

                try:
                    system ('%s control get_files --output "%s" "%s"' % (
                            elbe_exe, opt.outdir, prjdir ))
                except CommandError:
                    print ("elbe control get_files Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)

                if not opt.keep_files:
                    try:
                        system ('%s control del_project "%s"' % (
                            elbe_exe, prjdir))
                    except CommandError:
                        print ("remove project from initvm failed",
                                file=sys.stderr)
                        sys.exit(20)
コード例 #6
0
ファイル: initvmaction.py プロジェクト: atoz-chevara/elbe
    def execute(self, initvmdir, opt, args):
        try:
            have_session = os.system( "tmux has-session -t ElbeInitVMSession >/dev/null 2>&1" )
        except CommandError as e:
            print ("tmux execution failed, tmux version 1.9 or higher is required")
            sys.exit(20)
        if have_session == 0:
            print ("ElbeInitVMSession already exists in tmux.", file=sys.stderr)
            print ("", file=sys.stderr)
            print ("There can only exist a single ElbeInitVMSession, and this session", file=sys.stderr)
            print ("can also be used to make your build.", file=sys.stderr)
            print ("See 'elbe initvm submit', 'elbe initvm attach' and 'elbe control'", file=sys.stderr)
            sys.exit(20)

        # Init cdrom to None, if we detect it, we set it
        cdrom = None

        if len(args) == 1:
            if args[0].endswith ('.xml'):
                # We have an xml file, use that for elbe init
                exampl = args[0]
                try:
                    xml = etree( exampl )
                except ValidationError as e:
                    print ('XML file is inavlid: ' + str(e))
                # Use default XML if no initvm was specified
                if not xml.has( "initvm" ):
                    exampl = os.path.join (elbepack.__path__[0], "init/default-init.xml")

            elif args[0].endswith ('.iso'):
                # We have an iso image, extract xml from there.
                tmp = TmpdirFilesystem ()
                os.system ('7z x -o%s "%s" source.xml' % (tmp.path, args[0]))

                if not tmp.isfile ('source.xml'):
                    print ('Iso image does not contain a source.xml file', file=sys.stderr)
                    print ('This is not supported by "elbe initvm"', file=sys.stderr)
                    print ('', file=sys.stderr)
                    print ('Exiting !!!', file=sys.stderr)
                    sys.exit (20)

                try:
                    exml = ElbeXML (tmp.fname ('source.xml'), skip_urlcheck=True)
                except ValidationError as e:
                    print ('Iso image does contain a source.xml file.', file=sys.stderr)
                    print ('But that xml does not validate correctly', file=sys.stderr)
                    print ('', file=sys.stderr)
                    print ('Exiting !!!', file=sys.stderr)
                    sys.exit (20)


                print ('Iso Image with valid source.xml detected !')
                print ('Image was generated using Elbe Version %s' % exml.get_elbe_version ())

                exampl = tmp.fname ('source.xml')
                cdrom = args[0]
            else:
                print ('Unknown file ending (use either xml or iso)', file=sys.stderr)
                sys.exit (20)
        else:
            # No xml File was specified, build the default elbe-init-with-ssh
            exampl = os.path.join (elbepack.__path__[0], "init/default-init.xml")

        try:
            if opt.devel:
                devel = ' --devel'
            else:
                devel = ''

            if cdrom:
                system ('%s init %s --directory "%s" --cdrom "%s" "%s"' % (elbe_exe, devel, initvmdir, cdrom, exampl))
            else:
                system ('%s init %s --directory "%s" "%s"' % (elbe_exe, devel, initvmdir, exampl))

        except CommandError:
            print ("'elbe init' Failed", file=sys.stderr)
            print ("Giving up", file=sys.stderr)
            sys.exit(20)

        try:
            system ('cd "%s"; make' % (initvmdir))
        except CommandError:
            print ("Building the initvm Failed", file=sys.stderr)
            print ("Giving up", file=sys.stderr)
            sys.exit(20)

        try:
            system ('%s initvm start --directory "%s"' % (elbe_exe, initvmdir))
        except CommandError:
            print ("Starting the initvm Failed", file=sys.stderr)
            print ("Giving up", file=sys.stderr)
            sys.exit(20)

        if len(args) == 1:
            # if provided xml file has no initvm section exampl is set to a
            # default initvm XML file. But we need the original file here
            if args[0].endswith ('.xml'):
                # stop here if no project node was specified
                try:
                    x = ElbeXML (args[0])
                except ValidationError as e:
                    print ('XML file is inavlid: ' + str(e))
                    sys.exit(20)
                if not x.has('project'):
                    print ('elbe initvm ready: use "elbe initvm submit myproject.xml" to build a project');
                    sys.exit(0)

                ret, prjdir, err = command_out_stderr ('%s control create_project "%s"' % (elbe_exe, args[0]))
            else:
                ret, prjdir, err = command_out_stderr ('%s control create_project "%s"' % (elbe_exe, exampl))

            if ret != 0:
                print ("elbe control create_project failed.", file=sys.stderr)
                print (err, file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            prjdir = prjdir.strip()

            if cdrom is not None:
                print ("Uploading CDROM. This might take a while")
                try:
                    system ('%s control set_cdrom "%s" "%s"' % (elbe_exe, prjdir, cdrom) )
                except CommandError:
                    print ("elbe control set_cdrom Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)

                print ("Upload finished")

            build_opts = ''
            if opt.build_bin:
                build_opts += '--build-bin '
            if opt.build_sources:
                build_opts += '--build-sources '

            try:
                system ('%s control build "%s" %s' % (elbe_exe, prjdir, build_opts) )
            except CommandError:
                print ("elbe control build Failed", file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            try:
                system ('%s control wait_busy "%s"' % (elbe_exe, prjdir) )
            except CommandError:
                print ("elbe control wait_busy Failed", file=sys.stderr)
                print ("Giving up", file=sys.stderr)
                sys.exit(20)

            print ("")
            print ("Build finished !")
            print ("")
            try:
                system ('%s control dump_file "%s" validation.txt' % (elbe_exe, prjdir) )
            except CommandError:
                print ("Project failed to generate validation.txt", file=sys.stderr)
                print ("Getting log.txt", file=sys.stderr)
                try:
                    system ('%s control dump_file "%s" log.txt' % (elbe_exe, prjdir) )
                except CommandError:

                    print ("Failed to dump log.txt", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                sys.exit(20)

            if opt.skip_download:
                print ("")
                print ("Listing available files:")
                print ("")
                try:
                    system ('%s control get_files "%s"' % (elbe_exe, prjdir) )
                except CommandError:
                    print ("elbe control Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)

                print ("")
                print ('Get Files with: elbe control get_file "%s" <filename>' % prjdir)
            else:
                ensure_outdir (wdfs, opt)

                try:
                    system ('%s control get_files --output "%s" "%s"' % (elbe_exe, opt.outdir, prjdir) )
                except CommandError:
                    print ("elbe control get_files Failed", file=sys.stderr)
                    print ("Giving up", file=sys.stderr)
                    sys.exit(20)