Beispiel #1
0
    def documentApp(self, child, app):
        doc_dir = child.installDocDir("erlang")

        PySH.mkdirs(doc_dir)

        return [
            "erl -noshell -run edoc_run application '" + app.name() + "' '\"" +
            app.appDir() + "\"' '[{dir, \"" + doc_dir + "\"}]'"
        ]
Beispiel #2
0
    def buildApp(self, child, app):
        includes = " "
        for include in app["INCLUDE_DIRS"]:
            if include == "":
                continue
            includes += "-I " + include + " "

        build_dir = app.path(DF.build | DF.langlib | DF.app,
                             lang="erlang",
                             subdirs=["ebin"])
        PySH.mkdirs(build_dir)
        return [
            "erlc " + includes + "-o " + build_dir + " " +
            app.path(DF.source | DF.src, file_name="*.erl")
        ]
Beispiel #3
0
    def buildApp(self, child, app):
        ## We want to build all java files at once.
        ## Ignore and subdirs

        if child.type != FC.AppToolConfig.Types.app:
            return []

        class_path = JVM.getSourceClassPath([app] + app.children)
        class_files = JVM.getSourceFiles([app] + app.children)
        build_path = child.path(DF.build | DF.langlib | DF.app, lang="java")

        PySH.mkdirs(build_path)

        files = ""
        for f in class_files:
            files += f + " "

        return [
            "javac -cp \"" + class_path + "\" -d " + build_path + " " + files
        ]
Beispiel #4
0
	def package(self, app):
		## Make certain topdir is set
		file = PyFile.file(os.path.expanduser("~/.rpmmacros"), permissions="w")
		file.write("""
			%%_topdir   %s
			%%_tmppath %%{_topdir}/tmp
			""" % app.path(DF.build|DF.root|DF.absolute)
		)
		file.close()

		## Make the RPM build dirs
		dirs = ["BUILD", "BUILD_ROOT", "RPMS", "SOURCES", "SRPMS", "SPECS", "tmp"]
		for d in dirs:
			PySH.mkdirs(app.path(DF.build|DF.root, subdirs=[d]))

		## Create install directory structure
		version = PyRCS.getMajorVersion()
		build   = PyRCS.getMinorVersion()

		package_name = "%s-%s" % (app.name(), version)
		package_dir  = app.path(DF.build|DF.root, subdirs=["tmp", package_name])
		package_root = app.path(DF.build|DF.root, subdirs=["tmp", package_name, "usr", "local", app.name()])
		package_bin  = app.path(DF.build|DF.root, subdirs=["tmp", package_name, "usr", "local", package_name])

		## Copy
		PySH.mkdirs(package_root)
		PySH.copy(app.path(DF.install|DF.root), package_root)

		## Rebuild bins
		package_root_bin = os.path.join(package_root, "bin")
		PySH.mkdirs(package_bin)

		for f in PyFind.getDirFiles(package_root_bin):
			name      = os.path.basename(f)
			file_name = os.path.join(package_bin, name)
			f         = PyFile.file(file_name, "w")

			code      = "#! /bin/bash\n"
			code     += "APP_ROOT=${APP_ROOT:-%s} %s $@\n" % ("/usr/local/%s" % app.name(), "/usr/local/%s/bin/%s" % (app.name(), name)) 

			f.write(code)
			f.close()

			PySH.cmd("chmod a+x %s" % file_name)

		## Generate Source ball
		PySH.cmd("cd %s && tar -czvf %s.tar.gz %s" % (app.path(DF.build|DF.root, subdirs=["tmp"]), app.path(DF.build|DF.root|DF.absolute, subdirs=["SOURCES"], file_name=package_name), package_name), stdout=True, stderr=True)

		## Generate spec file
		name      = app.name()
		file_name = app.path(DF.build|DF.root, subdirs=["SPECS"], file_name="%s.spec" % name)
		f         = PyFile.file(file_name, "w")

		spec      = """
%%define        __spec_install_post %%{nil}
%%define          debug_package %%{nil}
%%define        __os_install_post %%{_dbpath}/brp-compress

Summary: Autogenerated spec for %s
Name: %s
Version: %s
Release: %s
License: GPL+
Group: Development/Tools
SOURCE0 : %%{name}-%%{version}.tar.gz
URL: TODO

BuildRoot: %%{_tmppath}/%%{name}-%%{version}-%%{release}-root

%%description
%%{summary}

%%prep
%%setup -q

%%build
# Empty section.

%%install
rm -rf %%{buildroot}
mkdir -p  %%{buildroot}

# in builddir
cp -a * %%{buildroot}


%%clean
rm -rf %%{buildroot}


%%files
/usr/bin/*
/usr/local/%s/*

%%changelog
			""" % (name, name, version, build, name)
			
		f.write(spec)
		f.close()

		PySH.cmd("rpmbuild -ba %s" % file_name, stdout=True, stderr=True)
Beispiel #5
0
    def genDirs(self, app):
        log_dir = app.path(DF.install | DF.var | DF.absolute, subdirs=["log"])

        if not os.path.isdir(log_dir):
            PySH.mkdirs(log_dir)