diff options
| author | Michael Forney <mforney@mforney.org> | 2016-06-28 00:35:03 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-06-28 00:35:03 -0700 |
| commit | 98f6b745137d075ee49b70a7214a7e33d37e9f96 (patch) | |
| tree | c31c45efb769e2d54c69f09afe460018bf6d9006 | |
| parent | 153ac63e5c298ba6318bbe1ecac7ecdb1bd3a571 (diff) | |
fetch-curl: Support specifying a pattern of files to extract
| -rw-r--r-- | ninja.rc | 5 | ||||
| -rw-r--r-- | rules.ninja | 4 | ||||
| -rwxr-xr-x | scripts/fetch-curl.rc | 13 |
3 files changed, 17 insertions, 5 deletions
@@ -160,6 +160,11 @@ fn fetch { # Use a phony rule and stamp file to prevent ninja from making # parent directories. build '$outdir'/fetch.stamp fetch$1 '|' '$dir'/.rev + shift + if(! ~ $#* 0) { + *=''''$*'''' + with args $"* + } build $"allsrcs phony '$outdir'/fetch.stamp } status=() diff --git a/rules.ninja b/rules.ninja index c90f087a..ebb8a983 100644 --- a/rules.ninja +++ b/rules.ninja @@ -62,13 +62,13 @@ rule gitinit command = mkdir -p $builddir/$repo.git && git -C $builddir/$repo.git init --bare && touch $out rule fetchcurl - command = rc ./scripts/fetch-curl.rc $dir && touch $out + command = rc ./scripts/fetch-curl.rc $dir $args && touch $out restat = 1 generator = 1 pool = console rule fetchgit - command = rc ./scripts/fetch-git.rc $dir && touch $out + command = rc ./scripts/fetch-git.rc $dir $args && touch $out restat = 1 generator = 1 pool = console diff --git a/scripts/fetch-curl.rc b/scripts/fetch-curl.rc index 09ba2157..9f811837 100755 --- a/scripts/fetch-curl.rc +++ b/scripts/fetch-curl.rc @@ -2,12 +2,13 @@ flag e + -if(! ~ $#* 1) { - echo 'usage: fetch-curl.rc dir' >[1=2] +if(~ $#* 0) { + echo 'usage: fetch-curl.rc dir pattern...' >[1=2] exit 2 } cd $1 +shift if([ -e src ]) rm -rf src @@ -27,7 +28,13 @@ for(archive in `{awk '{print $2}' sha256}) { case * tool=() } - if(! ~ $#tool 0) $tool $archive | pax -r -s '/^\.\|[^\/]*/src/' + pats=() + while(! ~ $1 '' ';') { + pats=($pats $1) + shift + } + shift + if(! ~ $#tool 0) $tool $archive | pax -r -s '/^\.\|[^\/]*/src/' $pats } if([ -d patch ]) { |
