mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-07 05:42:42 +00:00
Allow editing of mirror archive url
This is needed in case a mirror has moved or is down and need to move to new mirror.
This commit is contained in:
@@ -164,7 +164,7 @@ _aptly()
|
|||||||
"edit")
|
"edit")
|
||||||
if [[ $numargs -eq 0 ]]; then
|
if [[ $numargs -eq 0 ]]; then
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=($(compgen -W "-filter= -filter-with-deps -with-sources -with-udebs" -- ${cur}))
|
COMPREPLY=($(compgen -W "-archive-url= -filter= -filter-with-deps -ignore-signatures -keyring= -with-sources -with-udebs" -- ${cur}))
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur}))
|
COMPREPLY=($(compgen -W "$(__aptly_mirror_list)" -- ${cur}))
|
||||||
fi
|
fi
|
||||||
|
|||||||
+18
-1
@@ -3,6 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/smira/aptly/pgp"
|
||||||
"github.com/smira/aptly/query"
|
"github.com/smira/aptly/query"
|
||||||
"github.com/smira/commander"
|
"github.com/smira/commander"
|
||||||
"github.com/smira/flag"
|
"github.com/smira/flag"
|
||||||
@@ -25,6 +26,7 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
|
|||||||
return fmt.Errorf("unable to edit: %s", err)
|
return fmt.Errorf("unable to edit: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchMirror := false
|
||||||
context.Flags().Visit(func(flag *flag.Flag) {
|
context.Flags().Visit(func(flag *flag.Flag) {
|
||||||
switch flag.Name {
|
switch flag.Name {
|
||||||
case "filter":
|
case "filter":
|
||||||
@@ -35,6 +37,9 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
|
|||||||
repo.DownloadSources = flag.Value.Get().(bool)
|
repo.DownloadSources = flag.Value.Get().(bool)
|
||||||
case "with-udebs":
|
case "with-udebs":
|
||||||
repo.DownloadUdebs = flag.Value.Get().(bool)
|
repo.DownloadUdebs = flag.Value.Get().(bool)
|
||||||
|
case "archive-url":
|
||||||
|
repo.ArchiveRoot = flag.Value.String()
|
||||||
|
fetchMirror = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -51,8 +56,17 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
|
|||||||
|
|
||||||
if context.GlobalFlags().Lookup("architectures").Value.String() != "" {
|
if context.GlobalFlags().Lookup("architectures").Value.String() != "" {
|
||||||
repo.Architectures = context.ArchitecturesList()
|
repo.Architectures = context.ArchitecturesList()
|
||||||
|
fetchMirror = true
|
||||||
|
}
|
||||||
|
|
||||||
err = repo.Fetch(context.Downloader(), nil)
|
if fetchMirror {
|
||||||
|
var verifier pgp.Verifier
|
||||||
|
verifier, err = getVerifier(context.Flags())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to initialize GPG verifier: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = repo.Fetch(context.Downloader(), verifier)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to edit: %s", err)
|
return fmt.Errorf("unable to edit: %s", err)
|
||||||
}
|
}
|
||||||
@@ -83,10 +97,13 @@ Example:
|
|||||||
Flag: *flag.NewFlagSet("aptly-mirror-edit", flag.ExitOnError),
|
Flag: *flag.NewFlagSet("aptly-mirror-edit", flag.ExitOnError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.Flag.String("archive-url", "", "archive url is the root of archive")
|
||||||
cmd.Flag.String("filter", "", "filter packages in mirror")
|
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("filter-with-deps", false, "when filtering, include dependencies of matching packages as well")
|
||||||
|
cmd.Flag.Bool("ignore-signatures", false, "disable verification of Release file signatures")
|
||||||
cmd.Flag.Bool("with-sources", false, "download source packages in addition to binary packages")
|
cmd.Flag.Bool("with-sources", false, "download source packages in addition to binary packages")
|
||||||
cmd.Flag.Bool("with-udebs", false, "download .udeb packages (Debian installer support)")
|
cmd.Flag.Bool("with-udebs", false, "download .udeb packages (Debian installer support)")
|
||||||
|
cmd.Flag.Var(&keyRingsFlag{}, "keyring", "gpg keyring to use when verifying Release file (could be specified multiple times)")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "APTLY" "1" "September 2017" "" ""
|
.TH "APTLY" "1" "November 2017" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBaptly\fR \- Debian repository management tool
|
\fBaptly\fR \- Debian repository management tool
|
||||||
@@ -617,6 +617,10 @@ $ aptly mirror edit \-filter=nginx \-filter\-with\-deps some\-mirror
|
|||||||
Options:
|
Options:
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\-\fBarchive\-url\fR=
|
||||||
|
archive url is the root of archive
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\-\fBfilter\fR=
|
\-\fBfilter\fR=
|
||||||
filter packages in mirror
|
filter packages in mirror
|
||||||
.
|
.
|
||||||
@@ -625,6 +629,14 @@ filter packages in mirror
|
|||||||
when filtering, include dependencies of matching packages as well
|
when filtering, include dependencies of matching packages as well
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
\-\fBignore\-signatures\fR
|
||||||
|
disable verification of Release file signatures
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\-\fBkeyring\fR=
|
||||||
|
gpg keyring to use when verifying Release file (could be specified multiple times)
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\-\fBwith\-sources\fR
|
\-\fBwith\-sources\fR
|
||||||
download source packages in addition to binary packages
|
download source packages in addition to binary packages
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Downloading ftp://ftp.ru.debian.org/debian/dists/wheezy/Release...
|
||||||
|
Mirror [mirror10]: ftp://ftp.ch.debian.org/debian wheezy successfully updated.
|
||||||
@@ -65,7 +65,7 @@ class EditMirror6Test(BaseTest):
|
|||||||
edit mirror: change architectures
|
edit mirror: change architectures
|
||||||
"""
|
"""
|
||||||
fixtureDB = True
|
fixtureDB = True
|
||||||
runCmd = "aptly mirror edit -architectures=amd64,s390 wheezy-main"
|
runCmd = "aptly mirror edit -ignore-signatures -architectures=amd64,s390 wheezy-main"
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
self.check_output()
|
self.check_output()
|
||||||
@@ -77,7 +77,7 @@ class EditMirror7Test(BaseTest):
|
|||||||
edit mirror: change architectures to missing archs
|
edit mirror: change architectures to missing archs
|
||||||
"""
|
"""
|
||||||
fixtureDB = True
|
fixtureDB = True
|
||||||
runCmd = "aptly mirror edit -architectures=amd64,x56 wheezy-main"
|
runCmd = "aptly mirror edit -ignore-signatures -architectures=amd64,x56 wheezy-main"
|
||||||
expectedCode = 1
|
expectedCode = 1
|
||||||
|
|
||||||
|
|
||||||
@@ -101,3 +101,11 @@ class EditMirror9Test(BaseTest):
|
|||||||
fixtureGpg = True
|
fixtureGpg = True
|
||||||
runCmd = "aptly mirror edit -with-udebs mirror9"
|
runCmd = "aptly mirror edit -with-udebs mirror9"
|
||||||
expectedCode = 1
|
expectedCode = 1
|
||||||
|
|
||||||
|
|
||||||
|
class EditMirror10Test(BaseTest):
|
||||||
|
"""
|
||||||
|
edit mirror: change archive url
|
||||||
|
"""
|
||||||
|
fixtureCmds = ["aptly mirror create -ignore-signatures mirror10 ftp://ftp.ru.debian.org/debian wheezy main"]
|
||||||
|
runCmd = "aptly mirror edit -ignore-signatures -archive-url ftp://ftp.ch.debian.org/debian mirror10"
|
||||||
|
|||||||
Reference in New Issue
Block a user