diff --git a/.gitignore b/.gitignore index a1bf5d6..0a58857 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ -/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 +mozilla-central +mozilla-release +.vscode +patches +APPINDEX +browser-amd64-* +sourceforge_config.json diff --git a/spitfire/appindex.go b/spitfire/appindex.go index a25e305..a5038bd 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 (if you want to deduplicate). - removeExistingEntry(name, release, arch, origin) + // Remove existing entry based on P, R, A, o, and p: + removeExistingEntry(name, release, arch, origin, platform) // 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, and o fields. -func removeExistingEntry(name, release, arch, origin string) { +// 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) { // Read file contents content, err := os.ReadFile("./APPINDEX") if err != nil { @@ -118,8 +118,8 @@ func removeExistingEntry(name, release, arch, origin string) { inEntry := false // true when we're reading lines for a single entry - // Use these to store the P, R, A, o values within the current entry - var pVal, rVal, aVal, oVal string + // We'll store the P, R, A, o, p values within the current entry + var pVal, rVal, aVal, oVal, plVal string for _, line := range lines { trimmed := strings.TrimSpace(line) @@ -129,7 +129,7 @@ func removeExistingEntry(name, release, arch, origin 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) { + if !(pVal == name && rVal == release && aVal == arch && oVal == origin && plVal == platform) { newLines = append(newLines, currentEntry...) newLines = append(newLines, "") // Blank line to separate entries } @@ -140,7 +140,7 @@ func removeExistingEntry(name, release, arch, origin string) { inEntry = true // Reset these values for the new entry - pVal, rVal, aVal, oVal = "", "", "", "" + pVal, rVal, aVal, oVal, plVal = "", "", "", "", "" continue } @@ -148,7 +148,7 @@ func removeExistingEntry(name, release, arch, origin string) { // Collect lines for this entry currentEntry = append(currentEntry, trimmed) - // Extract P, R, A, o for matching later + // Extract fields for matching later switch { case strings.HasPrefix(trimmed, "P:"): pVal = strings.TrimPrefix(trimmed, "P:") @@ -158,6 +158,8 @@ func removeExistingEntry(name, release, arch, origin 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 @@ -171,7 +173,7 @@ func removeExistingEntry(name, release, arch, origin 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) { + if !(pVal == name && rVal == release && aVal == arch && oVal == origin && plVal == platform) { newLines = append(newLines, currentEntry...) } }