diff --git a/.gitignore b/.gitignore index 0a58857..a1bf5d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ -mozilla-central -mozilla-release -.vscode -patches -APPINDEX -browser-amd64-* -sourceforge_config.json +/mozilla-central +/mozilla-release +/.vscode +/patches +/packages.json +/packages_temp.json +/APKINDEX +/APPINDEX +/browser-amd64-nightly-linux.tar.gz +/browser-amd64-nightly-windows.tar.gz +/sourceforge_config.json \ No newline at end of file diff --git a/spitfire/appindex.go b/spitfire/appindex.go index a5038bd..a25e305 100644 --- a/spitfire/appindex.go +++ b/spitfire/appindex.go @@ -37,8 +37,8 @@ func PackageAPPINDEX( // For demo, we call `calcChecksum` with a mock package name. checksum := calcChecksum(fileName) - // Remove existing entry based on P, R, A, o, and p: - removeExistingEntry(name, release, arch, origin, platform) + // Remove existing entry based on P, R, A, o (if you want to deduplicate). + removeExistingEntry(name, release, arch, origin) // Use current Unix timestamp timestamp := time.Now().Unix() @@ -100,8 +100,8 @@ func calcChecksum(input string) string { return fmt.Sprintf("%x", h.Sum(nil)) } -// removeExistingEntry removes an existing entry from APPINDEX if it matches P, R, A, o, and p fields. -func removeExistingEntry(name, release, arch, origin, platform string) { +// removeExistingEntry removes an existing entry from APPINDEX if it matches P, R, A, and o fields. +func removeExistingEntry(name, release, arch, origin string) { // Read file contents content, err := os.ReadFile("./APPINDEX") if err != nil { @@ -118,8 +118,8 @@ func removeExistingEntry(name, release, arch, origin, platform string) { inEntry := false // true when we're reading lines for a single entry - // We'll store the P, R, A, o, p values within the current entry - var pVal, rVal, aVal, oVal, plVal string + // Use these to store the P, R, A, o values within the current entry + var pVal, rVal, aVal, oVal string for _, line := range lines { trimmed := strings.TrimSpace(line) @@ -129,7 +129,7 @@ func removeExistingEntry(name, release, arch, origin, platform string) { // If we were in an entry previously, check if it should be removed or kept if inEntry && len(currentEntry) > 0 { // Decide whether to keep the previous entry - if !(pVal == name && rVal == release && aVal == arch && oVal == origin && plVal == platform) { + if !(pVal == name && rVal == release && aVal == arch && oVal == origin) { newLines = append(newLines, currentEntry...) newLines = append(newLines, "") // Blank line to separate entries } @@ -140,7 +140,7 @@ func removeExistingEntry(name, release, arch, origin, platform string) { inEntry = true // Reset these values for the new entry - pVal, rVal, aVal, oVal, plVal = "", "", "", "", "" + pVal, rVal, aVal, oVal = "", "", "", "" continue } @@ -148,7 +148,7 @@ func removeExistingEntry(name, release, arch, origin, platform string) { // Collect lines for this entry currentEntry = append(currentEntry, trimmed) - // Extract fields for matching later + // Extract P, R, A, o for matching later switch { case strings.HasPrefix(trimmed, "P:"): pVal = strings.TrimPrefix(trimmed, "P:") @@ -158,8 +158,6 @@ func removeExistingEntry(name, release, arch, origin, platform string) { aVal = strings.TrimPrefix(trimmed, "A:") case strings.HasPrefix(trimmed, "o:"): oVal = strings.TrimPrefix(trimmed, "o:") - case strings.HasPrefix(trimmed, "p:"): - plVal = strings.TrimPrefix(trimmed, "p:") } } else { // Lines outside of entries just get appended directly @@ -173,7 +171,7 @@ func removeExistingEntry(name, release, arch, origin, platform string) { // Handle the last entry if we ended inEntry if inEntry && len(currentEntry) > 0 { // Decide whether to keep the final entry - if !(pVal == name && rVal == release && aVal == arch && oVal == origin && plVal == platform) { + if !(pVal == name && rVal == release && aVal == arch && oVal == origin) { newLines = append(newLines, currentEntry...) } }