2024-09-09 01:25:07 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-09-10 23:02:25 +02:00
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2025-04-12 09:49:58 +02:00
|
|
|
"runtime"
|
2024-12-08 14:34:31 +01:00
|
|
|
"spitfire-builder/spitfire"
|
2024-09-10 23:02:25 +02:00
|
|
|
"time"
|
|
|
|
//"errors"
|
2024-09-09 01:25:07 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2024-12-11 17:07:08 +01:00
|
|
|
all bool
|
|
|
|
buildFlag bool
|
|
|
|
clean bool
|
2024-12-16 21:24:35 +01:00
|
|
|
fullClean bool
|
2024-12-11 17:07:08 +01:00
|
|
|
update bool
|
|
|
|
prePatch bool
|
|
|
|
postPatch bool
|
|
|
|
skipPatchUpdate bool
|
|
|
|
run bool
|
|
|
|
compress bool
|
|
|
|
target string
|
|
|
|
version string
|
|
|
|
component string
|
|
|
|
arch string
|
|
|
|
release string
|
|
|
|
platform string
|
|
|
|
upload bool
|
|
|
|
uploadPath string
|
2025-01-18 11:48:30 +01:00
|
|
|
sourceRepo = "https://hg.mozilla.org/releases/mozilla-release"
|
|
|
|
patchesRepo = "https://weforge.xyz/Spitfire/Patcher.git"
|
2024-12-11 17:07:08 +01:00
|
|
|
url = "https://spitfirebrowser.xyz/"
|
|
|
|
licence = "AGPL-3.0"
|
|
|
|
name = "Spitfire"
|
2024-12-23 11:24:42 +01:00
|
|
|
packageName = "spitfire-browser"
|
2024-12-11 17:07:08 +01:00
|
|
|
maintainer = "Internet Addict"
|
|
|
|
initialDir string
|
2024-12-29 00:58:19 +01:00
|
|
|
skipDeps bool
|
2025-04-12 09:49:58 +02:00
|
|
|
ignoreErrors bool
|
2024-09-09 01:25:07 +02:00
|
|
|
)
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
var errors []error // This is also in build.go. Great! This code is a mess.
|
|
|
|
|
2024-09-09 01:25:07 +02:00
|
|
|
func init() {
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.StringVar(&target, "t", "", "Target location format: component-arch-release-platform")
|
|
|
|
flag.BoolVar(&compress, "c", false, "Compress the build directory into a tar.gz file before uploading")
|
|
|
|
flag.StringVar(&version, "v", "", "Specify version for the package. For nightly, use current date if not specified.")
|
|
|
|
flag.StringVar(&component, "component", "browser", "Component name (default: browser)")
|
|
|
|
flag.StringVar(&arch, "arch", runtime.GOARCH, "Architecture (default: system architecture)")
|
|
|
|
flag.StringVar(&release, "release", "nightly", "Release type (default: nightly)")
|
|
|
|
flag.StringVar(&platform, "platform", runtime.GOOS, "Platform (default: system platform)")
|
|
|
|
flag.BoolVar(&all, "a", false, "Perform all steps (build, clean, update)")
|
|
|
|
flag.BoolVar(&buildFlag, "b", false, "Build Spitfire")
|
2024-12-16 21:24:35 +01:00
|
|
|
flag.BoolVar(&clean, "clean", false, "Revert uncommitted changes without removing build artifacts")
|
|
|
|
flag.BoolVar(&fullClean, "full-clean", false, "Perform a full clean by removing all build artifacts (clobber)")
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.BoolVar(&update, "u", false, "Update Mozilla repository")
|
2024-12-11 17:07:08 +01:00
|
|
|
flag.BoolVar(&prePatch, "pre-patch", false, "Apply pre-build patches")
|
|
|
|
flag.BoolVar(&postPatch, "post-patch", false, "Apply post-build patches")
|
|
|
|
flag.BoolVar(&skipPatchUpdate, "skip-patch-update", false, "Skip updating the patches repository")
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.BoolVar(&run, "r", false, "Run the project after build")
|
|
|
|
flag.BoolVar(&upload, "upload", false, "Upload the compressed build file to SourceForge")
|
|
|
|
flag.StringVar(&uploadPath, "upload-path", "", "Path to the file to upload if no build present")
|
2024-12-29 00:58:19 +01:00
|
|
|
flag.BoolVar(&skipDeps, "skip-deps", false, "Skip checking for required system dependencies")
|
2025-04-12 09:49:58 +02:00
|
|
|
flag.BoolVar(&ignoreErrors, "ignore-errors", false, "Processes all steps even if errors occur")
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.Bool("h", false, "Display help message")
|
2024-09-09 01:25:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func printHelp() {
|
2024-09-10 23:09:24 +02:00
|
|
|
fmt.Println("Usage: go run . -p=<path-to-build> -t=<target> [-c|--compress] [-v|--version=<version>] [-component=<component>] [-arch=<architecture>] [-release=<release>] [-platform=<platform>]")
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.PrintDefaults()
|
2025-01-18 17:03:14 +01:00
|
|
|
fmt.Println("Example: go run . --upload -c -a")
|
2024-09-10 23:02:25 +02:00
|
|
|
os.Exit(0)
|
2024-09-09 01:25:07 +02:00
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
func handleError(err error) {
|
|
|
|
if err != nil {
|
|
|
|
errors = append(errors, err)
|
|
|
|
if !ignoreErrors {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-09 01:25:07 +02:00
|
|
|
func main() {
|
2024-09-10 23:02:25 +02:00
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
if flag.Lookup("h").Value.(flag.Getter).Get().(bool) {
|
|
|
|
printHelp()
|
|
|
|
}
|
|
|
|
|
2024-12-29 00:58:19 +01:00
|
|
|
if !skipDeps {
|
2025-01-11 23:11:11 +01:00
|
|
|
if err := spitfire.CheckDependencies(); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
handleError(fmt.Errorf("system check failed: %w", err))
|
2024-12-29 00:58:19 +01:00
|
|
|
}
|
2024-12-08 09:05:39 +01:00
|
|
|
}
|
|
|
|
|
2024-09-10 23:02:25 +02:00
|
|
|
if version == "" && release == "nightly" {
|
2025-01-19 18:29:42 +01:00
|
|
|
version = time.Now().Format("2006.01.02")
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Save the initial directory
|
2025-01-19 18:29:42 +01:00
|
|
|
var err error
|
|
|
|
initialDir, err = os.Getwd()
|
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
handleError(fmt.Errorf("failed to get current directory: %w", err))
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
var buildDir string
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2024-12-11 17:12:00 +01:00
|
|
|
if all || buildFlag || prePatch || postPatch || clean || update || run {
|
2025-04-12 09:49:58 +02:00
|
|
|
buildDir, err = BuildProcess()
|
|
|
|
if err != nil {
|
|
|
|
handleError(fmt.Errorf("build process failed: %w", err))
|
|
|
|
} else if buildDir == "" && (buildFlag || all || run) {
|
|
|
|
handleError(fmt.Errorf("build directory not found after build process"))
|
2025-01-19 18:29:42 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if compress || upload {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := PackageAndUploadProcess(buildDir); err != nil {
|
|
|
|
handleError(fmt.Errorf("package/upload failed: %w", err))
|
2025-01-11 23:11:11 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
spitfire.PrintErrors()
|
2025-04-12 09:49:58 +02:00
|
|
|
|
|
|
|
if len(errors) > 0 {
|
|
|
|
fmt.Fprintf(os.Stderr, "Exiting with %d error(s):\n", len(errors))
|
|
|
|
for _, e := range errors {
|
|
|
|
fmt.Fprintf(os.Stderr, "- %v\n", e)
|
|
|
|
}
|
|
|
|
os.Exit(1)
|
|
|
|
} else {
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
2024-09-09 01:25:07 +02:00
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
func BuildProcess() (string, error) {
|
2025-01-18 11:48:30 +01:00
|
|
|
sourcePath, err := spitfire.ResolvePath("./mozilla-release")
|
2024-09-10 23:02:25 +02:00
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("resolve source path: %w", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
2025-01-19 18:29:42 +01:00
|
|
|
var buildDir string
|
|
|
|
|
2024-09-10 23:02:25 +02:00
|
|
|
if all {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.DownloadSource(sourcePath, sourceRepo); err != nil {
|
|
|
|
return "", fmt.Errorf("download source: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.DiscardChanges(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("discard changes: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.CleanBuild(sourcePath, fullClean); err != nil {
|
|
|
|
return "", fmt.Errorf("clean build: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.UpdateRepo(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("update repo: %w", err)
|
|
|
|
}
|
2024-12-11 17:07:08 +01:00
|
|
|
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("pre-patch: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.Configure(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("configure: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.Build(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("build: %w", err)
|
2024-12-08 14:34:31 +01:00
|
|
|
}
|
2025-01-19 18:29:42 +01:00
|
|
|
buildDir, err = spitfire.ResolveBuildDir(sourcePath)
|
2024-12-29 08:54:45 +01:00
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("resolve build dir: %w", err)
|
2024-12-29 08:54:45 +01:00
|
|
|
}
|
2024-12-11 17:07:08 +01:00
|
|
|
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("post-patch: %w", err)
|
2024-12-11 16:45:34 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
if run {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.RunProject(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("run project: %w", err)
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
fmt.Println("Spitfire build completed successfully.")
|
2024-12-13 14:31:28 +01:00
|
|
|
} else if buildFlag {
|
|
|
|
if prePatch {
|
|
|
|
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("pre-patch: %w", err)
|
2024-12-13 14:31:28 +01:00
|
|
|
}
|
|
|
|
}
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.Configure(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("configure: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.Build(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("build: %w", err)
|
|
|
|
}
|
2025-01-19 18:29:42 +01:00
|
|
|
buildDir, err = spitfire.ResolveBuildDir(sourcePath)
|
2024-12-29 08:54:45 +01:00
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("resolve build dir: %w", err)
|
2024-12-29 08:54:45 +01:00
|
|
|
}
|
2024-12-13 14:31:28 +01:00
|
|
|
if postPatch {
|
|
|
|
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("post-patch: %w", err)
|
2024-12-13 14:31:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if run {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.RunProject(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("run project: %w", err)
|
|
|
|
}
|
2024-12-13 14:31:28 +01:00
|
|
|
}
|
|
|
|
fmt.Println("Spitfire build completed successfully.")
|
2024-09-10 23:02:25 +02:00
|
|
|
} else if clean {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.CleanBuild(sourcePath, fullClean); err != nil {
|
|
|
|
return "", fmt.Errorf("clean build: %w", err)
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
fmt.Println("Cleaned Firefox build.")
|
|
|
|
} else if update {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.DownloadSource(sourcePath, sourceRepo); err != nil {
|
|
|
|
return "", fmt.Errorf("download source: %w", err)
|
|
|
|
}
|
|
|
|
if err := spitfire.UpdateRepo(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("update repo: %w", err)
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
fmt.Println("Mozilla repository updated.")
|
2024-12-11 17:07:08 +01:00
|
|
|
} else if prePatch {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.DownloadSource(sourcePath, sourceRepo); err != nil {
|
|
|
|
return "", fmt.Errorf("download source: %w", err)
|
|
|
|
}
|
2024-12-11 17:07:08 +01:00
|
|
|
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("pre-patch: %w", err)
|
2024-12-08 14:34:31 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
fmt.Println("Patches updated.")
|
2024-12-11 17:07:08 +01:00
|
|
|
} else if postPatch {
|
2025-01-19 18:29:42 +01:00
|
|
|
buildDir, err = spitfire.ResolveBuildDir(sourcePath)
|
2024-12-29 08:54:45 +01:00
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("resolve build dir: %w", err)
|
2024-12-29 08:54:45 +01:00
|
|
|
}
|
2024-12-11 17:07:08 +01:00
|
|
|
if _, err := os.Stat(buildDir); err == nil {
|
|
|
|
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return "", fmt.Errorf("post-patch: %w", err)
|
2024-12-11 17:07:08 +01:00
|
|
|
}
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
if run {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.RunProject(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("run project: %w", err)
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
2024-12-11 17:12:00 +01:00
|
|
|
} else if run {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.RunProject(sourcePath); err != nil {
|
|
|
|
return "", fmt.Errorf("run project: %w", err)
|
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
2025-01-19 18:29:42 +01:00
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
return buildDir, nil
|
2024-09-09 01:25:07 +02:00
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
func PackageAndUploadProcess(buildDir string) error {
|
2024-09-10 23:02:25 +02:00
|
|
|
restoreWorkingDirectory()
|
|
|
|
|
2025-01-11 23:11:11 +01:00
|
|
|
pathToUse := buildDir
|
2024-09-10 23:02:25 +02:00
|
|
|
if upload && uploadPath != "" {
|
|
|
|
pathToUse = uploadPath
|
|
|
|
}
|
|
|
|
|
|
|
|
if pathToUse == "" {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("no valid build or upload path provided")
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uncompressedSize, err := spitfire.GetDirectorySize(pathToUse)
|
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("get directory size: %w", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
2024-12-21 22:21:04 +01:00
|
|
|
fmt.Printf("Uncompressed directory size: %s\n", spitfire.BytesToHumanReadable(uncompressedSize))
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2024-12-23 11:24:42 +01:00
|
|
|
outputCompressedFile := filepath.Join(".", fmt.Sprintf(
|
|
|
|
"%s-%s-%s-%s.tar.gz",
|
|
|
|
component, arch, release, platform,
|
|
|
|
))
|
|
|
|
|
2024-09-10 23:02:25 +02:00
|
|
|
if compress {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.CompressDirectory(pathToUse, outputCompressedFile); err != nil {
|
|
|
|
return fmt.Errorf("compress directory: %w", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
fmt.Printf("Build directory compressed to: %s\n", outputCompressedFile)
|
|
|
|
}
|
|
|
|
|
|
|
|
compressedSize, err := spitfire.GetFileSize(outputCompressedFile)
|
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("get compressed file size: %w", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
2024-12-21 22:21:04 +01:00
|
|
|
fmt.Printf("Compressed file size: %s\n", spitfire.BytesToHumanReadable(compressedSize))
|
|
|
|
|
|
|
|
compressionRatio, efficiency := spitfire.CalculateCompressionEfficiency(uncompressedSize, compressedSize)
|
|
|
|
fmt.Printf("Compression ratio: %.2f:1\n", compressionRatio)
|
|
|
|
fmt.Printf("Compression efficiency: %.2f%%\n", efficiency)
|
2025-01-18 17:03:14 +01:00
|
|
|
fmt.Printf("Compressed dir: %s\n", pathToUse)
|
2025-01-11 23:11:11 +01:00
|
|
|
|
2024-12-23 11:24:42 +01:00
|
|
|
if !upload {
|
2025-04-12 09:49:58 +02:00
|
|
|
return nil
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2024-12-23 11:24:42 +01:00
|
|
|
config, err := spitfire.LoadConfig()
|
|
|
|
if err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("load config: %w", err)
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2024-12-23 11:24:42 +01:00
|
|
|
if _, err := os.Stat(outputCompressedFile); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("compressed file not found: %w", err)
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2024-12-23 11:24:42 +01:00
|
|
|
uploadDir := fmt.Sprintf("%s/%s/%s/%s", component, arch, release, version)
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.Upload(config, outputCompressedFile, "/home/frs/project/spitfire-browser/"+uploadDir+"/"); err != nil {
|
|
|
|
return fmt.Errorf("upload compressed file: %w", err)
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
|
|
|
fmt.Println("Compressed file uploaded successfully.")
|
2024-09-10 23:02:25 +02:00
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.DownloadAPPINDEX(config, "/home/frs/project/spitfire-browser/"); err != nil {
|
2024-12-23 11:24:42 +01:00
|
|
|
fmt.Println("Failed to download APPINDEX. A new one will be created and uploaded.")
|
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.PackageAPPINDEX(
|
|
|
|
packageName,
|
|
|
|
release,
|
|
|
|
version,
|
2024-12-23 11:24:42 +01:00
|
|
|
arch,
|
|
|
|
fmt.Sprintf("%d", compressedSize),
|
|
|
|
fmt.Sprintf("%d", uncompressedSize),
|
2025-04-12 09:49:58 +02:00
|
|
|
name,
|
2024-12-23 11:24:42 +01:00
|
|
|
url,
|
|
|
|
licence,
|
|
|
|
component,
|
|
|
|
maintainer,
|
2025-04-12 09:49:58 +02:00
|
|
|
"",
|
2024-12-23 11:24:42 +01:00
|
|
|
platform,
|
|
|
|
uploadDir,
|
2025-04-12 09:49:58 +02:00
|
|
|
); err != nil {
|
|
|
|
return fmt.Errorf("package APPINDEX: %w", err)
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
|
|
|
fmt.Println("APPINDEX updated successfully.")
|
|
|
|
|
|
|
|
if err := spitfire.CleanAppIndex(); err != nil {
|
2025-04-12 09:49:58 +02:00
|
|
|
return fmt.Errorf("clean APPINDEX: %w", err)
|
2024-12-23 11:24:42 +01:00
|
|
|
}
|
|
|
|
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := spitfire.UploadAPPINDEX(config, "/home/frs/project/spitfire-browser/"); err != nil {
|
|
|
|
return fmt.Errorf("upload APPINDEX: %w", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
2024-12-23 11:24:42 +01:00
|
|
|
fmt.Println("APPINDEX uploaded successfully.")
|
2025-04-12 09:49:58 +02:00
|
|
|
|
|
|
|
return nil
|
2024-09-09 01:25:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func restoreWorkingDirectory() {
|
2025-04-12 09:49:58 +02:00
|
|
|
if err := os.Chdir(initialDir); err != nil {
|
|
|
|
log.Printf("Failed to restore working directory: %v", err)
|
2024-09-10 23:02:25 +02:00
|
|
|
}
|
|
|
|
}
|