Пример #1
0
def create(builder,
           name,
           role,
           pkgs_and_roles,
           custom_depmod=None,
           subdir="/lib/modules"):
    """
    Create a depmod_merge . It will depend on each of the mentioned packages.

    pkgs is a list of (pkg, role) pairs.

    We return the depmod_merge we've created.
    """

    action = MergeDepModBuilder(name, role, custom_depmod)

    pkg.add_package_rules(builder.ruleset, name, role, action)
    pkg.do_depend(builder, name, [role], pkgs_and_roles)

    for (pname, role) in pkgs_and_roles:
        lbl = depend.Label(utils.LabelType.Package, pname, role,
                           utils.LabelTag.PostInstalled)
        action.add_label(lbl, subdir)

    return action
Пример #2
0
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)
Пример #3
0
def create(builder, name, role,
           pkgs_and_roles,
           custom_depmod = None,
           subdir = "/lib/modules"):
    """
    Create a depmod_merge . It will depend on each of the mentioned packages.

    pkgs is a list of (pkg, role) pairs.

    We return the depmod_merge we've created.
    """

    action = MergeDepModBuilder(name, role, custom_depmod)

    pkg.add_package_rules(builder.ruleset, name, role, action)
    pkg.do_depend(builder, name, [role], pkgs_and_roles)

    for (pname, role) in pkgs_and_roles:
        lbl = depend.Label(utils.LabelType.Package,
                           pname,
                           role,
                           utils.LabelTag.PostInstalled)
        action.add_label(lbl, subdir)

    return action
Пример #4
0
def simple(builder, name, role, apt_pkgs, os_version=None):
    """
    Construct an apt-alt package in the given role with the given apt_pkgs, 
    which are dictionaries:
    (name : 'name', min-version : , exact-version : , max-version: , repo : )
    """
    the_pkg = AptAltBuilder(name, role, apt_pkgs, os_version)
    pkg.add_package_rules(builder.ruleset, name, role, the_pkg)
Пример #5
0
def simple(builder, name, role, apt_pkgs, os_version=None):
    """
    Construct an apt-alt package in the given role with the given apt_pkgs, 
    which are dictionaries:
    (name : 'name', min-version : , exact-version : , max-version: , repo : )
    """
    the_pkg = AptAltBuilder(name, role, apt_pkgs, os_version)
    pkg.add_package_rules(builder.ruleset, name, role, the_pkg)
Пример #6
0
def expanding_package(builder, name, archive_dir,
                      role, co_name, co_dir,
                      makefile=DEFAULT_MAKEFILE_NAME, deps=None,
                      archive_file=None, archive_ext='.tar.bz2',):
    """Specify how to expand and build an archive file.

    As normal, 'name' is the package name, 'role' is the role to build it in,
    'co_name' is the name of the checkout, and 'co_dir' is the directory in
    which that lives.

    We expect to unpack an archive

        <co_dir>/<co_name>/<archive_dir><archive_ext>

    into $(MUDDLE_OBJ)/<archive_dir>. (NB: if the archive file does not expand into
    a directory of the obvious name, you can specify the archive file name separately,
    using 'archive_file').

    So, for instance, all of our X11 "stuff" lives in checkout "X11R7.5" which is
    put into directory "x11" -- i.e., "src/X11/X11R7.5".

    That lets us keep stuff together in the repository, without leading to
    a great many packages that are of no direct interest to anyone else.

    Within that we then have various muddle makefiles, and a set of .tar.bz
    archive files.

    1. The archive file expands into a directory called 'archive_dir'
    2. It is assumed that the archive file is named 'archive_dir' + 'archive_ext'.
       If this is not so, then specify 'archive_file' (and/or 'archive_ext')
       appropriately.

    This function is used to say: take the named archive file, use package name
    'name', unpack the archive file into $(MUDDLE_OBJ_OBJ), and build it using
    the named muddle makefile.

    This allows various things to be build with the same makefile, which is useful
    for (for instance) X11 proto[type] archives.

    Note that in $(MUDDLE_OBJ), 'obj' (i.e., $(MUDDLE_OBJ_OBJ)) will be a soft link
    to the expanded archive directory.
    """
    if archive_file is None:
        archive_file = archive_dir + archive_ext

    # Define how to build our package
    dep = ExpandingMakeBuilder(name, role, co_name, archive_file, archive_dir, makefile)
    pkg.add_package_rules(builder.ruleset, name, role, dep)

    # It depends on the checkout
    pkg.package_depends_on_checkout(builder.ruleset, name, role, co_name)

    # And maybe on other packages
    if deps:
        pkg.do_depend(builder, name, [role], deps)
