mirror of
https://github.com/EnumeratedDev/bpm-utils.git
synced 2026-09-26 15:36:13 +00:00
Compare commits
5
Commits
4ff4a74fa3
..
7.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4217626dde
|
||
|
|
d7da13034c | ||
|
|
cdb044d751
|
||
|
|
60b0f4489e
|
||
|
|
65c32d628f
|
@@ -169,7 +169,7 @@ func compilePackage(archive string) {
|
|||||||
if *yesAll {
|
if *yesAll {
|
||||||
args = append(args, "-y")
|
args = append(args, "-y")
|
||||||
}
|
}
|
||||||
args = append(args, "--fd=3")
|
args = append(args, "--output-fd=3")
|
||||||
args = append(args, archive)
|
args = append(args, archive)
|
||||||
cmd := exec.Command("bpm", args...)
|
cmd := exec.Command("bpm", args...)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
bpmutilsshared "bpm-utils-shared"
|
bpmutilsshared "bpm-utils-shared"
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
@@ -176,6 +177,10 @@ func checkVersionsFunc(repo string) {
|
|||||||
log.Fatalf("Could not read package info: %s", err)
|
log.Fatalf("Could not read package info: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if verbose {
|
||||||
|
fmt.Printf("Checking version for package (%s)...\n", pkgInfo.Name)
|
||||||
|
}
|
||||||
|
|
||||||
// Check cached latest version
|
// Check cached latest version
|
||||||
latestVersion := ""
|
latestVersion := ""
|
||||||
if cachedVersion, ok := cachedVersions[pkgInfo.Name]; ok && !force && time.Since(time.UnixMilli(cachedVersion.Timestamp)).Milliseconds() < 604800000 {
|
if cachedVersion, ok := cachedVersions[pkgInfo.Name]; ok && !force && time.Since(time.UnixMilli(cachedVersion.Timestamp)).Milliseconds() < 604800000 {
|
||||||
@@ -188,7 +193,9 @@ func checkVersionsFunc(repo string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Execute check-version.sh script
|
// Execute check-version.sh script
|
||||||
cmd := exec.Command("bash", "-e", path.Join(dir, "check-version.sh"))
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
cmd := exec.CommandContext(ctx, "bash", "-e", path.Join(dir, "check-version.sh"))
|
||||||
cmd.Environ()
|
cmd.Environ()
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -261,6 +268,7 @@ func checkVersionsFunc(repo string) {
|
|||||||
for _, pkg := range pkgsWithoutScript {
|
for _, pkg := range pkgsWithoutScript {
|
||||||
log.Printf("Warning: package (%s) has no check-version.sh script\n", pkg)
|
log.Printf("Warning: package (%s) has no check-version.sh script\n", pkg)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Print errors
|
// Print errors
|
||||||
keys = slices.Collect(maps.Keys(pkgsWithError))
|
keys = slices.Collect(maps.Keys(pkgsWithError))
|
||||||
@@ -268,7 +276,6 @@ func checkVersionsFunc(repo string) {
|
|||||||
for _, pkg := range keys {
|
for _, pkg := range keys {
|
||||||
log.Printf("Error: check-version.sh script for package (%s) failed: %s", pkg, pkgsWithError[pkg])
|
log.Printf("Error: check-version.sh script for package (%s) failed: %s", pkg, pkgsWithError[pkg])
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Print summary
|
// Print summary
|
||||||
fmt.Println("----- Summary -----")
|
fmt.Println("----- Summary -----")
|
||||||
|
|||||||
@@ -130,8 +130,8 @@ func createDirectory() {
|
|||||||
Downloads: []bpmutilsshared.PackageDownload{
|
Downloads: []bpmutilsshared.PackageDownload{
|
||||||
{
|
{
|
||||||
Url: "https://wwww.my-url.com/file.tar.gz",
|
Url: "https://wwww.my-url.com/file.tar.gz",
|
||||||
|
ExtractTo: "${BPM_SOURCE}",
|
||||||
ExtractStripComponents: 1,
|
ExtractStripComponents: 1,
|
||||||
ExtractToBPMSource: true,
|
|
||||||
Checksum: "replaceme",
|
Checksum: "replaceme",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,11 +34,17 @@ type PackageInfo struct {
|
|||||||
type PackageDownload struct {
|
type PackageDownload struct {
|
||||||
Url string `yaml:"url"`
|
Url string `yaml:"url"`
|
||||||
Type string `yaml:"type,omitempty"`
|
Type string `yaml:"type,omitempty"`
|
||||||
NoExtract bool `yaml:"no_extract,omitempty"`
|
|
||||||
ExtractToBPMSource bool `yaml:"extract_to_bpm_source,omitempty"`
|
|
||||||
ExtractStripComponents int `yaml:"extract_strip_components,omitempty"`
|
|
||||||
GitBranch string `yaml:"git_branch,omitempty"`
|
|
||||||
Filepath string `yaml:"filepath,omitempty,omitempty"`
|
Filepath string `yaml:"filepath,omitempty,omitempty"`
|
||||||
|
|
||||||
|
// Archive options
|
||||||
|
NoExtract bool `yaml:"no_extract,omitempty"`
|
||||||
|
ExtractTo string `yaml:"extract_to,omitempty"`
|
||||||
|
ExtractStripComponents int `yaml:"extract_strip_components,omitempty"`
|
||||||
|
|
||||||
|
// Git options
|
||||||
|
CloneTo string `yaml:"clone_to,omitempty"`
|
||||||
|
GitBranch string `yaml:"git_branch,omitempty"`
|
||||||
|
|
||||||
Checksum string `yaml:"checksum,omitempty"`
|
Checksum string `yaml:"checksum,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +155,7 @@ func (pkgDownload *PackageDownload) CalculateChecksum(pkgInfo *PackageInfo) (str
|
|||||||
return "", fmt.Errorf("'git_branch' field cannot be empty")
|
return "", fmt.Errorf("'git_branch' field cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("git ls-remote --refs %s | grep 'refs/.*/%s$' | awk '{print $1}'", pkgDownload.Url, gitBranch))
|
cmd := exec.Command("sh", "-c", fmt.Sprintf("git ls-remote -bt %s | grep -E 'refs/.*/%s(\\^\\{\\})?$' | tail -n1 | awk '{print $1}'", pkgDownload.Url, gitBranch))
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
checksum, err := cmd.Output()
|
checksum, err := cmd.Output()
|
||||||
|
|||||||
Reference in New Issue
Block a user