Check ~archive parameter for file downloader
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
2c8eb6be48
commit
4b5fd855cc
|
@ -168,7 +168,7 @@ The `replaces` array contains the packages that are replaced by this package. Ge
|
||||||
|
|
||||||
The `sources` array contains URLs which are downloaded into `$srcdir` before the build starts.
|
The `sources` array contains URLs which are downloaded into `$srcdir` before the build starts.
|
||||||
|
|
||||||
If the URL provided is an archive or compressed file, it will be extracted. To disable this, add the `~postproc=false` (`postproc` stands for postprocessing) query parameter. Example:
|
If the URL provided is an archive or compressed file, it will be extracted. To disable this, add the `~archive=false` query parameter. Example:
|
||||||
|
|
||||||
Extracted:
|
Extracted:
|
||||||
```text
|
```text
|
||||||
|
@ -177,7 +177,7 @@ https://example.com/archive.tar.gz
|
||||||
|
|
||||||
Not extracted:
|
Not extracted:
|
||||||
```text
|
```text
|
||||||
https://example.com/archive.tar.gz?~postproc=false
|
https://example.com/archive.tar.gz?~archive=false
|
||||||
```
|
```
|
||||||
|
|
||||||
If the URL scheme starts with `git+`, the source will be downloaded as a git repo. The git download mode supports multiple parameters:
|
If the URL scheme starts with `git+`, the source will be downloaded as a git repo. The git download mode supports multiple parameters:
|
||||||
|
|
|
@ -46,6 +46,9 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
|
||||||
name := query.Get("~name")
|
name := query.Get("~name")
|
||||||
query.Del("~name")
|
query.Del("~name")
|
||||||
|
|
||||||
|
archive := query.Get("~archive")
|
||||||
|
query.Del("~archive")
|
||||||
|
|
||||||
u.RawQuery = query.Encode()
|
u.RawQuery = query.Encode()
|
||||||
|
|
||||||
res, err := http.Get(u.String())
|
res, err := http.Get(u.String())
|
||||||
|
@ -57,6 +60,8 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
|
||||||
name = getFilename(res)
|
name = getFilename(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts.PostprocDisabled = archive == "false"
|
||||||
|
|
||||||
path := filepath.Join(opts.Destination, name)
|
path := filepath.Join(opts.Destination, name)
|
||||||
fl, err := os.Create(path)
|
fl, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue