Update to new PublishedRepo with multiple components. #36

Multiple component publishing doesn't work yet, but old features are working.
This commit is contained in:
Andrey Smirnov
2014-06-03 17:09:00 +04:00
parent ee71b93669
commit 7192049c16
26 changed files with 58 additions and 42 deletions
+2 -2
View File
@@ -73,7 +73,7 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
component := context.flags.Lookup("component").Value.String()
distribution := context.flags.Lookup("distribution").Value.String()
published, err := deb.NewPublishedRepo(prefix, distribution, component, context.ArchitecturesList(), source, context.CollectionFactory())
published, err := deb.NewPublishedRepo(prefix, distribution, context.ArchitecturesList(), []string{component}, []interface{}{source}, context.CollectionFactory())
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
}
@@ -101,7 +101,7 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}
prefix, component, distribution = published.Prefix, published.Component, published.Distribution
prefix, component, distribution = published.Prefix, strings.Join(published.Components(), " "), published.Distribution
if prefix == "." {
prefix = ""
} else if !strings.HasSuffix(prefix, "/") {
+8 -2
View File
@@ -55,7 +55,13 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to update: %s", err)
}
published.UpdateSnapshot(snapshot)
components := published.Components()
if len(components) > 1 {
panic("TODO: NOT IMPLEMENTED YET")
}
component := components[0]
published.UpdateSnapshot(component, snapshot)
signer, err := getSigner(context.flags)
if err != nil {
@@ -72,7 +78,7 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}
err = context.CollectionFactory().PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, published.Component,
err = context.CollectionFactory().PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, components,
context.PublishedStorage(), context.CollectionFactory(), context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
+8 -2
View File
@@ -37,7 +37,13 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to update: %s", err)
}
published.UpdateLocalRepo()
components := published.Components()
if len(components) > 1 {
panic("TODO: NOT IMPLEMENTED YET")
}
component := components[0]
published.UpdateLocalRepo(component)
signer, err := getSigner(context.flags)
if err != nil {
@@ -54,7 +60,7 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}
err = context.CollectionFactory().PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, published.Component,
err = context.CollectionFactory().PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, components,
context.PublishedStorage(), context.CollectionFactory(), context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)