(cmd *commander.Command, args []string)
| 11 | ) |
| 12 | |
| 13 | func aptlyMirrorCreate(cmd *commander.Command, args []string) error { |
| 14 | var err error |
| 15 | if !(len(args) == 2 && strings.HasPrefix(args[1], "ppa:") || len(args) >= 3) { |
| 16 | cmd.Usage() |
| 17 | return commander.ErrCommandError |
| 18 | } |
| 19 | |
| 20 | downloadSources := LookupOption(context.Config().DownloadSourcePackages, context.Flags(), "with-sources") |
| 21 | downloadUdebs := context.Flags().Lookup("with-udebs").Value.Get().(bool) |
| 22 | downloadInstaller := context.Flags().Lookup("with-installer").Value.Get().(bool) |
| 23 | downloadAppStream := context.Flags().Lookup("with-appstream").Value.Get().(bool) |
| 24 | ignoreSignatures := context.Config().GpgDisableVerify |
| 25 | if context.Flags().IsSet("ignore-signatures") { |
| 26 | ignoreSignatures = context.Flags().Lookup("ignore-signatures").Value.Get().(bool) |
| 27 | } |
| 28 | |
| 29 | var ( |
| 30 | mirrorName, archiveURL, distribution string |
| 31 | components []string |
| 32 | ) |
| 33 | |
| 34 | mirrorName = args[0] |
| 35 | if len(args) == 2 { |
| 36 | archiveURL, distribution, components, err = deb.ParsePPA(args[1], context.Config()) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | } else { |
| 41 | archiveURL, distribution, components = args[1], args[2], args[3:] |
| 42 | } |
| 43 | |
| 44 | repo, err := deb.NewRemoteRepo(mirrorName, archiveURL, distribution, components, context.ArchitecturesList(), |
| 45 | downloadSources, downloadUdebs, downloadInstaller, downloadAppStream) |
| 46 | if err != nil { |
| 47 | return fmt.Errorf("unable to create mirror: %s", err) |
| 48 | } |
| 49 | |
| 50 | repo.Filter = context.Flags().Lookup("filter").Value.String() // allows file/stdin with @ |
| 51 | repo.FilterWithDeps = context.Flags().Lookup("filter-with-deps").Value.Get().(bool) |
| 52 | repo.SkipComponentCheck = context.Flags().Lookup("force-components").Value.Get().(bool) |
| 53 | repo.SkipArchitectureCheck = context.Flags().Lookup("force-architectures").Value.Get().(bool) |
| 54 | |
| 55 | if repo.Filter != "" { |
| 56 | _, err = query.Parse(repo.Filter) |
| 57 | if err != nil { |
| 58 | return fmt.Errorf("unable to create mirror: %s", err) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | verifier, err := getVerifier(context.Flags()) |
| 63 | if err != nil { |
| 64 | return fmt.Errorf("unable to initialize GPG verifier: %s", err) |
| 65 | } |
| 66 | |
| 67 | err = repo.Fetch(context.Downloader(), verifier, ignoreSignatures) |
| 68 | if err != nil { |
| 69 | return fmt.Errorf("unable to fetch mirror: %s", err) |
| 70 | } |
nothing calls this directly
no test coverage detected