mirror of
https://github.com/EnumeratedDev/bpm-utils.git
synced 2026-09-25 23:16:13 +00:00
Compare commits
3
Commits
154f546b7f
...
5240ae4a8c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5240ae4a8c
|
||
|
|
9d03b5b423
|
||
|
|
f17bc777d9
|
@@ -0,0 +1,31 @@
|
|||||||
|
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||||
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||||
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||||
|
|
||||||
|
# The prepare function is executed in the root of the temp directory
|
||||||
|
# This function is used for putting downloaded files to the correct location or applying patches
|
||||||
|
prepare() {
|
||||||
|
cd "$BPM_SOURCE"
|
||||||
|
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
|
||||||
|
}
|
||||||
|
|
||||||
|
# The build function is executed in the source directory
|
||||||
|
# This function is used to compile the source code
|
||||||
|
build() {
|
||||||
|
cargo build --release --locked --frozen
|
||||||
|
}
|
||||||
|
|
||||||
|
# The check function is executed in the source directory
|
||||||
|
# This function is used to run tests to verify the package has been compiled correctly
|
||||||
|
check() {
|
||||||
|
cargo test --release --frozen
|
||||||
|
}
|
||||||
|
|
||||||
|
# The package function is executed in the source directory
|
||||||
|
# This function is used to move the compiled files into the output directory
|
||||||
|
package() {
|
||||||
|
# Cargo built packages are not usually packaged manually and not with an 'install' subcommand
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var compile = flag.BoolP("compile", "c", false, "Compile BPM source package")
|
var compile = flag.BoolP("compile", "c", false, "Compile BPM source package")
|
||||||
|
var verbose = flag.BoolP("verbose", "v", false, "Show additional information about the compilation process")
|
||||||
var skipCheck = flag.BoolP("skip-checks", "s", false, "Skip 'check' function while compiling")
|
var skipCheck = flag.BoolP("skip-checks", "s", false, "Skip 'check' function while compiling")
|
||||||
var keepCompilationFiles = flag.BoolP("keep", "k", false, "Keep compilation files after successful package compilation")
|
var keepCompilationFiles = flag.BoolP("keep", "k", false, "Keep compilation files after successful package compilation")
|
||||||
var installDepends = flag.BoolP("depends", "d", false, "Install package dependencies for compilation")
|
var installDepends = flag.BoolP("depends", "d", false, "Install package dependencies for compilation")
|
||||||
@@ -161,6 +162,9 @@ func compilePackage(archive string) {
|
|||||||
// Setup compile command
|
// Setup compile command
|
||||||
args := make([]string, 0)
|
args := make([]string, 0)
|
||||||
args = append(args, "compile")
|
args = append(args, "compile")
|
||||||
|
if *verbose {
|
||||||
|
args = append(args, "-v")
|
||||||
|
}
|
||||||
if *skipCheck {
|
if *skipCheck {
|
||||||
args = append(args, "-s")
|
args = append(args, "-s")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ type PackageInfo struct {
|
|||||||
Conflicts []string `yaml:"conflicts,omitempty"`
|
Conflicts []string `yaml:"conflicts,omitempty"`
|
||||||
Replaces []string `yaml:"replaces,omitempty"`
|
Replaces []string `yaml:"replaces,omitempty"`
|
||||||
Provides []string `yaml:"provides,omitempty"`
|
Provides []string `yaml:"provides,omitempty"`
|
||||||
|
Options []string `yaml:"options,omitempty"`
|
||||||
Downloads []PackageDownload `yaml:"downloads,omitempty"`
|
Downloads []PackageDownload `yaml:"downloads,omitempty"`
|
||||||
SplitPackages []*PackageInfo `yaml:"split_packages,omitempty"`
|
SplitPackages []*PackageInfo `yaml:"split_packages,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -58,6 +59,7 @@ func ReadPackageInfo(data []byte) (*PackageInfo, error) {
|
|||||||
Conflicts: make([]string, 0),
|
Conflicts: make([]string, 0),
|
||||||
Replaces: make([]string, 0),
|
Replaces: make([]string, 0),
|
||||||
Provides: make([]string, 0),
|
Provides: make([]string, 0),
|
||||||
|
Options: make([]string, 0),
|
||||||
Downloads: make([]PackageDownload, 0),
|
Downloads: make([]PackageDownload, 0),
|
||||||
SplitPackages: make([]*PackageInfo, 0),
|
SplitPackages: make([]*PackageInfo, 0),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user