Example #1
0
File: hob.py Project: ack3000/poky
def main (server, eventHandler):
    gobject.threads_init()

    # NOTE: For now we require that the user run with pre and post files to
    # read and store configuration set in the GUI.
    # We hope to adjust this long term as tracked in Yocto Bugzilla #1441
    # http://bugzilla.pokylinux.org/show_bug.cgi?id=1441
    reqfiles = 0
    dep_files = server.runCommand(["getVariable", "__depends"]) or set()
    dep_files.union(server.runCommand(["getVariable", "__base_depends"]) or set())
    for f in dep_files:
        if f[0].endswith("hob-pre.conf"):
            reqfiles = reqfiles + 1
        elif f[0].endswith("hob-post.conf"):
            reqfiles = reqfiles + 1
        if reqfiles == 2:
            break
    if reqfiles < 2:
        print("""The hob UI requires a pre file named hob-pre.conf and a post
file named hob-post.conf to store and read its configuration from. Please run
hob with these files, i.e.\n
\bitbake -u hob -r conf/hob-pre.conf -R conf/hob-post.conf""")
        return

    taskmodel = TaskListModel()
    configurator = Configurator()
    handler = HobHandler(taskmodel, server)
    mach = server.runCommand(["getVariable", "MACHINE"])
    sdk_mach = server.runCommand(["getVariable", "SDKMACHINE"])
    # If SDKMACHINE not set the default SDK_ARCH is used so we
    # should represent that in the GUI
    if not sdk_mach:
        sdk_mach = server.runCommand(["getVariable", "SDK_ARCH"])
    distro = server.runCommand(["getVariable", "DISTRO"])
    if not distro:
        distro = "defaultsetup"
    bbthread = server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
    if not bbthread:
        bbthread = 1
    else:
        bbthread = int(bbthread)
    pmake = server.runCommand(["getVariable", "PARALLEL_MAKE"])
    if not pmake:
        pmake = 1
    else:
        # The PARALLEL_MAKE variable will be of the format: "-j 3" and we only
        # want a number for the spinner, so strip everything from the variable
        # up to and including the space
        pmake = int(pmake.lstrip("-j "))

    selected_image_types = server.runCommand(["getVariable", "IMAGE_FSTYPES"])
    all_image_types = server.runCommand(["getVariable", "IMAGE_TYPES"])

    pclasses = server.runCommand(["getVariable", "PACKAGE_CLASSES"]).split(" ")
    # NOTE: we're only supporting one value for PACKAGE_CLASSES being set
    # this seems OK because we're using the first package format set in
    # PACKAGE_CLASSES and that's the package manager used for the rootfs
    pkg, sep, pclass = pclasses[0].rpartition("_")

    incompatible = server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"])
    gplv3disabled = False
    if incompatible and incompatible.lower().find("gplv3") != -1:
        gplv3disabled = True

    build_toolchain = bool(server.runCommand(["getVariable", "HOB_BUILD_TOOLCHAIN"]))
    handler.toggle_toolchain(build_toolchain)
    build_headers = bool(server.runCommand(["getVariable", "HOB_BUILD_TOOLCHAIN_HEADERS"]))
    handler.toggle_toolchain_headers(build_headers)

    prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass,
                     pmake, bbthread, selected_image_types, all_image_types,
                     gplv3disabled, build_toolchain, build_headers)
    layers = LayerEditor(configurator, None)
    window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach)
    prefs.set_parent_window(window)
    layers.set_parent_window(window)
    window.show_all ()
    handler.connect("machines-updated", window.update_machines)
    handler.connect("sdk-machines-updated", prefs.update_sdk_machines)
    handler.connect("distros-updated", prefs.update_distros)
    handler.connect("package-formats-found", prefs.update_package_formats)
    handler.connect("generating-data", window.busy)
    handler.connect("data-generated", window.data_generated)
    handler.connect("reload-triggered", window.reload_triggered_cb)
    configurator.connect("layers-loaded", layers.load_current_layers)
    configurator.connect("layers-changed", handler.reload_data)
    handler.connect("config-found", configurator.configFound)
    handler.connect("fatal-error", window.fatal_error_cb)

    try:
        # kick the while thing off
        handler.current_command = handler.CFG_PATH_LOCAL
        server.runCommand(["findConfigFilePath", "local.conf"])
    except xmlrpclib.Fault:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # This timeout function regularly probes the event queue to find out if we
    # have any messages waiting for us.
    gobject.timeout_add (100,
                         handler.event_handle_idle_func,
                         eventHandler,
                         window.build,
                         window.progress)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])
