Switch to new download system
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
e785c6b53d
commit
d26b288cde
14
build.go
14
build.go
|
@ -22,6 +22,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -40,10 +41,10 @@ import (
|
||||||
"github.com/goreleaser/nfpm/v2/files"
|
"github.com/goreleaser/nfpm/v2/files"
|
||||||
"go.arsenm.dev/logger/log"
|
"go.arsenm.dev/logger/log"
|
||||||
"go.arsenm.dev/lure/distro"
|
"go.arsenm.dev/lure/distro"
|
||||||
"go.arsenm.dev/lure/download"
|
|
||||||
"go.arsenm.dev/lure/internal/cliutils"
|
"go.arsenm.dev/lure/internal/cliutils"
|
||||||
"go.arsenm.dev/lure/internal/config"
|
"go.arsenm.dev/lure/internal/config"
|
||||||
"go.arsenm.dev/lure/internal/cpu"
|
"go.arsenm.dev/lure/internal/cpu"
|
||||||
|
"go.arsenm.dev/lure/internal/dl"
|
||||||
"go.arsenm.dev/lure/internal/repos"
|
"go.arsenm.dev/lure/internal/repos"
|
||||||
"go.arsenm.dev/lure/internal/shutils"
|
"go.arsenm.dev/lure/internal/shutils"
|
||||||
"go.arsenm.dev/lure/internal/shutils/decoder"
|
"go.arsenm.dev/lure/internal/shutils/decoder"
|
||||||
|
@ -548,10 +549,11 @@ func getSources(ctx context.Context, srcdir string, bv *BuildVars) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, src := range bv.Sources {
|
for i, src := range bv.Sources {
|
||||||
opts := download.GetOptions{
|
opts := dl.Options{
|
||||||
SourceURL: src,
|
Name: fmt.Sprintf("%s[%d]", bv.Name, i),
|
||||||
|
URL: src,
|
||||||
Destination: srcdir,
|
Destination: srcdir,
|
||||||
EncloseGit: true,
|
Progress: os.Stderr,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.EqualFold(bv.Checksums[i], "SKIP") {
|
if !strings.EqualFold(bv.Checksums[i], "SKIP") {
|
||||||
|
@ -559,10 +561,10 @@ func getSources(ctx context.Context, srcdir string, bv *BuildVars) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
opts.SHA256Sum = checksum
|
opts.SHA256 = checksum
|
||||||
}
|
}
|
||||||
|
|
||||||
err := download.Get(ctx, opts)
|
err := dl.Download(ctx, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ func linkDir(src, dest string) error {
|
||||||
|
|
||||||
newPath := filepath.Join(dest, rel)
|
newPath := filepath.Join(dest, rel)
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
return os.Mkdir(newPath, info.Mode())
|
return os.MkdirAll(newPath, info.Mode())
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.Link(path, newPath)
|
return os.Link(path, newPath)
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.PostprocDisabled {
|
if opts.PostprocDisabled {
|
||||||
return TypeFile, name, nil
|
return TypeFile, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = fl.Seek(0, io.SeekStart)
|
_, err = fl.Seek(0, io.SeekStart)
|
||||||
|
@ -101,7 +101,7 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
|
||||||
|
|
||||||
format, r, err := archiver.Identify(name, fl)
|
format, r, err := archiver.Identify(name, fl)
|
||||||
if err == archiver.ErrNoMatch {
|
if err == archiver.ErrNoMatch {
|
||||||
return TypeFile, name, nil
|
return TypeFile, "", nil
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Remove(path)
|
err = os.Remove(path)
|
||||||
return TypeDir, strings.TrimSuffix(name, format.Name()), err
|
return TypeDir, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractFile(r io.Reader, format archiver.Format, name string, opts Options) (err error) {
|
func extractFile(r io.Reader, format archiver.Format, name string, opts Options) (err error) {
|
||||||
|
|
|
@ -46,8 +46,8 @@ func (NopRWC) Read([]byte) (int, error) {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
func (NopRWC) Write([]byte) (int, error) {
|
func (NopRWC) Write(b []byte) (int, error) {
|
||||||
return 0, nil
|
return len(b), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (NopRWC) Close() error {
|
func (NopRWC) Close() error {
|
||||||
|
|
Loading…
Reference in New Issue