Default distribution/component could be specified when creating repo. #12

This commit is contained in:
Andrey Smirnov
2014-03-26 21:24:09 +04:00
parent 7f2f435e2d
commit 0f8f43b9f0
38 changed files with 113 additions and 49 deletions

View File

@@ -15,6 +15,8 @@ func aptlyRepoCreate(cmd *commander.Command, args []string) error {
}
repo := debian.NewLocalRepo(args[0], cmd.Flag.Lookup("comment").Value.String())
repo.DefaultDistribution = cmd.Flag.Lookup("distribution").Value.String()
repo.DefaultComponent = cmd.Flag.Lookup("component").Value.String()
err = context.collectionFactory.LocalRepoCollection().Add(repo)
if err != nil {
@@ -43,6 +45,8 @@ Example:
}
cmd.Flag.String("comment", "", "any text that would be used to described local repository")
cmd.Flag.String("distribution", "", "default distribution when publishing")
cmd.Flag.String("component", "main", "default component when publishing")
return cmd
}

View File

@@ -27,6 +27,8 @@ func aptlyRepoShow(cmd *commander.Command, args []string) error {
fmt.Printf("Name: %s\n", repo.Name)
fmt.Printf("Comment: %s\n", repo.Comment)
fmt.Printf("Default Distribution: %s\n", repo.DefaultDistribution)
fmt.Printf("Default Component: %s\n", repo.DefaultComponent)
fmt.Printf("Number of packages: %d\n", repo.NumPackages())
withPackages := cmd.Flag.Lookup("with-packages").Value.Get().(bool)

View File

@@ -1,5 +1,7 @@
Name: repo10
Comment: Repo10
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Repo1
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Repo2
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
pyspi_0.6.1-1.3_source

View File

@@ -1,5 +1,7 @@
Name: repo3
Comment: Repo3
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo4
Comment: Repo4
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,3 +1,5 @@
Name: repo5
Comment: Repo5
Default Distribution: squeeze
Default Component: main
Number of packages: 0

View File

@@ -1,5 +1,7 @@
Name: repo8
Comment: Repo8
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
pyspi_0.6.1-1.3_source

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,4 +1,6 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 0
Packages:

View File

@@ -1,3 +1,5 @@
Name: repo1
Comment:
Default Distribution:
Default Component: main
Number of packages: 0

View File

@@ -1,3 +1,5 @@
Name: repo2
Comment: Repository2
Default Distribution: maverick
Default Component: non-free
Number of packages: 0

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 5
Packages:
nginx_1.2.1-2.2+wheezy2_all

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 20
Packages:
gcc-4.7-base_4.7.2-5_amd64

View File

@@ -1,4 +1,6 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 0
Packages:

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
pyspi_0.6.1-1.3_source

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
pyspi_0.6.1-1.3_source

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 2
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,4 +1,6 @@
Name: repo2
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 0
Packages:

View File

@@ -1,5 +1,7 @@
Name: local-repo
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,5 +1,7 @@
Name: local-repo
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 1
Packages:
pyspi_0.6.1-1.3_source

View File

@@ -1,5 +1,7 @@
Name: local-repo
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -1,3 +1,5 @@
Name: repo1
Comment: Cool
Default Distribution: squeeze
Default Component: main
Number of packages: 0

View File

@@ -1,5 +1,7 @@
Name: repo2
Comment: Cool
Default Distribution: wheezy
Default Component: contrib
Number of packages: 3
Packages:
libboost-program-options-dev_1.49.0.1_i386

View File

@@ -10,7 +10,7 @@ class AddRepo1Test(BaseTest):
add package to local repo: .deb file
"""
fixtureCmds = [
"aptly repo create -comment=Repo1 repo1",
"aptly repo create -comment=Repo1 -distribution=squeeze repo1",
]
runCmd = "aptly repo add repo1 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb"
@@ -27,7 +27,7 @@ class AddRepo2Test(BaseTest):
add package to local repo: .dsc file
"""
fixtureCmds = [
"aptly repo create -comment=Repo2 repo2",
"aptly repo create -comment=Repo2 -distribution=squeeze repo2",
]
runCmd = "aptly repo add repo2 ${files}/pyspi_0.6.1-1.3.dsc ${files}/pyspi-0.6.1-1.3.stripped.dsc"
@@ -47,7 +47,7 @@ class AddRepo3Test(BaseTest):
add package to local repo: directory
"""
fixtureCmds = [
"aptly repo create -comment=Repo3 repo3",
"aptly repo create -comment=Repo3 -distribution=squeeze repo3",
]
runCmd = "aptly repo add repo3 ${files}"
@@ -68,7 +68,7 @@ class AddRepo4Test(BaseTest):
add package to local repo: complex directory + remove
"""
fixtureCmds = [
"aptly repo create -comment=Repo4 repo4",
"aptly repo create -comment=Repo4 -distribution=squeeze repo4",
]
runCmd = "aptly repo add -remove-files repo4 "
@@ -121,7 +121,7 @@ class AddRepo5Test(BaseTest):
add package to local repo: some source files missing
"""
fixtureCmds = [
"aptly repo create -comment=Repo5 repo5",
"aptly repo create -comment=Repo5 -distribution=squeeze repo5",
]
runCmd = "aptly repo add repo5 "
outputMatchPrepare = lambda self, s: s.replace(self.tempSrcDir, "")
@@ -151,7 +151,7 @@ class AddRepo6Test(BaseTest):
add package to local repo: missing file
"""
fixtureCmds = [
"aptly repo create -comment=Repo6 repo6",
"aptly repo create -comment=Repo6 -distribution=squeeze repo6",
]
runCmd = "aptly repo add repo6 no-such-file"
@@ -169,7 +169,7 @@ class AddRepo8Test(BaseTest):
add package to local repo: conflict in packages
"""
fixtureCmds = [
"aptly repo create -comment=Repo8 repo8",
"aptly repo create -comment=Repo8 -distribution=squeeze repo8",
"aptly repo add repo8 ${files}/pyspi_0.6.1-1.3.dsc",
]
runCmd = "aptly repo add repo8 ${testfiles}/pyspi_0.6.1-1.3.conflict.dsc"
@@ -184,7 +184,7 @@ class AddRepo9Test(BaseTest):
add package to local repo: conflict in files
"""
fixtureCmds = [
"aptly repo create -comment=Repo9 repo9",
"aptly repo create -comment=Repo9 -distribution=squeeze repo9",
]
runCmd = "aptly repo add repo9 ${files}/pyspi_0.6.1-1.3.dsc"
outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "")
@@ -203,7 +203,7 @@ class AddRepo10Test(BaseTest):
add package to local repo: double import
"""
fixtureCmds = [
"aptly repo create -comment=Repo10 repo10",
"aptly repo create -comment=Repo10 -distribution=squeeze repo10",
"aptly repo add repo10 ${files}",
]
runCmd = "aptly repo add repo10 ${files}/pyspi_0.6.1-1.3.dsc"

View File

@@ -7,7 +7,7 @@ class ImportRepo1Test(BaseTest):
"""
fixtureDB = True
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo import wheezy-main repo1 nginx unpaper_0.4.2-1_amd64"
@@ -26,7 +26,7 @@ class ImportRepo2Test(BaseTest):
"""
fixtureDB = True
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly -architectures=i386,amd64 repo import -with-deps wheezy-main repo1 dpkg_1.16.12_i386 userinfo_2.2-3_amd64"
@@ -45,7 +45,7 @@ class ImportRepo3Test(BaseTest):
"""
fixtureDB = True
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo import -with-deps wheezy-contrib repo1 redeclipse"
expectedCode = 1
@@ -60,7 +60,7 @@ class ImportRepo4Test(BaseTest):
"""
fixtureDB = True
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly -architectures=i386,amd64 repo import -dry-run -with-deps wheezy-contrib repo1 redeclipse-dbg"
@@ -78,7 +78,7 @@ class ImportRepo5Test(BaseTest):
"""
fixtureDB = True
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo import wheezy-contrib repo1 'pyspi >> 0.6.1-1.3)'"
expectedCode = 1
@@ -92,7 +92,7 @@ class ImportRepo6Test(BaseTest):
import to local repo: non-updated mirror
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly mirror create --ignore-signatures mirror1 http://mirror.yandex.ru/debian/ wheezy",
]
runCmd = "aptly repo import mirror1 repo1 nginx"
@@ -115,7 +115,7 @@ class ImportRepo8Test(BaseTest):
import to local repo: no src
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo import wheezy-main repo1 pyspi"
expectedCode = 1

