mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-12-04 18:36:26 +00:00
enhancement: add option to modify fetch path
This commit is contained in:
parent
fb33e724c0
commit
f6c9dba678
@ -24,6 +24,7 @@ import (
|
||||
"github.com/rocky-linux/srpmproc/pkg/srpmproc"
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var fetch = &cobra.Command{
|
||||
@ -39,7 +40,12 @@ func init() {
|
||||
}
|
||||
|
||||
func runFetch(_ *cobra.Command, _ []string) {
|
||||
err := srpmproc.Fetch(cdnUrl)
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatalf("could not get working directory: %v", err)
|
||||
}
|
||||
|
||||
err = srpmproc.Fetch(cdnUrl, wd)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -12,14 +12,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Fetch(cdnUrl string) error {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
func Fetch(cdnUrl string, dir string) error {
|
||||
metadataPath := ""
|
||||
err = filepath.Walk(wd, func(path string, info os.FileInfo, err error) error {
|
||||
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||
if strings.HasSuffix(path, ".metadata") {
|
||||
if metadataPath != "" {
|
||||
return errors.New("multiple metadata files")
|
||||
|
Loading…
Reference in New Issue
Block a user