Showing download sources argument in mirror show and mirror list.

This commit is contained in:
Andrey Smirnov
2014-02-15 16:56:10 +04:00
parent fb9b90e715
commit e4d8ef4744
3 changed files with 24 additions and 1 deletions
+5
View File
@@ -138,6 +138,11 @@ func aptlyMirrorShow(cmd *commander.Command, args []string) error {
fmt.Printf("Distribution: %s\n", repo.Distribution) fmt.Printf("Distribution: %s\n", repo.Distribution)
fmt.Printf("Components: %s\n", strings.Join(repo.Components, ", ")) fmt.Printf("Components: %s\n", strings.Join(repo.Components, ", "))
fmt.Printf("Architectures: %s\n", strings.Join(repo.Architectures, ", ")) fmt.Printf("Architectures: %s\n", strings.Join(repo.Architectures, ", "))
downloadSources := "no"
if repo.DownloadSources {
downloadSources = "yes"
}
fmt.Printf("Download Sources: %s\n", downloadSources)
if repo.LastDownloadDate.IsZero() { if repo.LastDownloadDate.IsZero() {
fmt.Printf("Last update: never\n") fmt.Printf("Last update: never\n")
} else { } else {
+9 -1
View File
@@ -86,7 +86,15 @@ func (repo *RemoteRepo) prepare() error {
// String interface // String interface
func (repo *RemoteRepo) String() string { func (repo *RemoteRepo) String() string {
return fmt.Sprintf("[%s]: %s %s", repo.Name, repo.ArchiveRoot, repo.Distribution) srcFlag := ""
if repo.DownloadSources {
srcFlag = " [src]"
}
distribution := repo.Distribution
if distribution == "" {
distribution = "./"
}
return fmt.Sprintf("[%s]: %s %s%s", repo.Name, repo.ArchiveRoot, distribution, srcFlag)
} }
// IsFlat determines if repository is flat // IsFlat determines if repository is flat
+10
View File
@@ -103,6 +103,16 @@ func (s *RemoteRepoSuite) TestFlatCreation(c *C) {
c.Check(err, ErrorMatches, "components aren't supported for flat repos") c.Check(err, ErrorMatches, "components aren't supported for flat repos")
} }
func (s *RemoteRepoSuite) TestString(c *C) {
c.Check(s.repo.String(), Equals, "[yandex]: http://mirror.yandex.ru/debian/ squeeze")
c.Check(s.flat.String(), Equals, "[exp42]: http://repos.express42.com/virool/precise/ ./")
s.repo.DownloadSources = true
s.flat.DownloadSources = true
c.Check(s.repo.String(), Equals, "[yandex]: http://mirror.yandex.ru/debian/ squeeze [src]")
c.Check(s.flat.String(), Equals, "[exp42]: http://repos.express42.com/virool/precise/ ./ [src]")
}
func (s *RemoteRepoSuite) TestNumPackages(c *C) { func (s *RemoteRepoSuite) TestNumPackages(c *C) {
c.Check(s.repo.NumPackages(), Equals, 0) c.Check(s.repo.NumPackages(), Equals, 0)
s.repo.packageRefs = s.reflist s.repo.packageRefs = s.reflist