mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
feat: propagate AppStreamFiles through snapshots
This commit is contained in:
committed by
André Roth
parent
6a5b9ddacf
commit
f25ba2e6b0
+25
-7
@@ -40,6 +40,9 @@ type Snapshot struct {
|
|||||||
NotAutomatic string
|
NotAutomatic string
|
||||||
ButAutomaticUpgrades string
|
ButAutomaticUpgrades string
|
||||||
|
|
||||||
|
// AppStream files: relative path → pool path (pass-through from mirror)
|
||||||
|
AppStreamFiles map[string]string `json:",omitempty"`
|
||||||
|
|
||||||
packageRefs *PackageRefList
|
packageRefs *PackageRefList
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +62,7 @@ func NewSnapshotFromRepository(name string, repo *RemoteRepo) (*Snapshot, error)
|
|||||||
Origin: repo.Meta["Origin"],
|
Origin: repo.Meta["Origin"],
|
||||||
NotAutomatic: repo.Meta["NotAutomatic"],
|
NotAutomatic: repo.Meta["NotAutomatic"],
|
||||||
ButAutomaticUpgrades: repo.Meta["ButAutomaticUpgrades"],
|
ButAutomaticUpgrades: repo.Meta["ButAutomaticUpgrades"],
|
||||||
|
AppStreamFiles: repo.AppStreamFiles,
|
||||||
packageRefs: repo.packageRefs,
|
packageRefs: repo.packageRefs,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -94,14 +98,28 @@ func NewSnapshotFromRefList(name string, sources []*Snapshot, list *PackageRefLi
|
|||||||
sourceUUIDs[i] = sources[i].UUID
|
sourceUUIDs[i] = sources[i].UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge AppStreamFiles from all source snapshots
|
||||||
|
var mergedAppStream map[string]string
|
||||||
|
for _, source := range sources {
|
||||||
|
if len(source.AppStreamFiles) > 0 {
|
||||||
|
if mergedAppStream == nil {
|
||||||
|
mergedAppStream = make(map[string]string)
|
||||||
|
}
|
||||||
|
for k, v := range source.AppStreamFiles {
|
||||||
|
mergedAppStream[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &Snapshot{
|
return &Snapshot{
|
||||||
UUID: uuid.NewString(),
|
UUID: uuid.NewString(),
|
||||||
Name: name,
|
Name: name,
|
||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
SourceKind: "snapshot",
|
SourceKind: "snapshot",
|
||||||
SourceIDs: sourceUUIDs,
|
SourceIDs: sourceUUIDs,
|
||||||
Description: description,
|
Description: description,
|
||||||
packageRefs: list,
|
AppStreamFiles: mergedAppStream,
|
||||||
|
packageRefs: list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user