mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-25 23:16:13 +00:00
Compare commits
7
Commits
08a4e24889
..
0.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f23537ba7d
|
||
|
|
6e9f16837c
|
||
|
|
271e87cb77
|
||
|
|
25ccc208d7
|
||
|
|
9c7e20d27d
|
||
|
|
6206fdbf43
|
||
|
|
9e48d97dc8
|
@@ -13,7 +13,7 @@ ROOT_COMPILATION_GID ?= 65534
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
cd src/bpm; $(GO) build $(GOFLAGS) -ldflags "-w -X 'git.enumerated.dev/bubble-package-manager/bpm/src/bpm/config.BpmVersion=$(VERSION)' -X 'git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib.rootCompilationUID=$(ROOT_COMPILATION_UID)' -X 'git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib.rootCompilationGID=$(ROOT_COMPILATION_GID)'" -o ../../build/bpm git.enumerated.dev/bubble-package-manager/bpm/src/bpm
|
||||
cd src/bpm; $(GO) build $(GOFLAGS) -ldflags "-w -X 'main.BpmVersion=$(VERSION)' -X 'github.com/EnumeratedDev/bpm/src/bpmlib.rootCompilationUID=$(ROOT_COMPILATION_UID)' -X 'github.com/EnumeratedDev/bpm/src/bpmlib.rootCompilationGID=$(ROOT_COMPILATION_GID)'" -o ../../build/bpm bpm
|
||||
|
||||
install: build/bpm config/
|
||||
# Create directory
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
package config
|
||||
|
||||
var BpmVersion = "dev"
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
module git.enumerated.dev/bubble-package-manager/bpm/src/bpm
|
||||
module bpm
|
||||
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib v0.5.0
|
||||
github.com/EnumeratedDev/bpm/src/bpmlib v0.0.0
|
||||
github.com/lithammer/fuzzysearch v1.1.8
|
||||
github.com/spf13/pflag v1.0.10
|
||||
)
|
||||
|
||||
replace git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib => ../bpmlib
|
||||
replace github.com/EnumeratedDev/bpm/src/bpmlib => ../bpmlib
|
||||
|
||||
require (
|
||||
github.com/drone/envsubst v1.0.3 // indirect
|
||||
|
||||
+11
-6
@@ -14,8 +14,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.enumerated.dev/bubble-package-manager/bpm/src/bpm/config"
|
||||
"git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib"
|
||||
"github.com/EnumeratedDev/bpm/src/bpmlib"
|
||||
|
||||
"github.com/lithammer/fuzzysearch/fuzzy"
|
||||
flag "github.com/spf13/pflag"
|
||||
@@ -26,6 +25,8 @@ import (
|
||||
/* A simple-to-use package manager */
|
||||
/* ------------------------------------------------------- */
|
||||
|
||||
var BpmVersion = "dev"
|
||||
|
||||
var currentFlagSet *flag.FlagSet
|
||||
|
||||
var exitCode = 0
|
||||
@@ -47,7 +48,7 @@ func main() {
|
||||
switch subcommand {
|
||||
case "v", "version":
|
||||
fmt.Println("Bubble Package Manager (BPM)")
|
||||
fmt.Println("Version: " + config.BpmVersion)
|
||||
fmt.Println("Version: " + BpmVersion)
|
||||
case "q", "query":
|
||||
// Setup flags and help
|
||||
currentFlagSet = flag.NewFlagSet("query", flag.ExitOnError)
|
||||
@@ -137,6 +138,7 @@ func main() {
|
||||
currentFlagSet.BoolP("force", "f", false, "Bypass warnings during package update")
|
||||
currentFlagSet.BoolP("yes", "y", false, "Enter 'yes' in all prompts")
|
||||
currentFlagSet.BoolP("no-sync", "n", false, "Do not sync databases")
|
||||
currentFlagSet.Bool("allow-downgrades", false, "Allow package downgrades")
|
||||
currentFlagSet.BoolP("optional", "o", false, "Install all optional dependencies")
|
||||
setupFlagsAndHelp(currentFlagSet, fmt.Sprintf("bpm %s <options>", subcommand), "Update installed packages", os.Args[2:])
|
||||
|
||||
@@ -625,7 +627,7 @@ func installPackages() {
|
||||
// Show optional dependencies
|
||||
if !installOptional && len(optionalDepends) != 0 {
|
||||
// List optional dependencies
|
||||
fmt.Println("The following opitonal dependenices have been discovered:")
|
||||
fmt.Println("The following optional dependenices have been discovered:")
|
||||
for dependant, depends := range optionalDepends {
|
||||
fmt.Printf("%s: \n", dependant)
|
||||
for _, depend := range depends {
|
||||
@@ -894,6 +896,7 @@ func updatePackages() {
|
||||
force, _ := currentFlagSet.GetBool("force")
|
||||
yesAll, _ := currentFlagSet.GetBool("yes")
|
||||
noSync, _ := currentFlagSet.GetBool("no-sync")
|
||||
allowDowngrades, _ := currentFlagSet.GetBool("allow-downgrades")
|
||||
installOptional, _ := currentFlagSet.GetBool("optional")
|
||||
|
||||
// Check for required permissions
|
||||
@@ -932,7 +935,7 @@ func updatePackages() {
|
||||
}
|
||||
|
||||
// Create update operation
|
||||
operation, err := bpmlib.UpdatePackages(rootDir, !noSync, installOptional, force, verbose)
|
||||
operation, err := bpmlib.UpdatePackages(rootDir, !noSync, allowDowngrades, installOptional, force, verbose)
|
||||
if errors.As(err, &bpmlib.PackageNotFoundErr{}) || errors.As(err, &bpmlib.DependencyNotFoundErr{}) || errors.As(err, &bpmlib.PackageConflictErr{}) {
|
||||
log.Printf("Error: %s", err)
|
||||
exitCode = 1
|
||||
@@ -1016,7 +1019,7 @@ func updatePackages() {
|
||||
// Show optional dependencies
|
||||
if !installOptional && len(optionalDepends) != 0 {
|
||||
// List optional dependencies
|
||||
fmt.Println("The following opitonal dependenices have been discovered:")
|
||||
fmt.Println("The following optional dependenices have been discovered:")
|
||||
for dependant, depends := range optionalDepends {
|
||||
fmt.Printf("%s: \n", dependant)
|
||||
for _, depend := range depends {
|
||||
@@ -1100,6 +1103,8 @@ func getFileOwner() {
|
||||
// Print packages
|
||||
if len(pkgList) == 0 {
|
||||
fmt.Printf("%s (%s) is not owned by any packages!\n", absPath, pathType)
|
||||
exitCode = 1
|
||||
return
|
||||
} else {
|
||||
fmt.Printf("%s (%s) is owned by the following packages:\n", absPath, pathType)
|
||||
for _, pkg := range pkgList {
|
||||
|
||||
@@ -137,6 +137,7 @@ func CompileSourcePackage(archiveFilename, outputDirectory string, skipChecks, k
|
||||
env = append(env, "BPM_PKG_NAME="+bpmpkg.PkgInfo.Name)
|
||||
env = append(env, "BPM_PKG_VERSION="+bpmpkg.PkgInfo.Version)
|
||||
env = append(env, "BPM_PKG_REVISION="+strconv.Itoa(bpmpkg.PkgInfo.Revision))
|
||||
env = append(env, "BPM_PKG_URL="+bpmpkg.PkgInfo.Url)
|
||||
env = append(env, "BPM_PKG_ARCH="+bpmpkg.PkgInfo.OutputArch)
|
||||
env = append(env, CompilationBPMConfig.CompilationEnvironment...)
|
||||
|
||||
@@ -434,10 +435,12 @@ func downloadPackageFiles(pkgInfo *PackageInfo, tempDirectory string, verbose bo
|
||||
// Replace variables
|
||||
replaceVars := func(s string) string {
|
||||
switch s {
|
||||
case "BPM_PKG_VERSION":
|
||||
return pkgInfo.Version
|
||||
case "BPM_PKG_NAME":
|
||||
return pkgInfo.Name
|
||||
case "BPM_PKG_VERSION":
|
||||
return pkgInfo.Version
|
||||
case "BPM_PKG_URL":
|
||||
return pkgInfo.Url
|
||||
case "BPM_SOURCE":
|
||||
return path.Join(tempDirectory, "source/")
|
||||
default:
|
||||
@@ -557,10 +560,12 @@ func downloadPackageFiles(pkgInfo *PackageInfo, tempDirectory string, verbose bo
|
||||
gitBranch := download.GitBranch
|
||||
gitBranch, err := envsubst.Eval(gitBranch, func(s string) string {
|
||||
switch s {
|
||||
case "BPM_PKG_VERSION":
|
||||
return pkgInfo.Version
|
||||
case "BPM_PKG_NAME":
|
||||
return pkgInfo.Name
|
||||
case "BPM_PKG_VERSION":
|
||||
return pkgInfo.Version
|
||||
case "BPM_PKG_URL":
|
||||
return pkgInfo.Url
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -63,11 +63,12 @@ func (db *configDatabase) ReadLocalDatabase() error {
|
||||
database.Name = db.Name
|
||||
database.Source = db.Source
|
||||
|
||||
entriesToRemove := make([]string, 0)
|
||||
for entryName, entry := range database.Entries {
|
||||
entry.Database = database
|
||||
|
||||
if entry.Info.IsSplitPackage() {
|
||||
delete(database.Entries, entryName)
|
||||
|
||||
// Handle split packages
|
||||
for _, splitPkg := range entry.Info.SplitPackages {
|
||||
// Turn split package into json data
|
||||
@@ -106,9 +107,6 @@ func (db *configDatabase) ReadLocalDatabase() error {
|
||||
for _, p := range splitPkg.Provides {
|
||||
database.VirtualPackages[p] = append(database.VirtualPackages[p], splitPkg.Name)
|
||||
}
|
||||
|
||||
// Add current entry to list for removal
|
||||
entriesToRemove = append(entriesToRemove, entryName)
|
||||
}
|
||||
} else {
|
||||
// Add virtual packages to database
|
||||
@@ -118,11 +116,6 @@ func (db *configDatabase) ReadLocalDatabase() error {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove entries
|
||||
for _, entryName := range entriesToRemove {
|
||||
delete(database.Entries, entryName)
|
||||
}
|
||||
|
||||
BPMDatabases[db.Name] = database
|
||||
|
||||
return nil
|
||||
|
||||
@@ -365,7 +365,7 @@ func CleanupCache(rootDir string, cleanupCompilationFiles, cleanupCompiledPackag
|
||||
}
|
||||
|
||||
// UpdatePackages fetches the newest versions of all installed packages from
|
||||
func UpdatePackages(rootDir string, syncDatabase bool, installOptionalDependencies, forceInstallation, verbose bool) (operation *BPMOperation, err error) {
|
||||
func UpdatePackages(rootDir string, syncDatabase bool, allowDowngrades bool, installOptionalDependencies, forceInstallation, verbose bool) (operation *BPMOperation, err error) {
|
||||
// Sync databases
|
||||
if syncDatabase {
|
||||
err := SyncDatabase(verbose)
|
||||
@@ -419,7 +419,7 @@ func UpdatePackages(rootDir string, syncDatabase bool, installOptionalDependenci
|
||||
return nil, fmt.Errorf("could not get package info for package (%s)", pkg)
|
||||
} else {
|
||||
comparison := CompareVersions(entry.Info.GetFullVersion(), installedInfo.GetFullVersion())
|
||||
if comparison > 0 {
|
||||
if (!allowDowngrades && comparison > 0) || (allowDowngrades && comparison != 0) {
|
||||
operation.AppendAction(&FetchPackageAction{
|
||||
InstallationReason: GetInstallationReason(pkg, rootDir),
|
||||
DatabaseEntry: entry,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module git.enumerated.dev/bubble-package-manager/bpm/src/bpmlib
|
||||
module github.com/EnumeratedDev/bpm/src/bpmlib
|
||||
|
||||
go 1.24.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user