Esempio n. 1
0
  def doinstall(self, env):
    dir = self.package().fetch(env)
    name = self.package().name()
    version = self.package().version()
    
    os.chdir(dir)
    args = self._args
    if self._foptionalarg != None:
      extraarg = self._foptionalarg(env)
      if extraarg != None:
        args = "%s %s"%(args, extraarg)

    argstr = env.expandArgs(args)
    code = subprocess.call("./configure %s"%argstr, shell=True)
    if code != 0:
      raise InstallerException("Failed to configure software %s (%s)"%(name,version))
    
    code = subprocess.call("make", shell=True)
    if code != 0:
      raise InstallerException("Failed to compile software %s (%s)"%(name,version))

    if self._test == True:
      if self._foptionaltest == None or self._foptionaltest(env) == True:
        code = subprocess.call("make test", shell=True)
        if code != 0:
          raise InstallerException("Failed to test software %s (%s)"%(name,version))
    
    if self._install == True:
      code = subprocess.call("make install", shell=True)
      if code != 0:
        raise InstallerException("Failed to install software %s (%s)"%(name,version))

    if self._fpostinstall != None:
      self._fpostinstall(env)
Esempio n. 2
0
    def doinstall(self, env):
        script = env.getNodeScript()

        #if not os.path.exists(env.expandArgs("$TPREFIX/ant/lib/catalina-ant.jar")):
        shutil.copyfile(env.expandArgs("$TPREFIX/tomcat/lib/catalina-ant.jar"),
                        env.expandArgs("$TPREFIX/ant/lib/catalina-ant.jar"))
        # New files to copy
        shutil.copyfile(
            env.expandArgs("$TPREFIX/tomcat/lib/tomcat-coyote.jar"),
            env.expandArgs("$TPREFIX/ant/lib/tomcat-coyote.jar"))
        shutil.copyfile(env.expandArgs("$TPREFIX/tomcat/lib/tomcat-util.jar"),
                        env.expandArgs("$TPREFIX/ant/lib/tomcat-util.jar"))
        shutil.copyfile(env.expandArgs("$TPREFIX/tomcat/bin/tomcat-juli.jar"),
                        env.expandArgs("$TPREFIX/ant/lib/tomcat-juli.jar"))

        self._setup_permissions(env)

        script.restart(node=True)

        tmppath = tempfile.mkdtemp(prefix='baltradnode')
        foldername = os.path.basename(tmppath)

        fpd, tmpwarpath = tempfile.mkstemp(suffix=".war", prefix="deploy")
        try:
            os.close(fpd)
        except:
            pass
        tmpwar = os.path.basename(tmpwarpath)

        warFile = env.expandArgs("$PREFIX/BaltradDex/bin/BaltradDex.war")
        if env.hasArg("WARFILE") and env.getArg("WARFILE") != None:
            warFile = env.getArg("WARFILE")

        cdir = os.getcwd()
        os.chdir(tmppath)
        try:
            ocode = subprocess.call(env.expandArgs(
                "$JDKHOME/bin/jar -xvf %s  > /dev/null 2>&1" % warFile),
                                    shell=True)
            if ocode != 0:
                raise InstallerException("Could not extract war")
            self._write_dex_fc_properties(env)
            self._write_dex_beast_properties(env)
            self._write_db_properties(env)
            self._copy_dex_properties(env)
            self._write_bdb_bean_config(env)
            self._update_appcontext_for_secure_comm(env)
            self._insert_help_documentation(env)
            os.chdir("..")
            ocode = subprocess.call(env.expandArgs(
                "$JDKHOME/bin/jar cf %s -C %s/ ." % (tmpwar, foldername)),
                                    shell=True)
            if ocode != 0:
                raise InstallerException("Could not pack war")
            self._deploywar(env, tmpwarpath)
            self._modify_db_properties_permission(env)
        finally:
            os.chdir(cdir)
            shutil.rmtree(tmppath, True)
