mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Implement 'legacy' Contents indexes to match Ubuntu <=16.04
Another index is created which unifies data for all the components. This certainly requires more resources as we have to build yet another index.
This commit is contained in:
+32
-6
@@ -562,6 +562,8 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
|
||||
indexes := newIndexFiles(publishedStorage, basePath, tempDir, suffix, p.AcquireByHash)
|
||||
|
||||
legacyContentIndexes := map[string]*ContentsIndex{}
|
||||
|
||||
for component, list := range lists {
|
||||
hadUdebs := false
|
||||
|
||||
@@ -612,15 +614,19 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
|
||||
if !p.SkipContents {
|
||||
key := fmt.Sprintf("%s-%v", arch, pkg.IsUdeb)
|
||||
qualifiedName := []byte(pkg.QualifiedName())
|
||||
contents := pkg.Contents(packagePool, progress)
|
||||
|
||||
contentIndex := contentIndexes[key]
|
||||
for _, contentIndexesMap := range []map[string]*ContentsIndex{contentIndexes, legacyContentIndexes} {
|
||||
contentIndex := contentIndexesMap[key]
|
||||
|
||||
if contentIndex == nil {
|
||||
contentIndex = NewContentsIndex(tempDB)
|
||||
contentIndexes[key] = contentIndex
|
||||
if contentIndex == nil {
|
||||
contentIndex = NewContentsIndex(tempDB)
|
||||
contentIndexesMap[key] = contentIndex
|
||||
}
|
||||
|
||||
contentIndex.Push(qualifiedName, contents)
|
||||
}
|
||||
|
||||
contentIndex.Push(pkg, packagePool, progress)
|
||||
}
|
||||
|
||||
bufWriter, err = indexes.PackageIndex(component, arch, pkg.IsUdeb).BufWriter()
|
||||
@@ -712,6 +718,26 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
}
|
||||
}
|
||||
|
||||
for _, arch := range p.Architectures {
|
||||
for _, udeb := range []bool{true, false} {
|
||||
index := legacyContentIndexes[fmt.Sprintf("%s-%v", arch, udeb)]
|
||||
if index == nil || index.Empty() {
|
||||
continue
|
||||
}
|
||||
|
||||
var bufWriter *bufio.Writer
|
||||
bufWriter, err = indexes.LegacyContentsIndex(arch, udeb).BufWriter()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to generate contents index: %v", err)
|
||||
}
|
||||
|
||||
_, err = index.WriteTo(bufWriter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to generate contents index: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if progress != nil {
|
||||
progress.Printf("Finalizing metadata files...\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user