Merge branch 'vbatoufflet-mirror-edit-arch'

This commit is contained in:
Andrey Smirnov
2014-08-29 00:53:15 +04:00
5 changed files with 54 additions and 1 deletions
+10 -1
View File
@@ -35,6 +35,15 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
} }
} }
if context.globalFlags.Lookup("architectures").Value.String() != "" {
repo.Architectures = context.ArchitecturesList()
err = repo.Fetch(context.Downloader(), nil)
if err != nil {
return fmt.Errorf("unable to edit: %s", err)
}
}
err = context.CollectionFactory().RemoteRepoCollection().Update(repo) err = context.CollectionFactory().RemoteRepoCollection().Update(repo)
if err != nil { if err != nil {
return fmt.Errorf("unable to edit: %s", err) return fmt.Errorf("unable to edit: %s", err)
@@ -51,7 +60,7 @@ func makeCmdMirrorEdit() *commander.Command {
Short: "edit properties of mirorr", Short: "edit properties of mirorr",
Long: ` Long: `
Command edit allows to change settings of mirror: Command edit allows to change settings of mirror:
filters. filters, list of architectures.
Example: Example:
+2
View File
@@ -0,0 +1,2 @@
Downloading http://mirror.yandex.ru/debian/dists/wheezy/Release...
Mirror [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy successfully updated.
@@ -0,0 +1,19 @@
Name: wheezy-main
Archive Root URL: http://mirror.yandex.ru/debian/
Distribution: wheezy
Components: main
Architectures: amd64, s390
Download Sources: no
Number of packages: 56121
Information from release file:
Architectures: amd64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc
Codename: wheezy
Components: main contrib non-free
Date: Sat, 12 Jul 2014 10:59:25 UTC
Description: Debian 7.6 Released 12 July 2014
Label: Debian
Origin: Debian
Suite: stable
Version: 7.6
+2
View File
@@ -0,0 +1,2 @@
Downloading http://mirror.yandex.ru/debian/dists/wheezy/Release...
ERROR: unable to edit: architecture x56 not available in repo [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy
+21
View File
@@ -58,3 +58,24 @@ class EditMirror5Test(BaseTest):
self.check_output() self.check_output()
self.check_cmd_output("aptly mirror show mirror5", "mirror_show", match_prepare=removeDates) self.check_cmd_output("aptly mirror show mirror5", "mirror_show", match_prepare=removeDates)
class EditMirror6Test(BaseTest):
"""
edit mirror: change architectures
"""
fixtureDB = True
runCmd = "aptly mirror edit -architectures=amd64,s390 wheezy-main"
def check(self):
self.check_output()
self.check_cmd_output("aptly mirror show wheezy-main", "mirror_show", match_prepare=lambda s: re.sub(r"Last update: [0-9:+A-Za-z -]+\n", "", s))
class EditMirror7Test(BaseTest):
"""
edit mirror: change architectures to missing archs
"""
fixtureDB = True
runCmd = "aptly mirror edit -architectures=amd64,x56 wheezy-main"
expectedCode = 1