Esempio n. 3
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)
        self.osenvironment().setEnvironmentVariable(
            env, "LD_LIBRARY_PATH", "%s:%s" %
            (env.getLdLibraryPath(),
             self.osenvironment().getSnapshotVariable("LD_LIBRARY_PATH")))
        self.osenvironment().setEnvironmentVariable(
            env, "PATH", "%s:%s" %
            (env.getPath(), self.osenvironment().getSnapshotVariable("PATH")))

        # Dont check error code for distclean, it will fail if fresh build
        # so we wait with failing until next call is performed
        subprocess.call("make distclean", shell=True)

        cmd = "./configure --prefix=\"$PREFIX/bropo\" --with-rave=\"$PREFIX/rave\""
        newcmd = env.expandArgs(cmd)

        ocode = subprocess.call(newcmd, shell=True)
        if ocode != 0:
            raise InstallerException("Failed to configure bropo")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build bropo")

        ocode = subprocess.call("make test", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to test bropo")

        ocode = subprocess.call("make doc > /dev/null 2>&1", shell=True)
        if ocode != 0:
            print("Failed to generate BROPO documentation")
        else:
            self._install_doc(env)

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install bropo")

        python_bin = "python"
        if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3"):
            python_bin = "python3"

        cmd = python_bin + " -c \"import sys;import os;print(os.sep.join([sys.prefix, 'lib', 'python'+sys.version[:3],'site-packages']))\""
        plc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                               shell=True).communicate()[0]
        foutname = "%s/bropo.pth" % plc.decode('utf-8').strip()

        try:
            fp = open(foutname, "w")
            fp.write(env.expandArgs("$PREFIX/bropo/share/bropo/pyropo"))
            fp.close()
        except Exception as e:
            raise InstallerException(
                "Failed to generate bropo.pth in python site-packages, %s" %
                str(e.__str__()))
Esempio n. 4
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)
        self.osenvironment().setEnvironmentVariable(
            env, "LD_LIBRARY_PATH", "%s:%s" %
            (env.getLdLibraryPath(),
             self.osenvironment().getSnapshotVariable("LD_LIBRARY_PATH")))
        self.osenvironment().setEnvironmentVariable(
            env, "PATH", "%s:%s" %
            (env.getPath(), self.osenvironment().getSnapshotVariable("PATH")))

        # Dont check error code for distclean, it will fail if fresh build
        # so we wait with failing until next call is performed
        subprocess.call("make distclean", shell=True)

        cmd = "./configure --prefix=\"$PREFIX/beamb\" --with-rave=\"$PREFIX/rave\""
        newcmd = env.expandArgs(cmd)

        ocode = subprocess.call(newcmd, shell=True)
        if ocode != 0:
            raise InstallerException("Failed to configure beamb")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build beamb")

        ocode = subprocess.call("make test", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to test beamb")

        cversion = self.package().version()  # This packages version
        cname = self.package().name(
        )  # Just get the name we use for this package
        iversion = env.getCurrentlyInstalled(cname)

        if iversion != cversion:
            ocode = subprocess.call("make clean_cache", shell=True)
            if ocode != 0:
                print("Failed to clean beamb cache")

        #version = self.package().version()
        #name = self.package().name()
        #env.getInstalled(name) != version:

        ocode = subprocess.call("make doc > /dev/null 2>&1", shell=True)
        if ocode != 0:
            print("Failed to generate BEAMB documentation")
        else:
            self._install_doc(env)

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install beamb")
Esempio n. 5
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)

        # Dont check error code for distclean, it will fail if fresh build
        # so we wait with failing until next call is performed
        subprocess.call("make distclean", shell=True)

        cmd = "./configure --prefix=\"$PREFIX/hlhdf\""
        if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3"):
            cmd = cmd + " --enable-py3support"
        cmd = cmd + " --with-hdf5=$TPREFIX/include,$TPREFIX/lib"
        zarg = self.get_zlib_arg(env)
        if zarg != None:
            cmd = "%s %s" % (cmd, zarg)

        newcmd = env.expandArgs(cmd)

        ocode = subprocess.call(newcmd, shell=True)
        if ocode != 0:
            raise InstallerException("Failed to configure hlhdf")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build hlhdf")

        #if platform.machine() == 'x86_64':
        #  ocode = subprocess.call("make test", shell=True)
        #  if ocode != 0:
        #    raise InstallerException("Failed to test hlhdf")

        ocode = subprocess.call("make doc > /dev/null 2>&1", shell=True)
        if ocode != 0:
            print("Failed to generate HLHDF documentation")
        else:
            self._install_doc(env)

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install hlhdf")

        python_bin = "python"
        if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3"):
            python_bin = "python3"

        # Use the installed pythons site-packages location
        cmd = python_bin + " -c \"import sys;import os;print(os.sep.join([sys.prefix, 'lib', 'python'+sys.version[:3],'site-packages']))\""
        plc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                               shell=True).communicate()[0]
        shutil.copy(env.expandArgs("$PREFIX/hlhdf/hlhdf.pth"),
                    "%s/" % plc.decode('utf-8').strip())