Пример #7
0
def simple(builder,
           coName,
           name,
           roles,
           depends_on=[],
           pkgFile=None,
           debName=None,
           instrFile=None,
           postInstallMakefile=None,
           isDev=False,
           nonDevCoName=None,
           nonDevPkgFile=None):
    """
    Build a package called 'name' from co_name / pkg_file with
    an instruction file called instr_file.

    'name' is the name of the muddle package and of the debian package.
    if you want them different, set deb_name to something other than
    None.

    Set isDev to True for a dev package, False for an ordinary
    binary package. Dev packages are installed into the object
    directory where MUDDLE_INC_DIRS etc. expects to look for them.
    Actual packages are installed into the installation directory
    where they will be transported to the target system.
    """
    if (debName is None):
        debName = name

    if (pkgFile is None):
        pkgFile = debName

    for r in roles:
        if isDev:
            dep = DebDevAction(name,
                               r,
                               coName,
                               debName,
                               pkgFile,
                               instrFile,
                               postInstallMakefile,
                               nonDevCoName=nonDevCoName,
                               nonDevPkgFile=nonDevPkgFile)
        else:
            dep = DebAction(name, r, coName, debName, pkgFile, instrFile,
                            postInstallMakefile)

        pkg.add_package_rules(builder.ruleset, name, r, dep)
        # We should probably depend on the checkout .. .
        pkg.package_depends_on_checkout(builder.ruleset, name, r, coName, dep)
        # .. and some other packages. Y'know, because we can ..
        pkg.package_depends_on_packages(builder.ruleset, name, r,
                                        utils.LabelTag.PreConfig, depends_on)
Пример #8
0
def simple(builder, name, roles,
           filename = "/version.xml",
           swname = None,
           version = None,
           build = None,
           withDate = True,
           withUser = True,
           withMachine = True):

    for r in roles:
        the_pkg = VersionBuilder(name, r, filename,
                                 swname, version, build, withDate, withUser, withMachine)
        pkg.add_package_rules(builder.ruleset, name, r, the_pkg)
Пример #9
0
def simple(builder, name, role, script_name, deployments = [ ],
           writeSetvarsSh = True,
           writeSetvarsPy = False):
    """
    Build an init script for the given role.
    """

    the_pkg = InitScriptBuilder(name, role, script_name,
                                deployments,
                                writeSetvarsSh = writeSetvarsSh,
                                writeSetvarsPy = writeSetvarsPy)
    pkg.add_package_rules(builder.ruleset, name, role, the_pkg)
    setup_default_env(builder, get_env(builder, name, role))
Пример #10
0
def simple(builder,
           name,
           roles,
           filename="/version.xml",
           swname=None,
           version=None,
           build=None,
           withDate=True,
           withUser=True,
           withMachine=True):

    for r in roles:
        the_pkg = VersionBuilder(name, r, filename, swname, version, build,
                                 withDate, withUser, withMachine)
        pkg.add_package_rules(builder.ruleset, name, r, the_pkg)
Пример #11
0
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)
Пример #12
0
def simple(builder, coName, name, roles,
           depends_on = [ ],
           pkgFile = None, debName = None, instrFile = None,
           postInstallMakefile = None, isDev = False,
           nonDevCoName = None,
           nonDevPkgFile = None):
    """
    Build a package called 'name' from co_name / pkg_file with
    an instruction file called instr_file.

    'name' is the name of the muddle package and of the debian package.
    if you want them different, set deb_name to something other than
    None.

    Set isDev to True for a dev package, False for an ordinary
    binary package. Dev packages are installed into the object
    directory where MUDDLE_INC_DIRS etc. expects to look for them.
    Actual packages are installed into the installation directory
    where they will be transported to the target system.
    """
    if (debName is None):
        debName = name


    if (pkgFile is None):
        pkgFile = debName

    for r in roles:
        if isDev:
            dep = DebDevAction(name, r, coName, debName,
                               pkgFile, instrFile,
                               postInstallMakefile,
                               nonDevCoName = nonDevCoName,
                               nonDevPkgFile = nonDevPkgFile)
        else:
            dep = DebAction(name, r, coName, debName,
                            pkgFile, instrFile,
                            postInstallMakefile)

        pkg.add_package_rules(builder.ruleset, name, r, dep)
        # We should probably depend on the checkout .. .
        pkg.package_depends_on_checkout(builder.ruleset,
                                        name, r, coName, dep)
        # .. and some other packages. Y'know, because we can ..
        pkg.package_depends_on_packages(builder.ruleset,
                                        name, r, utils.LabelTag.PreConfig,
                                        depends_on)
