Fix test cases.

Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
Christoph Fiehe
2024-10-10 16:14:25 +02:00
committed by André Roth
parent 9dffe791ad
commit d87d8bac92
30 changed files with 942 additions and 300 deletions
+11 -1
View File
@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"path/filepath"
"github.com/aptly-dev/aptly/deb"
"github.com/smira/commander"
@@ -76,11 +77,20 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
if !skipCleanup {
publishedStorage := context.GetPublishedStorage(storage)
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, result.UpdatedComponents(),
context.GetPublishedStorage(storage), collectionFactory, context.Progress())
publishedStorage, collectionFactory, context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
// Cleanup files belonging to a removed component by dropping the component directory from the storage backend.
for _, component := range result.RemovedComponents() {
err = publishedStorage.RemoveDirs(filepath.Join(prefix, "dists", distribution, component), context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
}
}
context.Progress().Printf("\nPublished %s repository %s has been successfully updated.\n", published.SourceKind, published.String())