Esempio n. 6
0
def validate_fwdports(arg):
    tokens = arg.split(",")
    if len(tokens) != 2:
        raise InstallerException(
            "--tomcatfwdports should be called like --tomcatfwdports=<httpport>,<httpsport> where httpport and httpsport is a number"
        )
    try:
        a1 = int(tokens[0])
        a2 = int(tokens[1])
    except:
        raise InstallerException(
            "--tomcatfwdports should be called like --tomcatfwdports=<httpport>,<httpsport> where httpport and httpsport is a number"
        )
Esempio n. 7
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)

        if not env.isExcluded("BBUFR"):
            self.osenvironment().setEnvironmentVariable(
                env, "BUFRARG", "$PREFIX/bbufr")

        if env.hasArg("ENABLE_NETCDF") and env.getArg("ENABLE_NETCDF") == True:
            netcdfinc = env.expandArgs("$TPREFIX/include")
            netcdflib = env.expandArgs("$TPREFIX/lib")
            self.osenvironment().setEnvironmentVariable(
                env, "NETCDFARG", "%s,%s" % (netcdfinc, netcdflib))

        if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3") == True:
            self.osenvironment().setEnvironmentVariable(
                env, "ENABLEPY3SUPPORT", "yes")

        self.osenvironment().setEnvironmentVariable(
            env, "LD_LIBRARY_PATH", "%s:%s" %
            (env.getLdLibraryPath(),
             self.osenvironment().getSnapshotVariable("LD_LIBRARY_PATH")))
        self.osenvironment().setEnvironmentVariable(
            env, "PATH", "%s:%s" %
            (env.getPath(), self.osenvironment().getSnapshotVariable("PATH")))

        ocode = subprocess.call("make distclean", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to perform distclean")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build")

        ocode = subprocess.call("make test", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to test")

        ocode = subprocess.call("make doc > /dev/null 2>&1", shell=True)
        if ocode != 0:
            print("Failed to generate RAVE documentation")
        else:
            self._install_doc(env)

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install")

        self._update_pgf_registry(env)
        self._update_pgf_quality_registry(env)
Esempio n. 8
0
def filter_subsystems(modules, subsystems):
    result = []
    main_filter = []

    for s in subsystems:
        if not s in VALID_SUBSYSTEMS:
            raise InstallerException("Invalid subsystem: %s" % s)

    if "BDB" in subsystems:
        main_filter.extend(BDB_FILTER)

    if "RAVE" in subsystems:
        main_filter.extend(RAVE_FILTER)

    if "STANDALONE_RAVE" in subsystems:
        main_filter.extend(STANDALONE_RAVE)

    if "DEX" in subsystems:
        main_filter.extend(DEX_FILTER)

    for module in modules:
        if module.package().name() in main_filter:
            result.append(module)

    return result
Esempio n. 9
0
    def _update_pgf_registry(self, env):
        if os.path.exists("tmpreg.py"):
            os.unlink("tmpreg.py")
        fp = open("tmpreg.py", "w")
        fp.write(
            env.expandArgs("""
from rave_pgf_registry import PGF_Registry
a=PGF_Registry(filename="$PREFIX/rave/etc/rave_pgf_registry.xml")
a.deregister('eu.baltrad.beast.generatesite2d')
a.register('eu.baltrad.beast.generatesite2d', 'rave_pgf_site2D_plugin', 'generate', 'Generate Site2D plugin', 'area,quantity,method,date,time,anomaly-qc,qc-mode,prodpar,applygra,ignore-malfunc,ctfilter,pcsid,algorithm_id', '', 'height,range,zrA,zrb,xscale,yscale')
a.deregister('eu.baltrad.beast.generatecomposite')
a.register('eu.baltrad.beast.generatecomposite', 'rave_pgf_composite_plugin', 'generate', 'Generate composite plugin', 'area,quantity,method,date,time,selection,anomaly-qc,qc-mode,reprocess_qfields,prodpar,applygra,ignore-malfunc,ctfilter,qitotal_field,algorithm_id,merge', '', 'height,range,zrA,zrb')
a.deregister('eu.baltrad.beast.generatevolume')
a.register('eu.baltrad.beast.generatevolume', 'rave_pgf_volume_plugin', 'generate', 'Polar volume generation from individual scans', 'source,date,time,anomaly-qc,qc-mode,algorithm_id,merge', '', 'height,range,zrA,zrb')
a.deregister('se.smhi.rave.creategmapimage')
a.register('se.smhi.rave.creategmapimage', 'googlemap_pgf_plugin', 'generate', 'Google Map Plugin', 'outfile,date,time,algorithm_id', '', '')
a.deregister('eu.baltrad.beast.applyqc')
a.register('eu.baltrad.beast.applyqc', 'rave_pgf_apply_qc_plugin', 'generate', 'Apply quality controls on a polar volume', 'date,time,anomaly-qc,algorithm_id', '', '')
"""))
        fp.close()

        try:
            ocode = subprocess.call("python tmpreg.py", shell=True)
            if ocode != 0:
                raise InstallerException(
                    "Failed to register google maps plugin in rave")
        finally:
            if os.path.exists("tmpreg.py"):
                os.unlink("tmpreg.py")
Esempio n. 10
0
  def _configure_rave_plugin(self, env):
    env.getNodeScript().stop(rave=True)
    python_bin="python"
    if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3"):
      python_bin="python3"
    
    if os.path.exists("tmpreg.py"):
      os.unlink("tmpreg.py")
    fp = open("tmpreg.py", "w")
    fp.write(env.expandArgs("""
from rave_pgf_registry import PGF_Registry
a=PGF_Registry(filename="$PREFIX/rave/etc/rave_pgf_registry.xml")
a.deregister('eu.baltrad.beast.generatewrwp')
a.deregister('se.smhi.baltrad-wrwp.generatewrwp')
a.register('eu.baltrad.beast.generatewrwp', 'baltrad_wrwp_pgf_plugin', 'generate', 'Baltrad WRWP Plugin', 'fields','interval,maxheight,mindistance,maxdistance','minelevationangle,velocitythreshold')
a.register('se.smhi.baltrad-wrwp.generatewrwp', 'baltrad_wrwp_pgf_plugin', 'generate', 'Baltrad WRWP Plugin', 'fields','interval,maxheight,mindistance,maxdistance','minelevationangle,velocitythreshold')
"""))
    fp.close()

    try:    
      ocode = subprocess.call("%s tmpreg.py"%python_bin, shell=True)
      if ocode != 0:
        raise InstallerException("Failed to register google maps plugin in rave")
    finally:
      if os.path.exists("tmpreg.py"):   
        os.unlink("tmpreg.py")
Esempio n. 11
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)

        self.osenvironment().setEnvironmentVariable(env, "LD_LIBRARY_PATH",
                                                    env.getLdLibraryPath())

        ocode = subprocess.call([
            env.expandArgs(arg) for arg in [
                "$TPREFIX/ant/bin/ant",
                "-Dprefix=$PREFIX",
                "-Dbaltraddb.path=$PREFIX/baltrad-db",
                "-Dbaltraddb.bin.path=$PREFIX/baltrad-db/bin",
                "install",
            ]
        ])
        if ocode != 0:
            raise InstallerException("Failed to install beast")

        # We use beasts document installer and just change prefix to the doc-root
        #
        ocode = subprocess.call(env.expandArgs(
            "$TPREFIX/ant/bin/ant " +
            " -Dprefix=$PREFIX/doc -Dbaltraddb.path=$PREFIX/baltrad-db" +
            " -Dbaltraddb.bin.path=$PREFIX/baltrad-db/bin" +
            " install-doc > /dev/null 2>&1"),
                                shell=True)
        if ocode != 0:
            print("Failed to generate BEAST documentation")