Example #2
0
def main (server, eventHandler):
    import multiprocessing
    cpu_cnt = multiprocessing.cpu_count()

    gobject.threads_init()

    taskmodel = TaskListModel()
    configurator = Configurator()
    handler = HobHandler(taskmodel, server)
    mach = server.runCommand(["getVariable", "MACHINE"])
    sdk_mach = server.runCommand(["getVariable", "SDKMACHINE"])
    # If SDKMACHINE not set the default SDK_ARCH is used so we
    # should represent that in the GUI
    if not sdk_mach:
        sdk_mach = server.runCommand(["getVariable", "SDK_ARCH"])
    distro = server.runCommand(["getVariable", "DISTRO"])
    bbthread = server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
    if not bbthread:
        bbthread = cpu_cnt
        handler.set_bbthreads(cpu_cnt)
    else:
        bbthread = int(bbthread)
    pmake = server.runCommand(["getVariable", "PARALLEL_MAKE"])
    if not pmake:
        pmake = cpu_cnt
        handler.set_pmake(cpu_cnt)
    else:
        # The PARALLEL_MAKE variable will be of the format: "-j 3" and we only
        # want a number for the spinner, so strip everything from the variable
        # up to and including the space
        pmake = int(pmake[pmake.find(" ")+1:])

    image_types = server.runCommand(["getVariable", "IMAGE_TYPES"])

    pclasses = server.runCommand(["getVariable", "PACKAGE_CLASSES"]).split(" ")
    # NOTE: we're only supporting one value for PACKAGE_CLASSES being set
    # this seems OK because we're using the first package format set in
    # PACKAGE_CLASSES and that's the package manager used for the rootfs
    pkg, sep, pclass = pclasses[0].rpartition("_")

    prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt,
                     pmake, bbthread, image_types)
    layers = LayerEditor(configurator, None)
    window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach)
    prefs.set_parent_window(window)
    layers.set_parent_window(window)
    window.show_all ()
    handler.connect("machines-updated", window.update_machines)
    handler.connect("sdk-machines-updated", prefs.update_sdk_machines)
    handler.connect("distros-updated", prefs.update_distros)
    handler.connect("package-formats-found", prefs.update_package_formats)
    handler.connect("generating-data", window.busy)
    handler.connect("data-generated", window.data_generated)
    handler.connect("reload-triggered", window.reload_triggered_cb)
    configurator.connect("layers-loaded", layers.load_current_layers)
    configurator.connect("layers-changed", handler.reload_data)
    handler.connect("config-found", configurator.configFound)

    try:
        # kick the while thing off
        handler.current_command = "findConfigFilePathLocal"
        server.runCommand(["findConfigFilePath", "local.conf"])
    except xmlrpclib.Fault:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # This timeout function regularly probes the event queue to find out if we
    # have any messages waiting for us.
    gobject.timeout_add (100,
                         handler.event_handle_idle_func,
                         eventHandler,
                         window.build,
                         window.progress)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])
