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 {
|
||||
args = append(args, "-y")
|
||||
}
|
||||
args = append(args, "--fd=3")
|
||||
args = append(args, "--output-fd=3")
|
||||
args = append(args, archive)
|
||||
cmd := exec.Command("bpm", args...)
|
||||
cmd.Stdin = os.Stdin
|
||||
|
||||
+14
-7
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
bpmutilsshared "bpm-utils-shared"
|
||||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
@@ -176,6 +177,10 @@ func checkVersionsFunc(repo string) {
|
||||
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
|
||||
latestVersion := ""
|
||||
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
|
||||
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()
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
@@ -261,13 +268,13 @@ func checkVersionsFunc(repo string) {
|
||||
for _, pkg := range pkgsWithoutScript {
|
||||
log.Printf("Warning: package (%s) has no check-version.sh script\n", pkg)
|
||||
}
|
||||
}
|
||||
|
||||
// Print errors
|
||||
keys = slices.Collect(maps.Keys(pkgsWithError))
|
||||
sort.Strings(keys)
|
||||
for _, pkg := range keys {
|
||||
log.Printf("Error: check-version.sh script for package (%s) failed: %s", pkg, pkgsWithError[pkg])
|
||||
}
|
||||
// Print errors
|
||||
keys = slices.Collect(maps.Keys(pkgsWithError))
|
||||
sort.Strings(keys)
|
||||
for _, pkg := range keys {
|
||||
log.Printf("Error: check-version.sh script for package (%s) failed: %s", pkg, pkgsWithError[pkg])
|
||||
}
|
||||
|
||||
// Print summary
|
||||
|
||||
@@ -130,8 +130,8 @@ func createDirectory() {
|
||||
Downloads: []bpmutilsshared.PackageDownload{
|
||||
{
|
||||
Url: "https://wwww.my-url.com/file.tar.gz",
|
||||
ExtractTo: "${BPM_SOURCE}",
|
||||
ExtractStripComponents: 1,
|
||||
ExtractToBPMSource: true,
|
||||
Checksum: "replaceme",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -32,14 +32,20 @@ type PackageInfo struct {
|
||||
}
|
||||
|
||||
type PackageDownload struct {
|
||||
Url string `yaml:"url"`
|
||||
Type string `yaml:"type,omitempty"`
|
||||
Url string `yaml:"url"`
|
||||
Type string `yaml:"type,omitempty"`
|
||||
Filepath string `yaml:"filepath,omitempty,omitempty"`
|
||||
|
||||
// Archive options
|
||||
NoExtract bool `yaml:"no_extract,omitempty"`
|
||||
ExtractToBPMSource bool `yaml:"extract_to_bpm_source,omitempty"`
|
||||
ExtractTo string `yaml:"extract_to,omitempty"`
|
||||
ExtractStripComponents int `yaml:"extract_strip_components,omitempty"`
|
||||
GitBranch string `yaml:"git_branch,omitempty"`
|
||||
Filepath string `yaml:"filepath,omitempty,omitempty"`
|
||||
Checksum string `yaml:"checksum,omitempty"`
|
||||
|
||||
// Git options
|
||||
CloneTo string `yaml:"clone_to,omitempty"`
|
||||
GitBranch string `yaml:"git_branch,omitempty"`
|
||||
|
||||
Checksum string `yaml:"checksum,omitempty"`
|
||||
}
|
||||
|
||||
func ReadPackageInfo(data []byte) (*PackageInfo, error) {
|
||||
@@ -149,7 +155,7 @@ func (pkgDownload *PackageDownload) CalculateChecksum(pkgInfo *PackageInfo) (str
|
||||
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
|
||||
|
||||
checksum, err := cmd.Output()
|
||||
|
||||
Reference in New Issue
Block a user