Esempio n. 12
0
    def _update_pgf_quality_registry(self, env):
        if os.path.exists("tmpreg.py"):
            os.unlink("tmpreg.py")
        fp = open("tmpreg.py", "w")
        fp.write(
            env.expandArgs("""
from rave_pgf_quality_registry_mgr import rave_pgf_quality_registry_mgr
a = rave_pgf_quality_registry_mgr("$PREFIX/rave/etc/rave_pgf_quality_registry.xml")
"""))
        fp.write("""
if not a.has_plugin("radar-index"):
  a.add_plugin("radar-index","rave_radarindex_quality_plugin","rave_radarindex_quality_plugin")
""")
        fp.write(
            env.expandArgs("""
if not a.has_plugin("scansun"):
  a.add_plugin("scansun", "rave_scansun_quality_plugin", "scansun_quality_plugin")
  a.save("$PREFIX/rave/etc/rave_pgf_quality_registry.xml")  
"""))
        fp.close()

        try:
            ocode = subprocess.call("python tmpreg.py", shell=True)
            if ocode != 0:
                raise InstallerException(
                    "Failed to register quality plugins in rave")
        finally:
            if os.path.exists("tmpreg.py"):
                os.unlink("tmpreg.py")
Esempio n. 13
0
    def _install_java_client(self, path, prefix, ant):
        os.chdir(path)

        ocode = subprocess.call(
            [ant, "-Dprefix=%s" % prefix, "test", "install"])
        if ocode != 0:
            raise InstallerException("Failed to install BDB java client")
