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

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, "/") {

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)

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)

View File

@@ -303,23 +303,27 @@ func (p *PublishedRepo) Components() []string {
// UpdateLocalRepo updates content from local repo in component
func (p *PublishedRepo) UpdateLocalRepo(component string) {
item := p.sourceItems[component]
if p.SourceKind != "local" {
panic("not local repo publish")
}
item := p.sourceItems[component]
item.packageRefs = item.localRepo.RefList()
p.sourceItems[component] = item
p.rePublishing = true
}
// UpdateSnapshot switches snapshot for component
func (p *PublishedRepo) UpdateSnapshot(component string, snapshot *Snapshot) {
item := p.sourceItems[component]
if p.SourceKind != "snapshot" {
panic("not snapshot publish")
}
item := p.sourceItems[component]
item.snapshot = snapshot
p.sourceItems[component] = item
p.Sources[component] = snapshot.UUID
p.rePublishing = true
}
@@ -846,7 +850,7 @@ func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(prefix st
referencedFiles := map[string][]string{}
if progress != nil {
progress.Printf("Cleaning up prefix %#v components %#v...\n", prefix, components)
progress.Printf("Cleaning up prefix %#v components %s...\n", prefix, strings.Join(components, ", "))
}
for _, r := range collection.list {

View File

@@ -1,3 +1,3 @@
Snapshot `snap1` is published currently:
* ./maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
* ./maverick [amd64, i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}
ERROR: unable to drop: snapshot is published

View File

@@ -1,3 +1,3 @@
Snapshot `snap1` is published currently:
* ./maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
* ./maverick [amd64, i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}
ERROR: unable to drop: snapshot is published

View File

@@ -1,4 +1,4 @@
Removing ${HOME}/.aptly/public/dists/sq1...
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Published repository has been removed successfully.

View File

@@ -1,4 +1,4 @@
Removing ${HOME}/.aptly/public/dists/sq2...
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Published repository has been removed successfully.

View File

@@ -1,5 +1,5 @@
Published repositories:
* ./maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
* ppa/smira/wheezy (contrib) [amd64] publishes [snap2]: Merged from sources: 'snap1'
* ppa/tr1/maverick (main, origin: origin1) [amd64, i386] publishes [snap2]: Merged from sources: 'snap1'
* ppa/tr2/maverick (main, label: label1) [amd64, i386] publishes [snap2]: Merged from sources: 'snap1'
* ./maverick [amd64, i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}
* ppa/smira/wheezy [amd64] publishes {contrib: [snap2]: Merged from sources: 'snap1'}
* ppa/tr1/maverick (origin: origin1) [amd64, i386] publishes {main: [snap2]: Merged from sources: 'snap1'}
* ppa/tr2/maverick (label: label1) [amd64, i386] publishes {main: [snap2]: Merged from sources: 'snap1'}

View File

@@ -1 +1 @@
ERROR: prefix/distribution already used by another published repo: ./maverick (main) [i386, source] publishes [local-repo]
ERROR: prefix/distribution already used by another published repo: ./maverick [i386, source] publishes {main: [local-repo]}

View File

@@ -1 +1 @@
ERROR: prefix/distribution already used by another published repo: ppa/maverick (main) [i386, source] publishes [local-repo]
ERROR: prefix/distribution already used by another published repo: ppa/maverick [i386, source] publishes {main: [local-repo]}

View File

@@ -1 +1 @@
ERROR: prefix/distribution already used by another published repo: ./maverick (main) [amd64, i386] publishes [snap7]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
ERROR: prefix/distribution already used by another published repo: ./maverick [amd64, i386] publishes {main: [snap7]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}

View File

@@ -1 +1 @@
ERROR: prefix/distribution already used by another published repo: ppa/maverick (main) [amd64, i386] publishes [snap8]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
ERROR: prefix/distribution already used by another published repo: ppa/maverick [amd64, i386] publishes {main: [snap8]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for snapshot ./maverick (main) [amd64, i386] publishes [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11' has been successfully switched to new snapshot.
Publish for snapshot ./maverick [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" component "main"...
Cleaning up prefix "ppa" components main...
Publish for snapshot ppa/maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick has been successfully switched to new snapshot.
Publish for snapshot ppa/maverick [amd64, i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully switched to new snapshot.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for snapshot ./maverick (main) [amd64, i386] publishes [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11' has been successfully switched to new snapshot.
Publish for snapshot ./maverick [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" component "main"...
Cleaning up prefix "ppa" components main...
Publish for snapshot ppa/maverick (main) [i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick has been successfully switched to new snapshot.
Publish for snapshot ppa/maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully switched to new snapshot.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for local repo ./maverick (main) [i386, source] publishes [local-repo] has been successfully updated.
Publish for local repo ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for local repo ./maverick (main) [i386, source] publishes [local-repo] has been successfully updated.
Publish for local repo ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for local repo ./maverick (main) [i386, source] publishes [local-repo] has been successfully updated.
Publish for local repo ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.

View File

@@ -2,6 +2,6 @@ Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Cleaning up prefix "." components main...
Publish for local repo ./maverick (main) [source] publishes [local-repo] has been successfully updated.
Publish for local repo ./maverick [source] publishes {main: [local-repo]} has been successfully updated.

View File

@@ -2,4 +2,4 @@ Loading packages...
[!] Unable to import file /02/03/pyspi_0.6.1-1.3.diff.gz into pool: open /02/03/pyspi_0.6.1-1.3.diff.gz: no such file or directory
[!] Some files were skipped due to errors:
/02/03/pyspi_0.6.1-1.3.dsc
ERROR: Some files failed to be added
ERROR: some files failed to be added

View File

@@ -2,4 +2,4 @@ Loading packages...
[!] Unable to process no-such-file: stat no-such-file: no such file or directory
[!] Some files were skipped due to errors:
no-such-file
ERROR: Some files failed to be added
ERROR: some files failed to be added

View File

@@ -2,4 +2,4 @@ Loading packages...
[!] Unable to add package to repo pyspi_0.6.1-1.3_source: conflict in package pyspi_0.6.1-1.3_source
[!] Some files were skipped due to errors:
/pyspi_0.6.1-1.3.conflict.dsc
ERROR: Some files failed to be added
ERROR: some files failed to be added

View File

@@ -2,4 +2,4 @@ Loading packages...
[!] Unable to import file /pyspi_0.6.1.orig.tar.gz into pool: unable to import into pool: file ${HOME}/.aptly/pool/de/f3/pyspi_0.6.1.orig.tar.gz already exists
[!] Some files were skipped due to errors:
/pyspi_0.6.1-1.3.dsc
ERROR: Some files failed to be added
ERROR: some files failed to be added

View File

@@ -1,3 +1,3 @@
Local repo `repo5` is published currently:
* ./squeeze (main) [i386, source] publishes [repo5]
* ./squeeze [i386, source] publishes {main: [repo5]}
ERROR: unable to drop: local repo is published