mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Add 'keep' flag
This commit is contained in:
+3
-1
@@ -149,6 +149,7 @@ func main() {
|
|||||||
currentFlagSet.BoolP("yes", "y", false, "Enter 'yes' in all prompts")
|
currentFlagSet.BoolP("yes", "y", false, "Enter 'yes' in all prompts")
|
||||||
currentFlagSet.BoolP("depends", "d", false, "Install required dependencies for package compilation")
|
currentFlagSet.BoolP("depends", "d", false, "Install required dependencies for package compilation")
|
||||||
currentFlagSet.BoolP("skip-checks", "s", false, "Skip the check function in source.sh scripts")
|
currentFlagSet.BoolP("skip-checks", "s", false, "Skip the check function in source.sh scripts")
|
||||||
|
currentFlagSet.BoolP("keep", "k", false, "Keep compilation files after successful package compilation")
|
||||||
currentFlagSet.BoolP("output-directory", "o", false, "Set the output directory for the binary packages")
|
currentFlagSet.BoolP("output-directory", "o", false, "Set the output directory for the binary packages")
|
||||||
currentFlagSet.Int("output-fd", -1, "Set the file descriptor output package names will be written to")
|
currentFlagSet.Int("output-fd", -1, "Set the file descriptor output package names will be written to")
|
||||||
setupFlagsAndHelp(currentFlagSet, fmt.Sprintf("bpm %s <options>", subcommand), "Compile source packages and convert them to binary ones", os.Args[2:])
|
setupFlagsAndHelp(currentFlagSet, fmt.Sprintf("bpm %s <options>", subcommand), "Compile source packages and convert them to binary ones", os.Args[2:])
|
||||||
@@ -942,6 +943,7 @@ func compilePackage() {
|
|||||||
rootDir, _ := currentFlagSet.GetString("root")
|
rootDir, _ := currentFlagSet.GetString("root")
|
||||||
verbose, _ := currentFlagSet.GetBool("verbose")
|
verbose, _ := currentFlagSet.GetBool("verbose")
|
||||||
yesAll, _ := currentFlagSet.GetBool("yes")
|
yesAll, _ := currentFlagSet.GetBool("yes")
|
||||||
|
keepCompilationFiles, _ := currentFlagSet.GetBool("keep")
|
||||||
installSrcPkgDepends, _ := currentFlagSet.GetBool("depends")
|
installSrcPkgDepends, _ := currentFlagSet.GetBool("depends")
|
||||||
skipChecks, _ := currentFlagSet.GetBool("skip-checks")
|
skipChecks, _ := currentFlagSet.GetBool("skip-checks")
|
||||||
outputDirectory, _ := currentFlagSet.GetString("output-directory")
|
outputDirectory, _ := currentFlagSet.GetString("output-directory")
|
||||||
@@ -1139,7 +1141,7 @@ func compilePackage() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
outputBpmPackages, err := bpmlib.CompileSourcePackage(sourcePackage, outputDirectory, skipChecks)
|
outputBpmPackages, err := bpmlib.CompileSourcePackage(sourcePackage, outputDirectory, skipChecks, keepCompilationFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Remove unused packages
|
// Remove unused packages
|
||||||
cleanupFunc()
|
cleanupFunc()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
var rootCompilationUID = "65534"
|
var rootCompilationUID = "65534"
|
||||||
var rootCompilationGID = "65534"
|
var rootCompilationGID = "65534"
|
||||||
|
|
||||||
func CompileSourcePackage(archiveFilename, outputDirectory string, skipChecks bool) (outputBpmPackages map[string]string, err error) {
|
func CompileSourcePackage(archiveFilename, outputDirectory string, skipChecks, keepCompilationFiles bool) (outputBpmPackages map[string]string, err error) {
|
||||||
// Initialize map
|
// Initialize map
|
||||||
outputBpmPackages = make(map[string]string)
|
outputBpmPackages = make(map[string]string)
|
||||||
|
|
||||||
@@ -334,6 +334,11 @@ func CompileSourcePackage(archiveFilename, outputDirectory string, skipChecks bo
|
|||||||
outputBpmPackages[pkgInfo.Name] = outputFilename
|
outputBpmPackages[pkgInfo.Name] = outputFilename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete temporary directory
|
||||||
|
if !keepCompilationFiles {
|
||||||
|
os.RemoveAll(tempDirectory)
|
||||||
|
}
|
||||||
|
|
||||||
return outputBpmPackages, nil
|
return outputBpmPackages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ func (operation *BPMOperation) Execute(verbose, force bool) (err error) {
|
|||||||
|
|
||||||
// Compile source package if not compiled already
|
// Compile source package if not compiled already
|
||||||
if _, ok := operation.compiledPackages[pkgNameToInstall]; !ok {
|
if _, ok := operation.compiledPackages[pkgNameToInstall]; !ok {
|
||||||
outputBpmPackages, err := CompileSourcePackage(value.File, compiledDir, false)
|
outputBpmPackages, err := CompileSourcePackage(value.File, compiledDir, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not compile source package (%s): %s\n", value.File, err)
|
return fmt.Errorf("could not compile source package (%s): %s\n", value.File, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user