Check ~archive parameter for file downloader
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-01-29 18:07:37 -08:00
parent 2c8eb6be48
commit 4b5fd855cc
2 changed files with 7 additions and 2 deletions

View File

@ -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.
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:
```text
@ -177,7 +177,7 @@ https://example.com/archive.tar.gz
Not extracted:
```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:

View File

@ -46,6 +46,9 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
name := query.Get("~name")
query.Del("~name")
archive := query.Get("~archive")
query.Del("~archive")
u.RawQuery = query.Encode()
res, err := http.Get(u.String())
@ -57,6 +60,8 @@ func (FileDownloader) Download(opts Options) (Type, string, error) {
name = getFilename(res)
}
opts.PostprocDisabled = archive == "false"
path := filepath.Join(opts.Destination, name)
fl, err := os.Create(path)
if err != nil {