Esempio n. 14
0
    def _install_and_test_python_package(self, name, path, python):
        os.chdir(path)

        ocode = subprocess.call([python, "setup.py", "install", "--force"])
        if ocode != 0:
            raise InstallerException("Failed to install %s" % name)

        ocode = subprocess.call(" ".join([
            python,
            "setup.py",
            "nosetests",
            "--first-package-wins",
            "-w test",
        ]),
                                shell=True)
        if ocode != 0:
            raise InstallerException("%s tests failed" % name)
Esempio n. 15
0
 def dofetch(self, package, env=None):
   if env.hasArg("INSTALL_OFFLINE") and env.getArg("INSTALL_OFFLINE") == True:
     code = subprocess.call("tar -xvzf %s.tgz"%self.offlinename, shell=True)
     if code != 0:
       raise InstallerException("Could not unpack %s.tgz, but offline was specified"%self.offlinename)
     return self.offlinename
   
   return self._fetchgit(env)
Esempio n. 16
0
    def _setup_permissions(self, env):
        runas = env.getArg("RUNASUSER")
        if runas == "root":
            raise InstallerException(
                "You should not atempt to run system as root")

        obj = pwd.getpwnam(runas)

        if runas == getpass.getuser() or "root" == getpass.getuser():
            if "root" == getpass.getuser():
                os.walk(env.expandArgs("$TPREFIX/tomcat"), _walk_chown,
                        [obj.pw_uid, obj.pw_gid])
            os.walk(
                env.expandArgs("$TPREFIX/tomcat/bin"), _walk_chmod,
                stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH
                | stat.S_IXOTH)
            os.walk(
                env.expandArgs("$TPREFIX/tomcat/webapps"), _walk_chmod,
                stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH
                | stat.S_IXOTH)
            os.walk(
                env.expandArgs("$TPREFIX/tomcat/logs"), _walk_chmod,
                stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH
                | stat.S_IXOTH)
            os.walk(
                env.expandArgs("$TPREFIX/tomcat/conf"), _walk_chmod,
                stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH
                | stat.S_IXOTH)
        else:
            print(
                "You must manually modify the tomcat permissions before continuing...."
            )
            print(
                env.expandArgs("""
chown -R $RUNASUSER:$RUNASUSER $TPREFIX/tomcat
chmod -R 555 $TPREFIX/tomcat/bin
chmod -R 755 $TPREFIX/tomcat/webapps
chmod -R 755 $TPREFIX/tomcat/logs
chmod -R 755 $TPREFIX/tomcat/conf
"""))
            print("Press return when finished or write 'quit' to exit:")
            sys.stdout.flush()
            a = sys.stdin.readline().strip()
            if a == "quit":
                raise InstallerException("Manually terminated script")