View File

@@ -6,8 +6,8 @@ class CopyRepo1Test(BaseTest):
copy in local repo: simple copy
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo copy repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -26,8 +26,8 @@ class CopyRepo2Test(BaseTest):
copy in local repo: simple copy w/deps
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly -architectures=i386,amd64 repo copy -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -46,8 +46,8 @@ class CopyRepo3Test(BaseTest):
copy in local repo: simple copy w/deps but w/o archs
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo copy -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -62,8 +62,8 @@ class CopyRepo4Test(BaseTest):
copy in local repo: dry run
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo copy -dry-run repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -82,8 +82,8 @@ class CopyRepo5Test(BaseTest):
copy in local repo: wrong dep
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo copy repo1 repo2 'pyspi >> 0.6.1-1.3)'"
@@ -98,7 +98,7 @@ class CopyRepo6Test(BaseTest):
copy in local repo: same src and dest
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo copy repo1 repo1 pyspi"
expectedCode = 1
@@ -109,7 +109,7 @@ class CopyRepo7Test(BaseTest):
copy in local repo: no dst
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo copy repo1 repo2 pyspi"
expectedCode = 1
@@ -120,7 +120,7 @@ class CopyRepo8Test(BaseTest):
copy in local repo: no src
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
]
runCmd = "aptly repo copy repo1 repo2 pyspi"
expectedCode = 1

