mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
Added publish show command
This commit is contained in:
@@ -37,6 +37,7 @@ func makeCmdPublish() *commander.Command {
|
|||||||
makeCmdPublishSnapshot(),
|
makeCmdPublishSnapshot(),
|
||||||
makeCmdPublishSwitch(),
|
makeCmdPublishSwitch(),
|
||||||
makeCmdPublishUpdate(),
|
makeCmdPublishUpdate(),
|
||||||
|
makeCmdPublishShow(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/smira/aptly/deb"
|
||||||
|
"github.com/smira/commander"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func aptlyPublishShow(cmd *commander.Command, args []string) error {
|
||||||
|
var err error
|
||||||
|
if len(args) < 1 || len(args) > 2 {
|
||||||
|
cmd.Usage()
|
||||||
|
return commander.ErrCommandError
|
||||||
|
}
|
||||||
|
|
||||||
|
distribution := args[0]
|
||||||
|
param := "."
|
||||||
|
|
||||||
|
if len(args) == 2 {
|
||||||
|
param = args[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
storage, prefix := deb.ParsePrefix(param)
|
||||||
|
|
||||||
|
repo, err := context.CollectionFactory().PublishedRepoCollection().ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to show: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if repo.Storage != "" {
|
||||||
|
fmt.Printf("Storage: %s\n", repo.Storage)
|
||||||
|
}
|
||||||
|
fmt.Printf("Prefix: %s\n", repo.Prefix)
|
||||||
|
if repo.Distribution != "" {
|
||||||
|
fmt.Printf("Distribution: %s\n", repo.Distribution)
|
||||||
|
}
|
||||||
|
fmt.Printf("Architectures: %s\n", strings.Join(repo.Architectures, " "))
|
||||||
|
|
||||||
|
fmt.Printf("Sources:\n")
|
||||||
|
for component, sourceID := range repo.Sources {
|
||||||
|
var name string
|
||||||
|
if repo.SourceKind == "snapshot" {
|
||||||
|
source, err := context.CollectionFactory().SnapshotCollection().ByUUID(sourceID)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
name = source.Name
|
||||||
|
} else if repo.SourceKind == "local" {
|
||||||
|
source, err := context.CollectionFactory().LocalRepoCollection().ByUUID(sourceID)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
name = source.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
if name != "" {
|
||||||
|
fmt.Printf(" %s: %s [%s]\n", component, name, repo.SourceKind)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeCmdPublishShow() *commander.Command {
|
||||||
|
cmd := &commander.Command{
|
||||||
|
Run: aptlyPublishShow,
|
||||||
|
UsageLine: "show <distribution> [[<endpoint>:]<prefix>]",
|
||||||
|
Short: "shows details of published repository",
|
||||||
|
Long: `
|
||||||
|
Command show displays full information of a published repository.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
$ aptly publish show wheezy
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Prefix: .
|
||||||
|
Distribution: maverick
|
||||||
|
Architectures: amd64 i386
|
||||||
|
Sources:
|
||||||
|
main: snap1 [snapshot]
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Prefix: ppa/smira
|
||||||
|
Distribution: maverick
|
||||||
|
Architectures: amd64 i386
|
||||||
|
Sources:
|
||||||
|
main: snap1 [snapshot]
|
||||||
@@ -3,6 +3,7 @@ Testing publishing snapshots
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .drop import *
|
from .drop import *
|
||||||
|
from .show import *
|
||||||
from .list import *
|
from .list import *
|
||||||
from .repo import *
|
from .repo import *
|
||||||
from .snapshot import *
|
from .snapshot import *
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
from lib import BaseTest
|
||||||
|
|
||||||
|
|
||||||
|
class PublishShow1Test(BaseTest):
|
||||||
|
"""
|
||||||
|
publish show: existing snapshot
|
||||||
|
"""
|
||||||
|
fixtureDB = True
|
||||||
|
fixturePool = True
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||||
|
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1",
|
||||||
|
]
|
||||||
|
runCmd = "aptly publish show maverick"
|
||||||
|
|
||||||
|
|
||||||
|
class PublishShow2Test(BaseTest):
|
||||||
|
"""
|
||||||
|
publish show: under prefix
|
||||||
|
"""
|
||||||
|
fixtureDB = True
|
||||||
|
fixturePool = True
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly snapshot create snap1 from mirror gnuplot-maverick",
|
||||||
|
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira",
|
||||||
|
]
|
||||||
|
runCmd = "aptly publish show maverick ppa/smira"
|
||||||
Reference in New Issue
Block a user