Esempio n. 17
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)

        self.osenvironment().setEnvironmentVariable(
            env, "LD_LIBRARY_PATH",
            "%s:%s" % (env.getLdLibraryPath(), os.environ["LD_LIBRARY_PATH"]))
        self.osenvironment().setEnvironmentVariable(
            env, "PATH", "%s:%s" % (env.getPath(), os.environ["PATH"]))

        python_bin = "python"
        if env.hasArg("ENABLE_PY3") and env.getArg("ENABLE_PY3"):
            python_bin = "python3"

        ocode = subprocess.call(env.expandArgs(
            "%s setup.py install --prefix=\"$PREFIX\"" % python_bin),
                                shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install")

        env.getNodeScript().stop(rave=True)

        if os.path.exists("tmpreg.py"):
            os.unlink("tmpreg.py")
        fp = open("tmpreg.py", "w")
        fp.write(
            env.expandArgs("""
from rave_pgf_registry import PGF_Registry
a=PGF_Registry(filename="$PREFIX/rave/etc/rave_pgf_registry.xml")
a.deregister('se.smhi.rave.creategmapimage')
a.deregister('eu.baltrad.beast.creategmap')
a.register('se.smhi.rave.creategmapimage', 'googlemap_pgf_plugin', 'generate', 'Google Map Plugin', 'outfile')
a.register('eu.baltrad.beast.creategmap', 'googlemap_pgf_plugin', 'generate', 'Google Map Plugin', 'outfile')
"""))
        fp.close()

        try:
            ocode = subprocess.call("%s tmpreg.py" % python_bin, shell=True)
            if ocode != 0:
                raise InstallerException(
                    "Failed to register google maps plugin in rave")
        finally:
            if os.path.exists("tmpreg.py"):
                os.unlink("tmpreg.py")
Esempio n. 18
0
 def _keytool(self, python, use_py3_keytool, *module_args):
   keytool = "keyczar.keyczart"
   if use_py3_keytool:
     keytool = "keyczar.tool.keyczart"
   args = [python, "-m", keytool]
   args.extend(module_args)
   ocode = subprocess.call(args)
   if ocode != 0:
       raise InstallerException("keytool command failed")
Esempio n. 19
0
 def test_must_patch_imagingft(self, inc):
   if os.path.isfile("%s/fterrors.h"%inc):
     return True
   elif os.path.isfile("%s/freetype2/ft2build.h"%inc):
     return True
   elif os.path.isfile("%s/freetype/fterrors.h"%inc):
     return False
   else:
     raise InstallerException("Can not locate fterrors.h for freetype compilation")
Esempio n. 20
0
    def doinstall(self, env):
        dbargs = "-Ddb.user=$DBUSER -Ddb.pwd=$DBPWD -Ddb.host=$DBHOST -Ddb.port=$DBPORT -Ddb.name=$DBNAME"
        args = "%s -Dbaltrad.db.path=$PREFIX/baltrad-db -Dbaltrad.beast.path=$PREFIX/beast -Dbaltrad.dex.path=$PREFIX/BaltradDex" % dbargs

        args = "%s -Ddb.jar=%s/etc/postgresql/postgresql-42.2.18.jar" % (
            args, env.getInstallerPath())

        buildfile = "%s/etc/install_db.xml" % env.getInstallerPath()
        ocode = subprocess.call(env.expandArgs(
            "$TPREFIX/ant/bin/ant -f %s %s upgrade-db" % (buildfile, args)),
                                shell=True)
        if ocode != 0:
            raise InstallerException("Failed to upgrade db")

        ocode = subprocess.call([
            env.expandArgs("$PREFIX/baltrad-db/bin/baltrad-bdb-upgrade"),
            env.expandArgs("--conf=$PREFIX/etc/bltnode.properties")
        ])
        if ocode != 0:
            raise InstallerException("Failed to upgrade BDB")
Esempio n. 21
0
def handle_tomcat_arguments(benv):
    if benv.hasArg("TOMCATPORT") and benv.hasArg("TOMCATURL"):
        # Verify that port does not conflict
        from urlparse import urlparse
        a = urlparse(benv.getArg("TOMCATURL"))
        if a.port == None or "%s" % a.port != benv.getArg("TOMCATPORT"):
            raise InstallerException("tomcatport and tomcaturl port differs")
    elif benv.hasArg("TOMCATPORT"):
        benv.addArg("TOMCATURL",
                    "http://localhost:%s" % benv.getArg("TOMCATPORT"))
    elif benv.hasArg("TOMCATURL"):
        from urlparse import urlparse
        a = urlparse(benv.getArg("TOMCATURL"))
        if a.port == None:
            raise InstallerException("You must specify port in tomcat url")
        benv.addArg("TOMCATPORT", "%d" % a.port)
    else:
        benv.addArg("TOMCATPORT", "8080")
        benv.addArg("TOMCATURL",
                    "http://localhost:%s" % benv.getArg("TOMCATPORT"))
Esempio n. 22
0
    def doinstall(self, env):
        dir = self.package().fetch(env)
        name = self.package().name()
        version = self.package().version()

        os.chdir(dir)
        cmdstr = env.expandArgs(self._cmd)
        code = subprocess.call("%s" % cmdstr, shell=True)
        if code != 0:
            raise InstallerException(
                "Failed to execute command %s for %s (%s)" %
                (cmdstr, name, version))
Esempio n. 23
0
  def _create_keystore(self, env, keystore_pth):
    #$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA -validity 3650 -keystore /opt/baltrad/etc/bltnode-keys/keystore.jks
    keytool = env.expandArgs("$JDKHOME/bin/keytool")
    
    kpwd = env.getArg("KEYSTORE_PWD")
    
    if not os.path.exists(keytool):
      raise InstallerException("Could not locate keytool command")
    args = [keytool, "-genkey", "-alias", "tomcat", "-keyalg", "RSA", "-validity", "3650", "-keypass", kpwd, "-storepass", kpwd, "-keystore", keystore_pth]
    if env.hasArg("KEYSTORE_DN"):
      dn = env.getArg("KEYSTORE_DN")
      if dn == "yes":
        dn = None
      elif dn == "no":
        dn = "CN=Unknown,OU=Unknown,O=Unknown,L=Unknown,ST=Unknown,C=Unknown"
      if dn != None:
        args.extend(["-dname", dn])

    ocode = subprocess.call(args)
    if ocode != 0:
      raise InstallerException("keytool command failed for keystore creation")
Esempio n. 24
0
    def doinstall(self, env):
        if env.hasArg("EXCLUDEDB") and env.getArg("EXCLUDEDB") == True:
            print("Excluded: Database table installation")
            return
        dbargs = "-Ddb.user=$DBUSER -Ddb.pwd=$DBPWD -Ddb.host=$DBHOST -Ddb.port=$DBPORT -Ddb.name=$DBNAME"
        args = "%s -Dbaltrad.beast.path=$PREFIX/beast -Dbaltrad.dex.path=$PREFIX/BaltradDex" % dbargs

        if not os.path.isdir(env.expandArgs("$DATADIR")):
            os.mkdir(env.expandArgs("$DATADIR"))

        args = "%s -Ddb.jar=%s/etc/postgresql/postgresql-42.2.18.jar" % (
            args, env.getInstallerPath())
        buildfile = "%s/etc/install_db.xml" % env.getInstallerPath()

        if env.hasArg("REINSTALLDB") and env.getArg("REINSTALLDB") == True:
            ocode = subprocess.call(env.expandArgs(
                "$TPREFIX/ant/bin/ant -f %s %s drop-db" % (buildfile, args)),
                                    shell=True)
            if ocode != 0:
                raise InstallerException("Failed to drop database tables")

            ocode = subprocess.call([
                env.expandArgs("$PREFIX/baltrad-db/bin/baltrad-bdb-drop"),
                env.expandArgs("--conf=$PREFIX/etc/bltnode.properties")
            ])
            if ocode != 0:
                raise InstallerException("Failed to drop BDB")

        ocode = subprocess.call(env.expandArgs(
            "$TPREFIX/ant/bin/ant -f %s %s install-db" % (buildfile, args)),
                                shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install database tables")

        ocode = subprocess.call([
            env.expandArgs("$PREFIX/baltrad-db/bin/baltrad-bdb-create"),
            env.expandArgs("--conf=$PREFIX/etc/bltnode.properties")
        ])
        if ocode != 0:
            raise InstallerException("Failed to create BDB")
Esempio n. 25
0
  def doinstall(self, env):
    dir = self.package().fetch(env)
    name = self.package().name()
    version = self.package().version()
    
    os.chdir(dir)
    
    setupscript = self.generate_setupscript(env)

    cmdstr = env.expandArgs("\"$TPREFIX/bin/python\" %s install" % setupscript)
    code = subprocess.call(cmdstr, shell=True)
    if code != 0:
      raise InstallerException("Failed to execute command %s for %s (%s)"%(cmdstr, name,version))
Esempio n. 26
0
def parse_buildpsql_argument(arg):
    tokens = arg.split(",")
    if len(tokens) == 2:
        psqlinc = tokens[0]
        psqllib = tokens[1]
    elif len(tokens) == 1:
        psqlinc = "%s/include" % tokens[0]
        psqllib = "%s/lib" % tokens[0]
    else:
        raise InstallerException(
            "--with-psql should either be <inc>,<lib> or <root>")

    if not os.path.isdir(psqlinc):
        raise InstallerException(
            "Provided path (%s) does not seem to be be used as an include path."
            % psqlinc)
    if not os.path.isdir(psqllib):
        raise InstallerException(
            "Provided path (%s) does not seem to be be used as an lib path." %
            psqllib)

    return psqlinc, psqllib
Esempio n. 27
0
    def doinstall(self, env):
        cdir = self.package().fetch(env)

        os.chdir(cdir)

        # Dont check error code for distclean, it will fail if fresh build
        # so we wait with failing until next call is performed
        subprocess.call("make distclean", shell=True)

        # If autoreconf fails, it will cause make to fail if there is problems with aclocal so ignore any failure here.
        subprocess.call("autoreconf -f -i", shell=True)

        cmd = "./configure --prefix=\"$PREFIX/bbufr\""
        cflags = "-I$TPREFIX/include"
        ldflags = "-L$TPREFIX/lib"
        zinc, zlib = self.get_zlib_args(env)
        if zinc != None:
            cflags = "%s %s" % (cflags, zinc)
        if zlib != None:
            ldflags = "%s %s" % (ldflags, zlib)
        cflags = "CFLAGS=\"%s\"" % cflags
        ldflags = "LDFLAGS=\"%s\"" % ldflags

        cmd = "%s %s %s" % (cflags, ldflags, cmd)

        newcmd = env.expandArgs(cmd)

        ocode = subprocess.call(newcmd, shell=True)
        if ocode != 0:
            raise InstallerException("Failed to configure bbufr")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build bbufr")

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install bbufr")
Esempio n. 28
0
    def doinstall(self, env):
        dir = self.package().fetch(env)

        os.chdir(dir)

        # Dont check error code for distclean, it will fail if fresh build
        # so we wait with failing until next call is performed
        subprocess.call("make distclean", shell=True)

        cmd = env.expandArgs(
            "CFLAGS=%s LDFLAGS=%s ./configure --prefix=\"$TPREFIX\" --disable-dap"
            % (self.get_cflags(env), self.get_ldflags(env)))
        ocode = subprocess.call(cmd, shell=True)
        if ocode != 0:
            raise InstallerException("Failed to configure netcdf")

        ocode = subprocess.call("make", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to build netcdf")

        ocode = subprocess.call("make install", shell=True)
        if ocode != 0:
            raise InstallerException("Failed to install netcdf")
Esempio n. 29
0
  def _setup_permissions(self, env, dir):
    import getpass, pwd, sys
    runas = env.getArg("RUNASUSER")
    if runas == "root":
      raise InstallerException("You should not atempt to run system as root")

    obj = pwd.getpwnam(runas)

    if runas == getpass.getuser() or "root" == getpass.getuser():
      if "root" == getpass.getuser():
        os.walk(dir, _walk_chown, [obj.pw_uid,obj.pw_gid])
      os.walk(dir, _walk_chmod, stat.S_IRUSR|stat.S_IWUSR)
    else:
      print("Can not set proper permissions on private key")
      print(env.expandArgs(""" Please modify permissions accordingly before continuing...
chown -R $RUNASUSER:$RUNASUSER %s
chmod -R 600 %s
"""%(dir,dir)))
      print("Press return when finished or write 'quit' to exit:")
      sys.stdout.flush()
      a=sys.stdin.readline().strip()
      if a == "quit":
        raise InstallerException("Manually terminated script")
Esempio n. 30
0
    def dofetch(self, package, env=None):
        filename = self.fetcher.fetch(package, env)
        args = ""
        if self.compressed == True:
            args = "-xvzf"
        else:
            args = "-xvf"

        code = subprocess.call("tar %s %s" % (args, filename), shell=True)
        if code != 0:
            raise InstallerException("Failed to extract software %s" %
                                     self.name)

        return self.dirname