diff --git a/AUTHORS b/AUTHORS index 2bfcd75c41..8301df2c7b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,4 +22,5 @@ List of contributors, in chronological order: * Phil Frost (https://github.com/bitglue) * Benoit Foucher (https://github.com/bentoi) * Geoffrey Thomas (https://github.com/geofft) +* Oliver Sauder (https://github.com/sliverc) * Harald Sitter (https://github.com/apachelogger) diff --git a/cmd/publish.go b/cmd/publish.go index c468cabae2..0f8bdd2ad8 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -37,6 +37,7 @@ func makeCmdPublish() *commander.Command { makeCmdPublishSnapshot(), makeCmdPublishSwitch(), makeCmdPublishUpdate(), + makeCmdPublishShow(), }, } } diff --git a/cmd/publish_show.go b/cmd/publish_show.go new file mode 100644 index 0000000000..cf8310f134 --- /dev/null +++ b/cmd/publish_show.go @@ -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 [[:]]", + Short: "shows details of published repository", + Long: ` +Command show displays full information of a published repository. + +Example: + + $ aptly publish show wheezy +`, + } + + return cmd +} diff --git a/cmd/snapshot_show.go b/cmd/snapshot_show.go index 6e275e0e20..a0bf5f1b16 100644 --- a/cmd/snapshot_show.go +++ b/cmd/snapshot_show.go @@ -29,6 +29,35 @@ func aptlySnapshotShow(cmd *commander.Command, args []string) error { fmt.Printf("Created At: %s\n", snapshot.CreatedAt.Format("2006-01-02 15:04:05 MST")) fmt.Printf("Description: %s\n", snapshot.Description) fmt.Printf("Number of packages: %d\n", snapshot.NumPackages()) + if len(snapshot.SourceIDs) > 0 { + fmt.Printf("Sources:\n") + for _, sourceID := range snapshot.SourceIDs { + var name string + if snapshot.SourceKind == "snapshot" { + source, err := context.CollectionFactory().SnapshotCollection().ByUUID(sourceID) + if err != nil { + continue + } + name = source.Name + } else if snapshot.SourceKind == "local" { + source, err := context.CollectionFactory().LocalRepoCollection().ByUUID(sourceID) + if err != nil { + continue + } + name = source.Name + } else if snapshot.SourceKind == "repo" { + source, err := context.CollectionFactory().RemoteRepoCollection().ByUUID(sourceID) + if err != nil { + continue + } + name = source.Name + } + + if name != "" { + fmt.Printf(" %s [%s]\n", name, snapshot.SourceKind) + } + } + } withPackages := context.Flags().Lookup("with-packages").Value.Get().(bool) if withPackages { diff --git a/man/aptly.1 b/man/aptly.1 index 798e39c97f..b4444e1dc5 100644 --- a/man/aptly.1 +++ b/man/aptly.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "APTLY" "1" "November 2016" "" "" +.TH "APTLY" "1" "January 2017" "" "" . .SH "NAME" \fBaptly\fR \- Debian repository management tool @@ -506,6 +506,10 @@ disable verification of Release file signatures \-\fBkeyring\fR= gpg keyring to use when verifying Release file (could be specified multiple times) . +.TP +\-\fBmax\-tries\fR=1 +max download tries till process fails with download error +. .SH "RENAMES MIRROR" \fBaptly\fR \fBmirror\fR \fBrename\fR \fIold\-name\fR \fInew\-name\fR . @@ -1536,6 +1540,25 @@ don\(cqt generate Contents indexes \-\fBskip\-signing\fR=false don\(cqt sign Release files with GPG . +.SH "SHOWS DETAILS OF PUBLISHED REPOSITORY" +\fBaptly\fR \fBpublish\fR \fBshow\fR \fIdistribution\fR [[\fIendpoint\fR:]\fIprefix\fR] +. +.P +Command show displays full information of a published repository\. +. +.P +Example: +. +.IP "" 4 +. +.nf + +$ aptly publish show wheezy +. +.fi +. +.IP "" 0 +. .SH "SEARCH FOR PACKAGES MATCHING QUERY" \fBaptly\fR \fBpackage\fR \fBsearch\fR \fIpackage\-query\fR . @@ -1834,5 +1857,8 @@ Benoit Foucher (https://github\.com/bentoi) .IP "\[ci]" 4 Geoffrey Thomas (https://github\.com/geofft) . +.IP "\[ci]" 4 +Oliver Sauder (https://github\.com/sliverc) +. .IP "" 0 diff --git a/system/t05_snapshot/CreateSnapshot1Test_snapshot_show b/system/t05_snapshot/CreateSnapshot1Test_snapshot_show index ec800e5650..986b0541f4 100644 --- a/system/t05_snapshot/CreateSnapshot1Test_snapshot_show +++ b/system/t05_snapshot/CreateSnapshot1Test_snapshot_show @@ -2,6 +2,8 @@ Name: snap1 Created At: 2014-06-29 01:43:01 MSK Description: Snapshot from mirror [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy Number of packages: 56121 +Sources: + wheezy-main [repo] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/CreateSnapshot6Test_snapshot_show b/system/t05_snapshot/CreateSnapshot6Test_snapshot_show index 3b1be9b678..0cce2773c5 100644 --- a/system/t05_snapshot/CreateSnapshot6Test_snapshot_show +++ b/system/t05_snapshot/CreateSnapshot6Test_snapshot_show @@ -1,6 +1,8 @@ Name: snap6 Description: Snapshot from local repo [local-repo] Number of packages: 3 +Sources: + local-repo [local] Packages: libboost-program-options-dev_1.49.0.1_i386 pyspi_0.6.1-1.3_source diff --git a/system/t05_snapshot/FilterSnapshot1Test_snapshot_show b/system/t05_snapshot/FilterSnapshot1Test_snapshot_show index bd085c4dc2..ae84f6f3ec 100644 --- a/system/t05_snapshot/FilterSnapshot1Test_snapshot_show +++ b/system/t05_snapshot/FilterSnapshot1Test_snapshot_show @@ -1,6 +1,8 @@ Name: snap2 Description: Filtered 'snap1', query was: 'mame unrar' Number of packages: 4 +Sources: + snap1 [snapshot] Packages: mame_0.146-5_amd64 unrar_1:4.1.4-1_amd64 diff --git a/system/t05_snapshot/FilterSnapshot2Test_snapshot_show b/system/t05_snapshot/FilterSnapshot2Test_snapshot_show index 677c33d174..2993f1f645 100644 --- a/system/t05_snapshot/FilterSnapshot2Test_snapshot_show +++ b/system/t05_snapshot/FilterSnapshot2Test_snapshot_show @@ -1,6 +1,8 @@ Name: snap2 Description: Filtered 'snap1', query was: 'rsyslog (>= 7.4.4)' Number of packages: 9 +Sources: + snap1 [snapshot] Packages: init-system-helpers_1.18~bpo70+1_all libestr0_0.1.9-1~bpo70+1_amd64 diff --git a/system/t05_snapshot/FilterSnapshot3Test_snapshot_show b/system/t05_snapshot/FilterSnapshot3Test_snapshot_show index 680283f285..0a5ab28aec 100644 --- a/system/t05_snapshot/FilterSnapshot3Test_snapshot_show +++ b/system/t05_snapshot/FilterSnapshot3Test_snapshot_show @@ -1,6 +1,8 @@ Name: snap2 Description: Filtered 'snap1', query was: 'Priority (required) nginx xyz' Number of packages: 123 +Sources: + snap1 [snapshot] Packages: debconf_1.5.49_all debconf-i18n_1.5.49_all diff --git a/system/t05_snapshot/FilterSnapshot7Test_snapshot_show b/system/t05_snapshot/FilterSnapshot7Test_snapshot_show index b5e570383d..f4829a70fc 100644 --- a/system/t05_snapshot/FilterSnapshot7Test_snapshot_show +++ b/system/t05_snapshot/FilterSnapshot7Test_snapshot_show @@ -1,6 +1,8 @@ Name: snap2 Description: Filtered 'snap1', query was: 'rsyslog (>= 7.4.4), $Architecture (i386)' Number of packages: 10 +Sources: + snap1 [snapshot] Packages: init-system-helpers_1.18~bpo70+1_all libestr0_0.1.9-1~bpo70+1_i386 diff --git a/system/t05_snapshot/MergeSnapshot1Test_snapshot_show b/system/t05_snapshot/MergeSnapshot1Test_snapshot_show index 226b6e6eb0..3e58f25b70 100644 --- a/system/t05_snapshot/MergeSnapshot1Test_snapshot_show +++ b/system/t05_snapshot/MergeSnapshot1Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 02:23:49 MSK Description: Merged from sources: 'snap1', 'snap2' Number of packages: 56782 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/MergeSnapshot3Test_snapshot_show b/system/t05_snapshot/MergeSnapshot3Test_snapshot_show index 34370753b7..8e941b21ad 100644 --- a/system/t05_snapshot/MergeSnapshot3Test_snapshot_show +++ b/system/t05_snapshot/MergeSnapshot3Test_snapshot_show @@ -2,6 +2,10 @@ Name: snap4 Created At: 2014-06-29 02:14:26 MSK Description: Merged from sources: 'snap1', 'snap2', 'snap3' Number of packages: 58968 +Sources: + snap1 [snapshot] + snap2 [snapshot] + snap3 [snapshot] Packages: 0ad-data_0.0.16-1~bpo70+1_all 0ad-data-common_0.0.16-1~bpo70+1_all diff --git a/system/t05_snapshot/MergeSnapshot6Test_snapshot_show b/system/t05_snapshot/MergeSnapshot6Test_snapshot_show index b9e2d850cc..bd5b0d10f0 100644 --- a/system/t05_snapshot/MergeSnapshot6Test_snapshot_show +++ b/system/t05_snapshot/MergeSnapshot6Test_snapshot_show @@ -2,6 +2,10 @@ Name: snap4 Created At: 2014-06-29 02:15:01 MSK Description: Merged from sources: 'snap1', 'snap2', 'snap3' Number of packages: 58802 +Sources: + snap1 [snapshot] + snap2 [snapshot] + snap3 [snapshot] Packages: 0ad-data_0.0.16-1~bpo70+1_all 0ad-data-common_0.0.16-1~bpo70+1_all diff --git a/system/t05_snapshot/MergeSnapshot7Test_snapshot_show b/system/t05_snapshot/MergeSnapshot7Test_snapshot_show index d415bd80ef..1aae13ec45 100644 --- a/system/t05_snapshot/MergeSnapshot7Test_snapshot_show +++ b/system/t05_snapshot/MergeSnapshot7Test_snapshot_show @@ -2,6 +2,10 @@ Name: snap4 Created At: 2014-06-29 02:16:12 MSK Description: Merged from sources: 'snap3', 'snap2', 'snap1' Number of packages: 58817 +Sources: + snap3 [snapshot] + snap2 [snapshot] + snap1 [snapshot] Packages: 0ad-data_0~r11863-1_all 0ad-data-common_0.0.16-1~bpo70+1_all diff --git a/system/t05_snapshot/MergeSnapshot9Test_snapshot_show b/system/t05_snapshot/MergeSnapshot9Test_snapshot_show index 1523da81de..f297d57e7b 100644 --- a/system/t05_snapshot/MergeSnapshot9Test_snapshot_show +++ b/system/t05_snapshot/MergeSnapshot9Test_snapshot_show @@ -2,6 +2,10 @@ Name: snap4 Created At: 2014-06-29 02:19:14 MSK Description: Merged from sources: 'snap1', 'snap2', 'snap3' Number of packages: 61524 +Sources: + snap1 [snapshot] + snap2 [snapshot] + snap3 [snapshot] Packages: 0ad-data_0.0.16-1~bpo70+1_all 0ad-data_0~r11863-1_all diff --git a/system/t05_snapshot/PullSnapshot10Test_snapshot_show b/system/t05_snapshot/PullSnapshot10Test_snapshot_show index 08899aa055..ac069c34b2 100644 --- a/system/t05_snapshot/PullSnapshot10Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot10Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 02:00:49 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'rsyslog (>= 7.4.4)' Number of packages: 73295 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot11Test_snapshot_show b/system/t05_snapshot/PullSnapshot11Test_snapshot_show index 222b839b1d..ab408decce 100644 --- a/system/t05_snapshot/PullSnapshot11Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot11Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 02:03:59 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'rsyslog (>= 7.4.4)' Number of packages: 56130 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot1Test_snapshot_show b/system/t05_snapshot/PullSnapshot1Test_snapshot_show index da75b7b348..0594db120a 100644 --- a/system/t05_snapshot/PullSnapshot1Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot1Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 02:31:20 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'mame unrar' Number of packages: 56125 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot2Test_snapshot_show b/system/t05_snapshot/PullSnapshot2Test_snapshot_show index 35675c4d48..f578445a19 100644 --- a/system/t05_snapshot/PullSnapshot2Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot2Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 01:50:10 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'rsyslog (>= 7.4.4)' Number of packages: 56126 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot3Test_snapshot_show b/system/t05_snapshot/PullSnapshot3Test_snapshot_show index 7c65e2563a..be6b311a7a 100644 --- a/system/t05_snapshot/PullSnapshot3Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot3Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 01:52:15 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'rsyslog (>= 7.4.4)' Number of packages: 56121 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot8Test_snapshot_show b/system/t05_snapshot/PullSnapshot8Test_snapshot_show index 40bc593fd2..b7bf2b64df 100644 --- a/system/t05_snapshot/PullSnapshot8Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot8Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 01:57:44 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'lunar-landing mars-landing (>= 1.0)' Number of packages: 56121 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/PullSnapshot9Test_snapshot_show b/system/t05_snapshot/PullSnapshot9Test_snapshot_show index d22ccb7fbc..d45b529ebd 100644 --- a/system/t05_snapshot/PullSnapshot9Test_snapshot_show +++ b/system/t05_snapshot/PullSnapshot9Test_snapshot_show @@ -2,6 +2,9 @@ Name: snap3 Created At: 2014-06-29 01:58:24 MSK Description: Pulled into 'snap1' with 'snap2' as source, pull request was: 'rsyslog (>= 7.4.4)' Number of packages: 56131 +Sources: + snap1 [snapshot] + snap2 [snapshot] Packages: 0ad-data_0~r11863-1_all 2ping_2.0-1_all diff --git a/system/t05_snapshot/ShowSnapshot1Test_gold b/system/t05_snapshot/ShowSnapshot1Test_gold index 8fb9317ae4..390c015025 100644 --- a/system/t05_snapshot/ShowSnapshot1Test_gold +++ b/system/t05_snapshot/ShowSnapshot1Test_gold @@ -2,6 +2,8 @@ Name: snap1 Created At: 2014-06-28 03:01:02 MSK Description: Snapshot from mirror [wheezy-non-free]: http://mirror.yandex.ru/debian/ wheezy Number of packages: 661 +Sources: + wheezy-non-free [repo] Packages: abs-guide_6.5-1_all album_4.06-2_all diff --git a/system/t05_snapshot/ShowSnapshot3Test_gold b/system/t05_snapshot/ShowSnapshot3Test_gold index c7c8b4b939..eadba6c2e8 100644 --- a/system/t05_snapshot/ShowSnapshot3Test_gold +++ b/system/t05_snapshot/ShowSnapshot3Test_gold @@ -2,3 +2,5 @@ Name: snap1 Created At: 2014-01-24 13:06:43 MSK Description: Snapshot from mirror [wheezy-non-free]: http://mirror.yandex.ru/debian/ wheezy Number of packages: 661 +Sources: + wheezy-non-free [repo] diff --git a/system/t06_publish/PublishShow1Test_gold b/system/t06_publish/PublishShow1Test_gold new file mode 100644 index 0000000000..5223f2cca4 --- /dev/null +++ b/system/t06_publish/PublishShow1Test_gold @@ -0,0 +1,5 @@ +Prefix: . +Distribution: maverick +Architectures: amd64 i386 +Sources: + main: snap1 [snapshot] diff --git a/system/t06_publish/PublishShow2Test_gold b/system/t06_publish/PublishShow2Test_gold new file mode 100644 index 0000000000..ff0ee82327 --- /dev/null +++ b/system/t06_publish/PublishShow2Test_gold @@ -0,0 +1,5 @@ +Prefix: ppa/smira +Distribution: maverick +Architectures: amd64 i386 +Sources: + main: snap1 [snapshot] diff --git a/system/t06_publish/__init__.py b/system/t06_publish/__init__.py index 3531ee1c5e..8187f03e53 100644 --- a/system/t06_publish/__init__.py +++ b/system/t06_publish/__init__.py @@ -3,6 +3,7 @@ """ from .drop import * +from .show import * from .list import * from .repo import * from .snapshot import * diff --git a/system/t06_publish/show.py b/system/t06_publish/show.py new file mode 100644 index 0000000000..5149142c78 --- /dev/null +++ b/system/t06_publish/show.py @@ -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"