Exemplo n.º 1
0
    def build_label(self, builder, label):
        """
        Build the relevant label. We'll assume that the
        checkout actually exists.
        """
        tag = label.tag

        self.ensure_dirs(builder, label)

        # XXX We have no way of remembering a checkout in a different domain
        # XXX (from the label we're building) so for the moment we won't even
        # XXX try...
        tmp = Label(utils.LabelType.Checkout, self.co, domain=label.domain)
        co_path = builder.db.get_checkout_path(tmp)
        with Directory(co_path):
            self._amend_env(co_path)

            makefile_name = deduce_makefile_name(self.makefile_name,
                                                 self.per_role_makefiles,
                                                 label.role)

            make_cmd = self._make_command(builder, makefile_name)

            if (tag == utils.LabelTag.PreConfig):
                # Preconfigure - nothing need be done
                pass
            elif (tag == utils.LabelTag.Configured):
                # We should probably do the configure thing ..
                if (self.has_make_config):
                    utils.run0(make_cmd + ["config"])
            elif (tag == utils.LabelTag.Built):
                utils.run0(make_cmd)
            elif (tag == utils.LabelTag.Installed):
                utils.run0(make_cmd + ["install"])
            elif (tag == utils.LabelTag.PostInstalled):
                if (self.rewriteAutoconf):
                    #print "> Rewrite autoconf for label %s"%(label)
                    obj_path = builder.package_obj_path(label)
                    #print ">obj_path = %s"%(obj_path)
                    if (self.execRelPath is None):
                        sendExecPrefix = None
                    else:
                        sendExecPrefix = os.path.join(obj_path,
                                                      self.execRelPath)

                    rewrite.fix_up_pkgconfig_and_la(builder,
                                                    obj_path,
                                                    execPrefix=sendExecPrefix)
            elif (tag == utils.LabelTag.Clean):
                utils.run0(make_cmd + ["clean"])
            elif (tag == utils.LabelTag.DistClean):
                utils.run0(make_cmd + ["distclean"])
            else:
                raise utils.MuddleBug("Invalid tag specified for "
                                      "MakePackage building %s" % (label))
Exemplo n.º 2
0
    def build_label(self, builder, label):
        """
        Actually install the dev package.
        """
        self.ensure_dirs(builder, label)

        tag = label.tag

        if (tag == utils.LabelTag.PreConfig):
            # Nothing to do
            pass
        elif (tag == utils.LabelTag.Configured):
            pass
        elif (tag == utils.LabelTag.Built):
            pass
        elif (tag == utils.LabelTag.Installed):
            # Extract into /obj
            inv = builder
            extract_into_obj(inv, self.co_name, label, self.pkg_file)
            if (self.nonDevPkgFile is not None):
                extract_into_obj(inv, self.nonDevCoName, label,
                                 self.nonDevPkgFile)

            # Now we rewrite all the absolute links to be relative to the install
            # directory.
            rewrite_links(inv, label)

        elif (tag == utils.LabelTag.PostInstalled):
            if self.post_install_makefile is not None:
                inv = builder
                tmp = Label(utils.LabelType.Checkout,
                            self.co_name,
                            domain=label.domain)
                co_path = inv.checkout_path(tmp)
                with Directory(co_path):
                    utils.run0([
                        "make", "-f", self.post_install_makefile,
                        "%s-postinstall" % (label.name)
                    ])

            # .. and now we rewrite any pkgconfig etc. files left lying
            # about.
            obj_path = builder.package_obj_path(label)
            print "> Rewrite .pc and .la files in %s" % (obj_path)
            rewrite.fix_up_pkgconfig_and_la(builder, obj_path)

        elif (tag == utils.LabelTag.Clean or tag == utils.LabelTag.DistClean):
            # Just remove the object directory.
            inv = builder
            utils.recursively_remove(inv.package_obj_path(label))
        else:
            raise utils.MuddleBug("Invalid tag specified for deb pkg %s" %
                                  (label))
