mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Introduce new flag -force-components to aptly mirror create to ignore
components in Release file while doing checks. #147
This commit is contained in:
@@ -42,6 +42,7 @@ func aptlyMirrorCreate(cmd *commander.Command, args []string) error {
|
||||
|
||||
repo.Filter = context.Flags().Lookup("filter").Value.String()
|
||||
repo.FilterWithDeps = context.Flags().Lookup("filter-with-deps").Value.Get().(bool)
|
||||
repo.SkipComponentCheck = context.Flags().Lookup("force-components").Value.Get().(bool)
|
||||
|
||||
if repo.Filter != "" {
|
||||
_, err = query.Parse(repo.Filter)
|
||||
@@ -95,6 +96,7 @@ Example:
|
||||
cmd.Flag.Bool("with-udebs", false, "download .udeb packages (Debian installer support)")
|
||||
cmd.Flag.String("filter", "", "filter packages in mirror")
|
||||
cmd.Flag.Bool("filter-with-deps", false, "when filtering, include dependencies of matching packages as well")
|
||||
cmd.Flag.Bool("force-components", false, "(only with component list) skip check that requested components are listed in Release file")
|
||||
cmd.Flag.Var(&keyRingsFlag{}, "keyring", "gpg keyring to use when verifying Release file (could be specified multiple times)")
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -58,6 +58,8 @@ type RemoteRepo struct {
|
||||
Filter string
|
||||
// FilterWithDeps to include dependencies from filter query
|
||||
FilterWithDeps bool
|
||||
// SkipComponentCheck skips component list verification
|
||||
SkipComponentCheck bool
|
||||
// Status marks state of repository (being updated, no action)
|
||||
Status int
|
||||
// WorkerPID is PID of the process modifying the mirror (if any)
|
||||
@@ -333,9 +335,9 @@ ok:
|
||||
}
|
||||
if len(repo.Components) == 0 {
|
||||
repo.Components = components
|
||||
} else {
|
||||
} else if !repo.SkipComponentCheck {
|
||||
err = utils.StringsIsSubset(repo.Components, components,
|
||||
fmt.Sprintf("component %%s not available in repo %s", repo))
|
||||
fmt.Sprintf("component %%s not available in repo %s, use -force-components to override", repo))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "APTLY" "1" "October 2014" "" ""
|
||||
.TH "APTLY" "1" "November 2014" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBaptly\fR \- Debian repository management tool
|
||||
@@ -315,6 +315,10 @@ filter packages in mirror
|
||||
when filtering, include dependencies of matching packages as well
|
||||
.
|
||||
.TP
|
||||
\-\fBforce\-components\fR=false
|
||||
(only with component list) skip check that requested components are listed in Release file
|
||||
.
|
||||
.TP
|
||||
\-\fBignore\-signatures\fR=false
|
||||
disable verification of Release file signatures
|
||||
.
|
||||
|
||||
@@ -21,6 +21,7 @@ Options:
|
||||
-dep-follow-suggests=false: when processing dependencies, follow Suggests
|
||||
-filter="": filter packages in mirror
|
||||
-filter-with-deps=false: when filtering, include dependencies of matching packages as well
|
||||
-force-components=false: (only with component list) skip check that requested components are listed in Release file
|
||||
-ignore-signatures=false: disable verification of Release file signatures
|
||||
-keyring=: gpg keyring to use when verifying Release file (could be specified multiple times)
|
||||
-with-sources=false: download source packages in addition to binary packages
|
||||
|
||||
@@ -12,6 +12,7 @@ Options:
|
||||
-dep-follow-suggests=false: when processing dependencies, follow Suggests
|
||||
-filter="": filter packages in mirror
|
||||
-filter-with-deps=false: when filtering, include dependencies of matching packages as well
|
||||
-force-components=false: (only with component list) skip check that requested components are listed in Release file
|
||||
-ignore-signatures=false: disable verification of Release file signatures
|
||||
-keyring=: gpg keyring to use when verifying Release file (could be specified multiple times)
|
||||
-with-sources=false: download source packages in addition to binary packages
|
||||
|
||||
4
system/t04_mirror/CreateMirror28Test_gold
Normal file
4
system/t04_mirror/CreateMirror28Test_gold
Normal file
@@ -0,0 +1,4 @@
|
||||
Downloading http://downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/Release...
|
||||
|
||||
Mirror [mirror28]: http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist successfully added.
|
||||
You can run 'aptly mirror update mirror28' to download repository contents.
|
||||
20
system/t04_mirror/CreateMirror28Test_mirror_show
Normal file
20
system/t04_mirror/CreateMirror28Test_mirror_show
Normal file
@@ -0,0 +1,20 @@
|
||||
Name: mirror28
|
||||
Archive Root URL: http://downloads-distro.mongodb.org/repo/ubuntu-upstart/
|
||||
Distribution: dist
|
||||
Components: 10gen
|
||||
Architectures: amd64, i386
|
||||
Download Sources: no
|
||||
Download .udebs: no
|
||||
Last update: never
|
||||
|
||||
Information from release file:
|
||||
Architectures: i386 amd64
|
||||
Codename: dist
|
||||
Components: mongodb
|
||||
Date: Tue, 04 Nov 2014 00:04:56 UTC
|
||||
Description: mongodb packages
|
||||
|
||||
Label: mongodb
|
||||
Origin: mongodb
|
||||
Suite: mongodb
|
||||
Version: dist
|
||||
@@ -1,2 +1,2 @@
|
||||
Downloading http://mirror.yandex.ru/debian/dists/wheezy/Release...
|
||||
ERROR: unable to fetch mirror: component life not available in repo [mirror4]: http://mirror.yandex.ru/debian/ wheezy
|
||||
ERROR: unable to fetch mirror: component life not available in repo [mirror4]: http://mirror.yandex.ru/debian/ wheezy, use -force-components to override
|
||||
|
||||
@@ -317,3 +317,14 @@ class CreateMirror27Test(BaseTest):
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly mirror show mirror27", "mirror_show")
|
||||
|
||||
|
||||
class CreateMirror28Test(BaseTest):
|
||||
"""
|
||||
create mirror: -force-components
|
||||
"""
|
||||
runCmd = "aptly mirror create -ignore-signatures -force-components mirror28 http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly mirror show mirror28", "mirror_show")
|
||||
|
||||
Reference in New Issue
Block a user