Beispiel #1
0
    def root_conf(self):
        """effects: determine the root parameters used for compilation
        returns: the path to the configuration file generated
        failures: incompatible root installation"""
        if not self.m_root_conf:
            file = os.path.join(self.bin(), "root_config_" + self.arch())
            ROOTSYS = os.getenv("ROOTSYS")
            if ROOTSYS == None:
                if os.path.isfile(file):
                    ROOTSYS = get_field(file, "ROOTSYS")
                    if ROOTSYS and ROOTSYS != "":
                        raise RCError("no valid root version found, try setting up root using\n" +
                                      "  source " + ROOTSYS + "/bin/thisroot.sh")
                if os.path.isdir("/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase"):
                    raise RCError("no valid root version found, try setting up root using\n" +
                                  "  export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase\n" +
                                  "  source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh\n" +
                                  "  localSetupROOT")
                if shell_exec(["which", "root-config"], allowFail=True) != "":
                    raise RCError("no valid root version found, try setting up root using\n" +
                                  "  source `root-config --prefix`/bin/thisroot.sh")
                raise RCError("no valid root version found, please set up root")

            if os.path.isfile(file):
                myrootversion = get_field(file, "ROOT_VERSION")
                if not myrootversion:
                    set_field(file, "ROOT_VERSION", self.root_version())
                elif self.root_version() != myrootversion:
                    myrootsys = get_field(file, "ROOTSYS")
                    raise RCError("Root Version: " + self.root_version() + "\n" +
                                  "is not the same as previous version:\n" +
                                  "   " + myrootversion + "\n" +
                                  "either set up the correct root version e.g. via:\n" +
                                  "  source " + myrootsys + "/bin/thisroot.sh\n" +
                                  "or clean out the old object files via:\n" +
                                  "  rc clean")
                self.m_root_conf = file
                return file

            myarch = shell_exec(["root-config", "--etcdir"]) + "/Makefile.arch"
            if not os.path.isfile(myarch):
                myarch = os.getenv("ROOTSYS") + "/share/doc/root/test/Makefile.arch"
            if not os.path.isfile(myarch):
                shell_args = ["find", os.getenv("ROOTSYS") + "/.",
                              "-name", "Makefile.arch"]
                search = shell_exec(shell_args).strip().split("\n")
                if len(search) > 0:
                    myarch = search[0]
            if not os.path.isfile(myarch):
                raise RCError("failed to find Makefile.arch in " + os.getenv("ROOTSYS"))

            with open(file + "-", "w") as f:
                shell_args = ["make", "-f", self.dir() + "/Makefile-print",
                              "MAKEFILE_ARCH=" + myarch]
                rc = shell_exec(shell_args, stdout=f, returnRC=True)
            if rc != 0:
                raise RCError("could not determine compilation parameters")
            os.rename(file + "-", file)
            self.m_root_conf = file
        return self.m_root_conf
Beispiel #2
0
 def write_config(self):
     """effects: write the configuration for the workarea as it is
     configured now"""
     if not os.path.isfile(self.config()):
         open(self.config(), "w").close()
     set_field(self.config(), "workareaRelative",
               self.relPath(self.area(), self.bin()))
     set_field(self.config(), "rootcoredir", self.compressPath(self.dir()))
     set_field(self.config(), "rootcoreobj", self.compressPath(self.obj()))
     set_field(self.config(), "rootcoreconf", self.arch())
     self.lnRel(os.path.join(self.dir(), "internal", "local_setup.sh"),
                os.path.join(self.bin(), "local_setup.sh"))
     self.lnRel(os.path.join(self.dir(), "internal", "local_setup.csh"),
                os.path.join(self.bin(), "local_setup.csh"))
Beispiel #3
0
 def write_config(self) :
     """effects: write the configuration for the workarea as it is
     configured now"""
     if not os.path.isfile(self.config()):
         open(self.config(), "w").close()
     set_field(self.config(), "workareaRelative",
               self.relPath(self.area(), self.bin()))
     set_field(self.config(), "rootcoredir", self.compressPath(self.dir()))
     set_field(self.config(), "rootcoreobj", self.compressPath(self.obj()))
     set_field(self.config(), "rootcoreconf", self.arch())
     self.lnRel(os.path.join(self.dir(), "internal", "local_setup.sh"),
                os.path.join(self.bin(), "local_setup.sh"))
     self.lnRel(os.path.join(self.dir(), "internal", "local_setup.csh"),
                os.path.join(self.bin(), "local_setup.csh"))
Beispiel #4
0
    def find_packages_write(self):
        """effects: write out the result of the find_packages
        operation"""
        RootCore = self.m_packages.getPkg("RootCore")
        if RootCore.srcdir() != self.dir():
            print "WARNING: RootCore installation changed, please setup again in a new shell"
            self.m_dir = RootCore.srcdir()

        CXXFLAGS = ""
        LDFLAGS = ""
        if os.getenv("CXXFLAGS"):
            CXXFLAGS = os.getenv("CXXFLAGS")
        if os.getenv("LDFLAGS"):
            LDFLAGS = os.getenv("LDFLAGS")
        if os.getenv("EXTRA_CFLAGS"):
            CXXFLAGS += " " + os.getenv("EXTRA_CFLAGS")
        if os.getenv("CPPEXFLAGS"):
            CXXFLAGS += " " + os.getenv("CPPEXFLAGS")
            LDFLAGS += " " + os.getenv("CPPEXFLAGS")
        set_field(self.config(), "CXXFLAGS", CXXFLAGS)
        set_field(self.config(), "LDFLAGS", LDFLAGS)
        set_field(self.config(), "use_pedantic", str(self.m_pedantic))
        self.write_config()
        self.writePackages(self.m_packages)