Exemplo n.º 3
0
    def build_label(self, builder, label):
        """
        Build the relevant label. We'll assume that the
        checkout actually exists.
        """
        tag = label.tag

        self.ensure_dirs(builder, label)

        # XXX We have no way of remembering a checkout in a different domain
        # XXX (from the label we're building) so for the moment we won't even
        # XXX try...
        tmp = Label(utils.LabelType.Checkout, self.co, domain=label.domain)
        co_path =  builder.db.get_checkout_path(tmp)
        with Directory(co_path):
            self._amend_env(co_path)

            makefile_name = deduce_makefile_name(self.makefile_name,
                                                 self.per_role_makefiles,
                                                 label.role)

            make_cmd = self._make_command(builder, makefile_name)

            if (tag == utils.LabelTag.PreConfig):
                # Preconfigure - nothing need be done
                pass
            elif (tag == utils.LabelTag.Configured):
                # We should probably do the configure thing ..
                if (self.has_make_config):
                    utils.run0(make_cmd + ["config"])
            elif (tag == utils.LabelTag.Built):
                utils.run0(make_cmd)
            elif (tag == utils.LabelTag.Installed):
                utils.run0(make_cmd + ["install"])
            elif (tag == utils.LabelTag.PostInstalled):
                if (self.rewriteAutoconf):
                    #print "> Rewrite autoconf for label %s"%(label)
                    obj_path = builder.package_obj_path(label)
                    #print ">obj_path = %s"%(obj_path)
                    if (self.execRelPath is None):
                        sendExecPrefix = None
                    else:
                        sendExecPrefix = os.path.join(obj_path, self.execRelPath)

                    rewrite.fix_up_pkgconfig_and_la(builder, obj_path, execPrefix = sendExecPrefix)
            elif (tag == utils.LabelTag.Clean):
                utils.run0(make_cmd + ["clean"])
            elif (tag == utils.LabelTag.DistClean):
                utils.run0(make_cmd + ["distclean"])
            else:
                raise utils.MuddleBug("Invalid tag specified for "
                                  "MakePackage building %s"%(label))
Exemplo n.º 4
0
    def build_label(self, builder, label):
        """
        Actually install the dev package.
        """
        self.ensure_dirs(builder, label)

        tag = label.tag

        if (tag == utils.LabelTag.PreConfig):
            # Nothing to do
            pass
        elif (tag == utils.LabelTag.Configured):
            pass
        elif (tag == utils.LabelTag.Built):
            pass
        elif (tag == utils.LabelTag.Installed):
            # Extract into /obj
            inv = builder
            extract_into_obj(inv, self.co_name, label, self.pkg_file)
            if (self.nonDevPkgFile is not None):
                extract_into_obj(inv, self.nonDevCoName, label, self.nonDevPkgFile)

            # Now we rewrite all the absolute links to be relative to the install
            # directory.
            rewrite_links(inv, label)


        elif (tag == utils.LabelTag.PostInstalled):
            if self.post_install_makefile is not None:
                inv = builder
                tmp = Label(utils.LabelType.Checkout, self.co_name, domain=label.domain)
                co_path = inv.checkout_path(tmp)
                with Directory(co_path):
                    utils.run0(["make", "-f", self.post_install_makefile,
                                "%s-postinstall"%(label.name)])

            # .. and now we rewrite any pkgconfig etc. files left lying
            # about.
            obj_path = builder.package_obj_path(label)
            print "> Rewrite .pc and .la files in %s"%(obj_path)
            rewrite.fix_up_pkgconfig_and_la(builder, obj_path)

        elif (tag == utils.LabelTag.Clean or tag == utils.LabelTag.DistClean):
            # Just remove the object directory.
            inv = builder
            utils.recursively_remove(inv.package_obj_path(label))
        else:
            raise utils.MuddleBug("Invalid tag specified for deb pkg %s"%(label))