mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 02:26:12 +00:00
Added 'Binary Output' and 'Compilation Directory' config options and parameters, removed test packages and added other small improvements
This commit is contained in:
+6
-1
@@ -8,11 +8,16 @@ import (
|
||||
type BPMConfigStruct struct {
|
||||
CompilationEnv []string `yaml:"compilation_env"`
|
||||
SilentCompilation bool `yaml:"silent_compilation"`
|
||||
BinaryOutputDir string `yaml:"binary_output_dir"`
|
||||
CompilationDir string `yaml:"compilation_dir"`
|
||||
}
|
||||
|
||||
var BPMConfig BPMConfigStruct = BPMConfigStruct{
|
||||
CompilationEnv: make([]string, 0),
|
||||
SilentCompilation: false}
|
||||
SilentCompilation: false,
|
||||
BinaryOutputDir: "/var/lib/bpm/compiled/",
|
||||
CompilationDir: "/var/tmp/",
|
||||
}
|
||||
|
||||
func ReadConfig() {
|
||||
if _, err := os.Stat("/etc/bpm.conf"); os.IsNotExist(err) {
|
||||
|
||||
@@ -505,7 +505,7 @@ func compilePackage(pkgInfo *PackageInfo, filename, rootDir string, binaryPkgFro
|
||||
}
|
||||
tr := tar.NewReader(archive)
|
||||
|
||||
temp := "/var/tmp/bpm_source-" + pkgInfo.Name
|
||||
temp := path.Join(BPMConfig.CompilationDir, "bpm_source-"+pkgInfo.Name)
|
||||
err = os.RemoveAll(temp)
|
||||
if err != nil {
|
||||
return err, nil
|
||||
@@ -683,6 +683,8 @@ fi
|
||||
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: 65534, Gid: 65534}
|
||||
cmd.Dir = temp
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, "USER=nobody")
|
||||
cmd.Env = append(cmd.Env, "HOME="+temp)
|
||||
|
||||
err = os.Mkdir(path.Join(temp, "source"), 0755)
|
||||
if err != nil {
|
||||
@@ -827,7 +829,7 @@ fi
|
||||
return err, nil
|
||||
}
|
||||
if binaryPkgFromSrc {
|
||||
compiledDir := path.Join(rootDir, "var/lib/bpm/compiled/")
|
||||
compiledDir := path.Join(BPMConfig.BinaryOutputDir)
|
||||
err = os.MkdirAll(compiledDir, 0755)
|
||||
compiledInfo := PackageInfo{}
|
||||
compiledInfo = *pkgInfo
|
||||
|
||||
Reference in New Issue
Block a user