Beispiel #5
0
    def find_packages_write(self):
        """effects: write out the result of the find_packages
        operation"""
        RootCore = self.m_packages.getPkg("RootCore")
        if RootCore.srcdir() != self.dir():
            print "WARNING: RootCore installation changed, please setup again in a new shell"
            self.m_dir = RootCore.srcdir()

        CXXFLAGS = ""
        LDFLAGS = ""
        if os.getenv("CXXFLAGS"):
            CXXFLAGS = os.getenv("CXXFLAGS")
        if os.getenv("LDFLAGS"):
            LDFLAGS = os.getenv("LDFLAGS")
        if os.getenv("EXTRA_CFLAGS"):
            CXXFLAGS += " " + os.getenv("EXTRA_CFLAGS")
        if os.getenv("CPPEXFLAGS"):
            CXXFLAGS += " " + os.getenv("CPPEXFLAGS")
            LDFLAGS += " " + os.getenv("CPPEXFLAGS")
        set_field(self.config(), "CXXFLAGS", CXXFLAGS)
        set_field(self.config(), "LDFLAGS", LDFLAGS)
        set_field(self.config(), "use_pedantic", str(self.m_pedantic))
        self.write_config()
        self.writePackages(self.m_packages)
Beispiel #6
0
    def root_conf(self):
        """effects: determine the root parameters used for compilation
        returns: the path to the configuration file generated
        failures: incompatible root installation"""
        if not self.m_root_conf:
            file = os.path.join(self.bin(), "root_config_" + self.arch())
            ROOTSYS = os.getenv("ROOTSYS")
            if ROOTSYS == None:
                if os.path.isfile(file):
                    ROOTSYS = get_field(file, "ROOTSYS")
                    if ROOTSYS and ROOTSYS != "":
                        raise RCError(
                            "no valid root version found, try setting up root using\n"
                            + "  source " + ROOTSYS + "/bin/thisroot.sh")
                if os.path.isdir(
                        "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase"):
                    raise RCError(
                        "no valid root version found, try setting up root using\n"
                        +
                        "  export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase\n"
                        +
                        "  source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh\n"
                        + "  localSetupROOT")
                if shell_exec(["which", "root-config"], allowFail=True) != "":
                    raise RCError(
                        "no valid root version found, try setting up root using\n"
                        + "  source `root-config --prefix`/bin/thisroot.sh")
                raise RCError(
                    "no valid root version found, please set up root")

            if os.path.isfile(file):
                myrootversion = get_field(file, "ROOT_VERSION")
                if not myrootversion:
                    set_field(file, "ROOT_VERSION", self.root_version())
                elif self.root_version() != myrootversion:
                    myrootsys = get_field(file, "ROOTSYS")
                    raise RCError(
                        "Root Version: " + self.root_version() + "\n" +
                        "is not the same as previous version:\n" + "   " +
                        myrootversion + "\n" +
                        "either set up the correct root version e.g. via:\n" +
                        "  source " + myrootsys + "/bin/thisroot.sh\n" +
                        "or clean out the old object files via:\n" +
                        "  rc clean")
                self.m_root_conf = file
                return file

            myarch = shell_exec(["root-config", "--etcdir"]) + "/Makefile.arch"
            if not os.path.isfile(myarch):
                myarch = os.getenv(
                    "ROOTSYS") + "/share/doc/root/test/Makefile.arch"
            if not os.path.isfile(myarch):
                shell_args = [
                    "find",
                    os.getenv("ROOTSYS") + "/.", "-name", "Makefile.arch"
                ]
                search = shell_exec(shell_args).strip().split("\n")
                if len(search) > 0:
                    myarch = search[0]
            if not os.path.isfile(myarch):
                raise RCError("failed to find Makefile.arch in " +
                              os.getenv("ROOTSYS"))

            with open(file + "-", "w") as f:
                shell_args = [
                    "make", "-f",
                    self.dir() + "/Makefile-print", "MAKEFILE_ARCH=" + myarch
                ]
                rc = shell_exec(shell_args, stdout=f, returnRC=True)
            if rc != 0:
                raise RCError("could not determine compilation parameters")
            os.rename(file + "-", file)
            self.m_root_conf = file
        return self.m_root_conf
Beispiel #7
0
"""Django definitions for the administrator site urls."""
from rotest.frontend import views
from django.contrib import admin
from django.conf.urls import include, url

import utils

urlpatterns = [
    url(r'^api/rotest/release_owner/(?P<data_name>.*?)/?$',
        utils.set_field("owner"),
        name="remove_resource_owner"),
    url(r'^api/rotest/release_reserved/(?P<data_name>.*?)/?$',
        utils.set_field("reserved"),
        name="remove_resource_reserved"),
    url(r'^api/rotest/lock_resource/(?P<data_name>.*?)/?$',
        utils.lock_resource,
        name="lock_resource"),
    url(r'^/?$', "rotest.frontend.views.index"),
]