mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Fixing tests and fix cleanup.
Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
committed by
André Roth
parent
ac5ecf946d
commit
f8f28e9554
@@ -267,7 +267,7 @@ func aptlyMirrorUpdate(cmd *commander.Command, args []string) error {
|
||||
return fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
context.Progress().Printf("\nMirror `%s` has been successfully updated.\n", repo.Name)
|
||||
context.Progress().Printf("\nMirror `%s` has been updated successfully.\n", repo.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ func aptlyPublishSourceAdd(cmd *commander.Command, args []string) error {
|
||||
name := names[i]
|
||||
_, exists := sources[component]
|
||||
if exists {
|
||||
return fmt.Errorf("unable to add: component %q has already been added", component)
|
||||
return fmt.Errorf("unable to add: component '%s' has already been added", component)
|
||||
}
|
||||
context.Progress().Printf("Adding component %q with source %q [%s]...\n", component, name, published.SourceKind)
|
||||
context.Progress().Printf("Adding component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
|
||||
|
||||
sources[component] = names[i]
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error {
|
||||
for _, component := range components {
|
||||
name, exists := sources[component]
|
||||
if !exists {
|
||||
return fmt.Errorf("unable to remove: component %q does not exist", component)
|
||||
return fmt.Errorf("unable to remove: component '%s' does not exist", component)
|
||||
}
|
||||
context.Progress().Printf("Removing component %q with source %q [%s]...\n", component, name, published.SourceKind)
|
||||
context.Progress().Printf("Removing component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
|
||||
|
||||
delete(sources, component)
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ func aptlyPublishSourceUpdate(cmd *commander.Command, args []string) error {
|
||||
name := names[i]
|
||||
_, exists := sources[component]
|
||||
if !exists {
|
||||
return fmt.Errorf("unable to update: component %q does not exist", component)
|
||||
return fmt.Errorf("unable to update: component '%s' does not exist", component)
|
||||
}
|
||||
context.Progress().Printf("Updating component %q with source %q [%s]...\n", component, name, published.SourceKind)
|
||||
context.Progress().Printf("Updating component '%s' with source '%s' [%s]...\n", component, name, published.SourceKind)
|
||||
|
||||
sources[component] = name
|
||||
}
|
||||
|
||||
@@ -115,8 +115,7 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
|
||||
|
||||
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
|
||||
if !skipCleanup {
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
|
||||
[]string{}, components, []string{}, collectionFactory, context.Progress())
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published, components, collectionFactory, context.Progress())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to switch: %s", err)
|
||||
}
|
||||
|
||||
@@ -76,14 +76,15 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
|
||||
|
||||
skipCleanup := context.Flags().Lookup("skip-cleanup").Value.Get().(bool)
|
||||
if !skipCleanup {
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published,
|
||||
result.AddedComponents(), result.UpdatedComponents(), result.RemovedComponents(), collectionFactory, context.Progress())
|
||||
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
|
||||
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
|
||||
err = collectionFactory.PublishedRepoCollection().CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, 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())
|
||||
context.Progress().Printf("\nPublished %s repository %s has been updated successfully.\n", published.SourceKind, published.String())
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user