mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Cleanup improved and code redundant code removed.
Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
committed by
André Roth
parent
d87d8bac92
commit
ac5ecf946d
@@ -115,8 +115,8 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
|
||||
|
||||
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
|
||||
if !skipCleanup {
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, components,
|
||||
context.GetPublishedStorage(storage), collectionFactory, context.Progress())
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
|
||||
[]string{}, components, []string{}, collectionFactory, context.Progress())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to switch: %s", err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
@@ -77,20 +76,11 @@ 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(),
|
||||
publishedStorage, collectionFactory, context.Progress())
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
|
||||
result.AddedComponents(), result.UpdatedComponents(), result.RemovedComponents(), 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())
|
||||
|
||||
Reference in New Issue
Block a user