Пример #13
0
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)
Пример #14
0
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)
Пример #15
0
def simple(builder, name, role, apt_pkgs, os_version=None):
    """
    Construct an apt-get package in the given role with the given apt_pkgs.

    Note that apt_pkgs can be an OS package name or a Choice - see
    the documentation for AptGetBuilder for more details.

    For instance (note: not a real example - the dependencies don't make
    sense!)::

        from muddled.utils import Choice
        from muddled.pkgs import aptget
        aptget.simple(builder, "host_packages", "host_environment",
               [
               "gcc-multilib",
               "g++-multilib",
               "lib32ncurses5-dev",
               "lib32z1-dev",
               "bison",
               "flex",
               "gperf",
               "libx11-dev",
               # On Ubuntu 11 or 12, choose icedtea-7, otherwise icedtea-6
               Choice([ ("ubuntu 1[12].*", "icedtea-7-jre"),
                        ("ubuntu *", "icedtea-6-jre") ]),
               # On Ubuntu 10 or later, use libgtiff5
               # On Ubuntu 3 through 9, use libgtiff4
               # Otherwise, just don't try to use libgtiff
               Choice([ ("ubuntu 1?", "libgtiff5"),
                        ("ubuntu [3456789]", "libgtiff4"),
                        None ])
               ])
    """

    the_pkg = AptGetBuilder(name, role, apt_pkgs, os_version)
    pkg.add_package_rules(builder.ruleset, name, role, the_pkg)
Пример #16
0
def simple(builder, name, role, apt_pkgs, os_version=None):
    """
    Construct an apt-get package in the given role with the given apt_pkgs.

    Note that apt_pkgs can be an OS package name or a Choice - see
    the documentation for AptGetBuilder for more details.

    For instance (note: not a real example - the dependencies don't make
    sense!)::

        from muddled.utils import Choice
        from muddled.pkgs import aptget
        aptget.simple(builder, "host_packages", "host_environment",
               [
               "gcc-multilib",
               "g++-multilib",
               "lib32ncurses5-dev",
               "lib32z1-dev",
               "bison",
               "flex",
               "gperf",
               "libx11-dev",
               # On Ubuntu 11 or 12, choose icedtea-7, otherwise icedtea-6
               Choice([ ("ubuntu 1[12].*", "icedtea-7-jre"),
                        ("ubuntu *", "icedtea-6-jre") ]),
               # On Ubuntu 10 or later, use libgtiff5
               # On Ubuntu 3 through 9, use libgtiff4
               # Otherwise, just don't try to use libgtiff
               Choice([ ("ubuntu 1?", "libgtiff5"),
                        ("ubuntu [3456789]", "libgtiff4"),
                        None ])
               ])
    """

    the_pkg = AptGetBuilder(name, role, apt_pkgs, os_version)
    pkg.add_package_rules(builder.ruleset, name, role, the_pkg)
Пример #17
0
def expanding_package(
    builder,
    name,
    archive_dir,
    role,
    co_name,
    co_dir,
    makefile=DEFAULT_MAKEFILE_NAME,
    deps=None,
    archive_file=None,
    archive_ext='.tar.bz2',
):
    """Specify how to expand and build an archive file.

    As normal, 'name' is the package name, 'role' is the role to build it in,
    'co_name' is the name of the checkout, and 'co_dir' is the directory in
    which that lives.

    We expect to unpack an archive

        <co_dir>/<co_name>/<archive_dir><archive_ext>

    into $(MUDDLE_OBJ)/<archive_dir>. (NB: if the archive file does not expand into
    a directory of the obvious name, you can specify the archive file name separately,
    using 'archive_file').

    So, for instance, all of our X11 "stuff" lives in checkout "X11R7.5" which is
    put into directory "x11" -- i.e., "src/X11/X11R7.5".

    That lets us keep stuff together in the repository, without leading to
    a great many packages that are of no direct interest to anyone else.

    Within that we then have various muddle makefiles, and a set of .tar.bz
    archive files.

    1. The archive file expands into a directory called 'archive_dir'
    2. It is assumed that the archive file is named 'archive_dir' + 'archive_ext'.
       If this is not so, then specify 'archive_file' (and/or 'archive_ext')
       appropriately.

    This function is used to say: take the named archive file, use package name
    'name', unpack the archive file into $(MUDDLE_OBJ_OBJ), and build it using
    the named muddle makefile.

    This allows various things to be build with the same makefile, which is useful
    for (for instance) X11 proto[type] archives.

    Note that in $(MUDDLE_OBJ), 'obj' (i.e., $(MUDDLE_OBJ_OBJ)) will be a soft link
    to the expanded archive directory.
    """
    if archive_file is None:
        archive_file = archive_dir + archive_ext

    # Define how to build our package
    dep = ExpandingMakeBuilder(name, role, co_name, archive_file, archive_dir,
                               makefile)
    pkg.add_package_rules(builder.ruleset, name, role, dep)

    # It depends on the checkout
    pkg.package_depends_on_checkout(builder.ruleset, name, role, co_name)

    # And maybe on other packages
    if deps:
        pkg.do_depend(builder, name, [role], deps)