def simple(builder, name, role, checkout, rev=None, branch=None, simpleCheckout=False, config=True, perRoleMakefiles=False, makefileName=DEFAULT_MAKEFILE_NAME): """ Build a package controlled by our simplified C/C++ make rules, called name with role role from the sources in checkout checkout. * simpleCheckout - If True, register the checkout too. * config - If True, we have make config. If false, we don't. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) the_pkg = CxxBuilder(name, role, checkout, config=config, perRoleMakefiles=perRoleMakefiles, makefileName=makefileName) # Add the standard dependencies .. pkg.add_package_rules(builder.ruleset, name, role, the_pkg) # .. and make us depend on the checkout. pkg.package_depends_on_checkout(builder.ruleset, name, role, checkout, the_pkg)
def medium(builder, name, roles, checkout, rev=None, branch=None, deps = None, dep_tag = utils.LabelTag.PreConfig, simpleCheckout = True, config = True, perRoleMakefiles = False, makefileName = DEFAULT_MAKEFILE_NAME, usesAutoconf = False, rewriteAutoconf = False, execRelPath = None): """ Build a package controlled by make, in the given roles with the given dependencies in each role. * simpleCheckout - If True, register the checkout as simple checkout too. * dep_tag - The tag to depend on being installed before you'll build. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) if deps is None: deps = [] for r in roles: simple(builder, name, r, checkout, config = config, perRoleMakefiles = perRoleMakefiles, makefileName = makefileName, usesAutoconf = usesAutoconf, rewriteAutoconf = rewriteAutoconf, execRelPath = execRelPath) pkg.package_depends_on_packages(builder.ruleset, name, r, dep_tag, deps)
def setup_helpers(builder, helper_name): """ Set up a helper checkout to be used in subsequent calls to build_with_helper Basically a wrapper around:: checkouts.simple.relative(builder, helper_name, helper_name) """ co_simple.relative(builder, helper_name, helper_name)
def build_with_helper(builder, helpers, pkg_name, checkout, roles, makefileName=None, co_dir=None, repoRelative=None, rev=None): """ Builds a package called 'pkg_name' from a makefile in a helpers checkout called 'helpers', involving the use of the checkout 'checkout', which is a relative checkout with optional second level name co_dir, repo relative name repoRelative, and revision rev. In other words, declares that 'pkg_name' in the given 'roles' will be built with the Makefile called: <helpers>/<makefileName> If 'co_dir' is None, this will be checked out using checkouts.simple.relative(), otherwise it will be checked out using checkouts.twolevel.relative(). The 'co_dir', 'repoRelative' and 'rev' arguments will be used in the obvious ways. """ if (makefileName is None): makefileName = os.path.join(pkg_name, "Makefile.muddle") make.medium(builder, name=pkg_name, roles=roles, checkout="helpers", makefileName=makefileName, simpleCheckout=False) # Make sure we actually check out .. if (co_dir is None): co_simple.relative(builder, checkout, repoRelative, rev) else: co_twolevel.relative(builder, co_dir=co_dir, co_name=checkout, repo_relative=repoRelative, rev=rev) # Now depend on any additional checkouts .. for r in roles: pkg.package_depends_on_checkout(builder.ruleset, pkg_name, r, checkout)
def build_with_helper(builder, helpers, pkg_name, checkout, roles, makefileName = None, co_dir = None, repoRelative = None, rev = None): """ Builds a package called 'pkg_name' from a makefile in a helpers checkout called 'helpers', involving the use of the checkout 'checkout', which is a relative checkout with optional second level name co_dir, repo relative name repoRelative, and revision rev. In other words, declares that 'pkg_name' in the given 'roles' will be built with the Makefile called: <helpers>/<makefileName> If 'co_dir' is None, this will be checked out using checkouts.simple.relative(), otherwise it will be checked out using checkouts.twolevel.relative(). The 'co_dir', 'repoRelative' and 'rev' arguments will be used in the obvious ways. """ if (makefileName is None): makefileName = os.path.join(pkg_name, "Makefile.muddle") make.medium(builder, name = pkg_name, roles = roles, checkout = "helpers", makefileName = makefileName, simpleCheckout = False) # Make sure we actually check out .. if (co_dir is None): co_simple.relative(builder, checkout, repoRelative, rev) else: co_twolevel.relative(builder, co_dir = co_dir, co_name = checkout, repo_relative = repoRelative, rev = rev) # Now depend on any additional checkouts .. for r in roles: pkg.package_depends_on_checkout(builder.ruleset, pkg_name, r, checkout)
def simple(builder, name, role, checkout, rev=None, branch=None, simpleCheckout=False, config=True, perRoleMakefiles=False, makefileName=DEFAULT_MAKEFILE_NAME, usesAutoconf=False, rewriteAutoconf=False, execRelPath=None): """ Build a package controlled by make, called name with role role from the sources in checkout checkout. * simpleCheckout - If True, register the checkout too. * config - If True, we have make config. If false, we don't. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. * usesAutoconf - If True, this package is given access to .la and .pc files from things it depends on. * rewriteAutoconf - If True, we will rewrite .la and .pc files in the output directory so that packages which use autoconf continue to depend correctly. Intended for use with the MUDDLE_PKGCONFIG_DIRS environment variable. * execRelPath - Where, relative to the object directory, do we find binaries for this package? """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) the_pkg = MakeBuilder(name, role, checkout, config=config, perRoleMakefiles=perRoleMakefiles, makefileName=makefileName, usesAutoconf=usesAutoconf, rewriteAutoconf=rewriteAutoconf, execRelPath=execRelPath) # Add the standard dependencies .. pkg.add_package_rules(builder.ruleset, name, role, the_pkg) # .. and make us depend on the checkout. pkg.package_depends_on_checkout(builder.ruleset, name, role, checkout, the_pkg)
def medium(builder, name, roles, checkout, rev=None, branch=None, deps=None, dep_tag=utils.LabelTag.PreConfig, simpleCheckout=True, config=True, perRoleMakefiles=False, makefileName=DEFAULT_MAKEFILE_NAME, usesAutoconf=False, rewriteAutoconf=False, execRelPath=None): """ Build a package controlled by make, in the given roles with the given dependencies in each role. * simpleCheckout - If True, register the checkout as simple checkout too. * dep_tag - The tag to depend on being installed before you'll build. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) if deps is None: deps = [] for r in roles: simple(builder, name, r, checkout, config=config, perRoleMakefiles=perRoleMakefiles, makefileName=makefileName, usesAutoconf=usesAutoconf, rewriteAutoconf=rewriteAutoconf, execRelPath=execRelPath) pkg.package_depends_on_packages(builder.ruleset, name, r, dep_tag, deps)
def simple(builder, name, role, checkout, rev = None, branch = None, simpleCheckout = False, config = True, perRoleMakefiles = False, makefileName = DEFAULT_MAKEFILE_NAME): """ Build a package controlled by our simplified C/C++ make rules, called name with role role from the sources in checkout checkout. * simpleCheckout - If True, register the checkout too. * config - If True, we have make config. If false, we don't. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) the_pkg = CxxBuilder(name, role, checkout, config = config, perRoleMakefiles = perRoleMakefiles, makefileName = makefileName) # Add the standard dependencies .. pkg.add_package_rules(builder.ruleset, name, role, the_pkg) # .. and make us depend on the checkout. pkg.package_depends_on_checkout(builder.ruleset, name, role, checkout, the_pkg)
def simple(builder, name, role, checkout, rev=None, branch=None, simpleCheckout = False, config = True, perRoleMakefiles = False, makefileName = DEFAULT_MAKEFILE_NAME, usesAutoconf = False, rewriteAutoconf = False, execRelPath = None): """ Build a package controlled by make, called name with role role from the sources in checkout checkout. * simpleCheckout - If True, register the checkout too. * config - If True, we have make config. If false, we don't. * perRoleMakefiles - If True, we run 'make -f Makefile.<rolename>' instead of just make. * usesAutoconf - If True, this package is given access to .la and .pc files from things it depends on. * rewriteAutoconf - If True, we will rewrite .la and .pc files in the output directory so that packages which use autoconf continue to depend correctly. Intended for use with the MUDDLE_PKGCONFIG_DIRS environment variable. * execRelPath - Where, relative to the object directory, do we find binaries for this package? """ if (simpleCheckout): simple_checkouts.relative(builder, checkout, rev=rev, branch=branch) the_pkg = MakeBuilder(name, role, checkout, config = config, perRoleMakefiles = perRoleMakefiles, makefileName = makefileName, usesAutoconf = usesAutoconf, rewriteAutoconf = rewriteAutoconf, execRelPath = execRelPath) # Add the standard dependencies .. pkg.add_package_rules(builder.ruleset, name, role, the_pkg) # .. and make us depend on the checkout. pkg.package_depends_on_checkout(builder.ruleset, name, role, checkout, the_pkg)
def describe_to(builder): """ Construct a very basic Linux system """ # We want a kernel.. linux_kernel.simple(builder, name = "kernel", checkout = "kernel-2.6.30-1", linux_dir = "linux-2.6.30", config_file = "kernel_config", kernel_version = "2.6.30", makeInstall = False) # Steal a few basic libraries from Debian. deb.simple(builder, coName = "ubuntu-9.04", name = "libc6", roles = [ "root" ], depends_on = [ ], pkgFile = "libc6_2.9.4-ubuntu6_i386.deb") deb.simple(builder, coName = "ubuntu-9.04", name = "libgcc1", roles = [ "root" ], depends_on = [ "libc6" ], pkgFile = "libgcc1_4.3.3-5ubuntu4_i386.deb") # If you want networking, you'll need nss too .. deb.simple(builder, coName = "ubuntu-9.04", name = "libnss", roles = [ "root" ], depends_on = [ "libc6" ], pkgFile = "libnss3-1d_3.12.2-rc1-0ubuntu2_i386.deb") deb.simple(builder, coName = "ubuntu-9.04", name = "libnss-mdns", roles = [ "root" ], depends_on = [ "libc6" ], pkgFile = "libnss-mdns_0.10-3ubuntu2_i386.deb") # Some shells 'n' stuff :-) make.simple(builder, name = "busybox", roles = [ "root" ], checkout = "busybox-1.14.1", deps = [ "libc6" ], makefileName = "Makefile.muddle") make.simple(builder, name = "udev", roles = [ "root" ], checkout = "udev-142", deps = [ "libc6" ], makefileName = "Makefile.muddle") make.simple(builder, name = "etc-files", roles = [ "root" ], checkout = "etc-files", deps = [ "libc6" ], makefileName = "Makefile.muddle") # Not strictly necessary, but let's face it - you're # going to want DHCP make.simple(builder, name = "dhcpcd", roles = [ "root" ], checkout = "dhcpcd-5.0.4", deps = [ ], makefileName = "Makefile.muddle") # Declare the Ubuntu checkout explicitly, since the # deb builder obviously doesn't declare it every # time it's used. co_simple.relative(builder, "ubuntu-9.04") # OK. Deploy the ramdisk cpio.deploy(builder, "root.cpio", { "root" : "/" }, "root", [ "root" ]) # Construct a collector to take the cpio archive and kernel # we've built and put them somewhere convenient. collect.deploy(builder, "firmware") collect.copy_from_package_obj(builder, name = "firmware", pkg_name = "kernel", pkg_role = "kernel", rel = "obj/arch/i386/boot/bzImage", dest = "vmlinuz") collect.copy_from_deployment(builder, name = "firmware", dep_name = "root", rel = "root.cpio", dest = "initrd", recursive = False, copyExactly = False) builder.by_default_deploy_list(["root", "firmware"])
def describe_to(builder): """ Construct a very basic Linux system """ # We want a kernel.. linux_kernel.simple(builder, name="kernel", checkout="kernel-2.6.30-1", linux_dir="linux-2.6.30", config_file="kernel_config", kernel_version="2.6.30", makeInstall=False) # Steal a few basic libraries from Debian. deb.simple(builder, coName="ubuntu-9.04", name="libc6", roles=["root"], depends_on=[], pkgFile="libc6_2.9.4-ubuntu6_i386.deb") deb.simple(builder, coName="ubuntu-9.04", name="libgcc1", roles=["root"], depends_on=["libc6"], pkgFile="libgcc1_4.3.3-5ubuntu4_i386.deb") # If you want networking, you'll need nss too .. deb.simple(builder, coName="ubuntu-9.04", name="libnss", roles=["root"], depends_on=["libc6"], pkgFile="libnss3-1d_3.12.2-rc1-0ubuntu2_i386.deb") deb.simple(builder, coName="ubuntu-9.04", name="libnss-mdns", roles=["root"], depends_on=["libc6"], pkgFile="libnss-mdns_0.10-3ubuntu2_i386.deb") # Some shells 'n' stuff :-) make.simple(builder, name="busybox", roles=["root"], checkout="busybox-1.14.1", deps=["libc6"], makefileName="Makefile.muddle") make.simple(builder, name="udev", roles=["root"], checkout="udev-142", deps=["libc6"], makefileName="Makefile.muddle") make.simple(builder, name="etc-files", roles=["root"], checkout="etc-files", deps=["libc6"], makefileName="Makefile.muddle") # Not strictly necessary, but let's face it - you're # going to want DHCP make.simple(builder, name="dhcpcd", roles=["root"], checkout="dhcpcd-5.0.4", deps=[], makefileName="Makefile.muddle") # Declare the Ubuntu checkout explicitly, since the # deb builder obviously doesn't declare it every # time it's used. co_simple.relative(builder, "ubuntu-9.04") # OK. Deploy the ramdisk cpio.deploy(builder, "root.cpio", {"root": "/"}, "root", ["root"]) # Construct a collector to take the cpio archive and kernel # we've built and put them somewhere convenient. collect.deploy(builder, "firmware") collect.copy_from_package_obj(builder, name="firmware", pkg_name="kernel", pkg_role="kernel", rel="obj/arch/i386/boot/bzImage", dest="vmlinuz") collect.copy_from_deployment(builder, name="firmware", dep_name="root", rel="root.cpio", dest="initrd", recursive=False, copyExactly=False) builder.by_default_deploy_list(["root", "firmware"])