Example #3
0
def main(server, eventHandler):
    gobject.threads_init()

    # NOTE: For now we require that the user run with pre and post files to
    # read and store configuration set in the GUI.
    # We hope to adjust this long term as tracked in Yocto Bugzilla #1441
    # http://bugzilla.pokylinux.org/show_bug.cgi?id=1441
    reqfiles = 0
    dep_files = server.runCommand(["getVariable", "__depends"]) or set()
    dep_files.union(
        server.runCommand(["getVariable", "__base_depends"]) or set())
    for f in dep_files:
        if f[0].endswith("hob-pre.conf"):
            reqfiles = reqfiles + 1
        elif f[0].endswith("hob-post.conf"):
            reqfiles = reqfiles + 1
        if reqfiles == 2:
            break
    if reqfiles < 2:
        print("""The hob UI requires a pre file named hob-pre.conf and a post
file named hob-post.conf to store and read its configuration from. Please run
hob with these files, i.e.\n
\bitbake -u hob -r conf/hob-pre.conf -R conf/hob-post.conf""")
        return

    taskmodel = TaskListModel()
    configurator = Configurator()
    handler = HobHandler(taskmodel, server)
    mach = server.runCommand(["getVariable", "MACHINE"])
    sdk_mach = server.runCommand(["getVariable", "SDKMACHINE"])
    # If SDKMACHINE not set the default SDK_ARCH is used so we
    # should represent that in the GUI
    if not sdk_mach:
        sdk_mach = server.runCommand(["getVariable", "SDK_ARCH"])
    distro = server.runCommand(["getVariable", "DISTRO"])
    if not distro:
        distro = "defaultsetup"
    bbthread = server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
    if not bbthread:
        bbthread = 1
    else:
        bbthread = int(bbthread)
    pmake = server.runCommand(["getVariable", "PARALLEL_MAKE"])
    if not pmake:
        pmake = 1
    else:
        # The PARALLEL_MAKE variable will be of the format: "-j 3" and we only
        # want a number for the spinner, so strip everything from the variable
        # up to and including the space
        pmake = int(pmake.lstrip("-j "))

    selected_image_types = server.runCommand(["getVariable", "IMAGE_FSTYPES"])
    all_image_types = server.runCommand(["getVariable", "IMAGE_TYPES"])

    pclasses = server.runCommand(["getVariable", "PACKAGE_CLASSES"]).split(" ")
    # NOTE: we're only supporting one value for PACKAGE_CLASSES being set
    # this seems OK because we're using the first package format set in
    # PACKAGE_CLASSES and that's the package manager used for the rootfs
    pkg, sep, pclass = pclasses[0].rpartition("_")

    incompatible = server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"])
    gplv3disabled = False
    if incompatible and incompatible.lower().find("gplv3") != -1:
        gplv3disabled = True

    build_toolchain = bool(
        server.runCommand(["getVariable", "HOB_BUILD_TOOLCHAIN"]))
    handler.toggle_toolchain(build_toolchain)
    build_headers = bool(
        server.runCommand(["getVariable", "HOB_BUILD_TOOLCHAIN_HEADERS"]))
    handler.toggle_toolchain_headers(build_headers)

    prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, pmake,
                     bbthread, selected_image_types, all_image_types,
                     gplv3disabled, build_toolchain, build_headers)
    layers = LayerEditor(configurator, None)
    window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach)
    prefs.set_parent_window(window)
    layers.set_parent_window(window)
    window.show_all()
    handler.connect("machines-updated", window.update_machines)
    handler.connect("sdk-machines-updated", prefs.update_sdk_machines)
    handler.connect("distros-updated", prefs.update_distros)
    handler.connect("package-formats-found", prefs.update_package_formats)
    handler.connect("generating-data", window.busy)
    handler.connect("data-generated", window.data_generated)
    handler.connect("reload-triggered", window.reload_triggered_cb)
    configurator.connect("layers-loaded", layers.load_current_layers)
    configurator.connect("layers-changed", handler.reload_data)
    handler.connect("config-found", configurator.configFound)
    handler.connect("fatal-error", window.fatal_error_cb)

    try:
        # kick the while thing off
        handler.current_command = handler.CFG_PATH_LOCAL
        server.runCommand(["findConfigFilePath", "local.conf"])
    except xmlrpclib.Fault:
        print("XMLRPC Fault getting commandline:\n %s" % x)
        return 1

    # This timeout function regularly probes the event queue to find out if we
    # have any messages waiting for us.
    gobject.timeout_add(100, handler.event_handle_idle_func, eventHandler,
                        window.build, window.progress)

    try:
        gtk.main()
    except EnvironmentError as ioerror:
        # ignore interrupted io
        if ioerror.args[0] == 4:
            pass
    finally:
        server.runCommand(["stateStop"])