View File

@@ -14,9 +14,9 @@ class CreateRepo1Test(BaseTest):
class CreateRepo2Test(BaseTest):
"""
create local repo: regular repo with comment
create local repo: regular repo with comment & publishing defaults
"""
runCmd = "aptly repo create -comment=Repository2 repo2"
runCmd = "aptly repo create -comment=Repository2 -distribution=maverick -component=non-free repo2"
def check(self):
self.check_output()

View File

@@ -6,8 +6,8 @@ class MoveRepo1Test(BaseTest):
move in local repo: simple move
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo move repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -26,8 +26,8 @@ class MoveRepo2Test(BaseTest):
move in local repo: simple move w/deps
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly -architectures=i386,amd64 repo move -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -46,8 +46,8 @@ class MoveRepo3Test(BaseTest):
move in local repo: simple move w/deps but w/o archs
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo move -with-deps repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -62,8 +62,8 @@ class MoveRepo4Test(BaseTest):
move in local repo: dry run
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo move -dry-run repo1 repo2 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -82,8 +82,8 @@ class MoveRepo5Test(BaseTest):
move in local repo: wrong dep
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
"aptly repo add repo1 ${files}"
]
runCmd = "aptly repo move repo1 repo2 'pyspi >> 0.6.1-1.3)'"
@@ -98,7 +98,7 @@ class MoveRepo6Test(BaseTest):
move in local repo: same src and dest
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo move repo1 repo1 pyspi"
expectedCode = 1
@@ -109,7 +109,7 @@ class MoveRepo7Test(BaseTest):
move in local repo: no dst
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo1",
"aptly repo create -comment=Cool -distribution=squeeze repo1",
]
runCmd = "aptly repo move repo1 repo2 pyspi"
expectedCode = 1
@@ -120,7 +120,7 @@ class MoveRepo8Test(BaseTest):
move in local repo: no src
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=squeeze repo2",
]
runCmd = "aptly repo move repo1 repo2 pyspi"
expectedCode = 1

View File

@@ -6,7 +6,7 @@ class RemoveRepo1Test(BaseTest):
remove from local repo: as dep
"""
fixtureCmds = [
"aptly repo create -comment=Cool local-repo",
"aptly repo create -comment=Cool -distribution=squeeze local-repo",
"aptly repo add local-repo ${files}"
]
runCmd = "aptly repo remove local-repo pyspi some"
@@ -24,7 +24,7 @@ class RemoveRepo2Test(BaseTest):
remove from local repo: as dep with version, key
"""
fixtureCmds = [
"aptly repo create -comment=Cool local-repo",
"aptly repo create -comment=Cool -distribution=squeeze local-repo",
"aptly repo add local-repo ${files}"
]
runCmd = "aptly repo remove local-repo 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"
@@ -50,7 +50,7 @@ class RemoveRepo4Test(BaseTest):
remove from local repo: dry run
"""
fixtureCmds = [
"aptly repo create -comment=Cool local-repo",
"aptly repo create -comment=Cool -distribution=squeeze local-repo",
"aptly repo add local-repo ${files}"
]
runCmd = "aptly repo remove -dry-run local-repo 'pyspi (>> 0.6.1-1.3)' libboost-program-options-dev_1.49.0.1_i386"

View File

@@ -5,7 +5,7 @@ class ShowRepo1Test(BaseTest):
"""
show local repo: regular
"""
fixtureCmds = ["aptly repo create -comment=Cool repo1"]
fixtureCmds = ["aptly repo create -comment=Cool -distribution=squeeze repo1"]
runCmd = "aptly repo show repo1"
@@ -14,7 +14,7 @@ class ShowRepo2Test(BaseTest):
show local repo: -with-packages
"""
fixtureCmds = [
"aptly repo create -comment=Cool repo2",
"aptly repo create -comment=Cool -distribution=wheezy -component=contrib repo2",
"aptly repo add repo2 ${files}"
]
runCmd = "aptly repo show -with-packages repo2"