Fix bad tabbing, default to the 25.04 branch

ubuntu/plucky
Simon Quigley 1 week ago
parent e57ad37808
commit 4d6176bc13

@ -155,17 +155,18 @@ func main() {
func collectSnapsToProcess(snapsDir, assertionsDir string) ([]SnapDetails, error) {
var snapsToProcess []SnapDetails
fallbackChannel := "latest/stable"
for snapEntry := range requiredSnaps {
// Extract channel if specified, default to "stable"
parts := strings.SplitN(snapEntry, "=", 2)
channel := "stable"
channel := "latest/stable/ubuntu-25.04"
if len(parts) == 2 {
channel = parts[1]
}
snapName := parts[0]
// Collect snap dependencies and their statuses
snapList, err := collectSnapDependencies(snapName, channel, snapsDir, assertionsDir)
snapList, err := collectSnapDependencies(snapName, channel, fallbackChannel, snapsDir, assertionsDir)
if err != nil {
return nil, err
}

@ -20,7 +20,7 @@ type SnapDetails struct {
}
// collectSnapDependencies collects all dependencies for a given snap, marking them as requiredSnaps regardless of whether they need updates.
func collectSnapDependencies(snapName, channel, snapsDir, assertionsDir string) ([]SnapDetails, error) {
func collectSnapDependencies(snapName, channel, fallbackChannel, snapsDir, assertionsDir string) ([]SnapDetails, error) {
var snapDetailsList []SnapDetails
if processedSnaps[snapName] {
@ -37,14 +37,37 @@ func collectSnapDependencies(snapName, channel, snapsDir, assertionsDir string)
if oldSnap == nil || oldSnap.SnapID == "" || oldSnap.Revision.N == 0 {
result, err = fetchOrRefreshSnapInfo(snapName, nil, channel)
if err != nil {
return nil, err // Added 0 for int64
if strings.Contains(err.Error(), "no snap revision available as specified") {
result, err = fetchOrRefreshSnapInfo(snapName, nil, fallbackChannel)
if err != nil {
return nil, err
}
} else {
return nil, err
}
}
} else {
result, err = fetchOrRefreshSnapInfo(snapName, oldSnap, channel)
if err != nil && strings.Contains(err.Error(), "snap has no updates available") {
if err != nil {
if strings.Contains(err.Error(), "snap has no updates available") {
result, err = fetchOrRefreshSnapInfo(snapName, nil, channel)
if err != nil {
return nil, err // Added 0 for int64
return nil, err
}
} else if strings.Contains(err.Error(), "no snap revision available as specified") {
result, err = fetchOrRefreshSnapInfo(snapName, oldSnap, fallbackChannel)
if err != nil {
if strings.Contains(err.Error(), "snap has no updates available") {
result, err = fetchOrRefreshSnapInfo(snapName, nil, fallbackChannel)
if err != nil {
return nil, err
}
} else {
return nil, err
}
}
} else {
return nil, err
}
}
}
@ -86,7 +109,7 @@ func collectSnapDependencies(snapName, channel, snapsDir, assertionsDir string)
for prereq := range missingPrereqs {
if !processedSnaps[prereq] {
verboseLog("Collecting dependencies for prerequisite snap: %s for %s", prereq, snapName)
prereqDetails, err := collectSnapDependencies(prereq, "stable", snapsDir, assertionsDir)
prereqDetails, err := collectSnapDependencies(prereq, channel, fallbackChannel, snapsDir, assertionsDir)
if err != nil {
// Additional logging for dependency resolution issues
verboseLog("Failed to collect dependencies for prerequisite %s for snap %s: %v", prereq, snapName, err)
@ -99,7 +122,7 @@ func collectSnapDependencies(snapName, channel, snapsDir, assertionsDir string)
// Also handle base snaps safely
if info.Base != "" && !processedSnaps[info.Base] {
verboseLog("Collecting dependencies for base snap: %s for %s", info.Base, snapName)
baseDetails, err := collectSnapDependencies(info.Base, "stable", snapsDir, assertionsDir)
baseDetails, err := collectSnapDependencies(info.Base, channel, fallbackChannel, snapsDir, assertionsDir)
if err != nil {
verboseLog("Failed to collect dependencies for base snap %s for snap %s: %v", info.Base, snapName, err)
return nil, fmt.Errorf("failed to collect dependencies for base snap %s for snap %s: %v", info.Base, snapName, err) // Added 0 for int64

Loading…
Cancel
Save