diff options
| author | Michael Forney <mforney@mforney.org> | 2016-06-27 20:30:15 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-06-27 20:30:15 -0700 |
| commit | f732e53f58b8f92132dece66b05f32576f830cc4 (patch) | |
| tree | b494541dae14382ed9865cda387c09e2c4d9db50 /scripts | |
| parent | 2b32697b70a7429c490b47723a9469fc14310ae9 (diff) | |
Integrate source fetching into ninja files
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/fetch-curl.rc | 38 | ||||
| -rwxr-xr-x | scripts/fetch-git.rc | 17 |
2 files changed, 55 insertions, 0 deletions
diff --git a/scripts/fetch-curl.rc b/scripts/fetch-curl.rc new file mode 100755 index 00000000..2926a9f0 --- /dev/null +++ b/scripts/fetch-curl.rc @@ -0,0 +1,38 @@ +#!/bin/rc + +flag e + + +if(! ~ $#* 1) { + echo 'usage: fetch-curl.rc dir' >[1=2] + exit 2 +} + +cd $1 + +if([ -e src ]) rm -rf src + +if(! sha256sum -c sha256 >[2]/dev/null) { + curl -L -O -K url + sha256sum -c sha256 +} + +for(archive in `{awk '{print $2}' sha256}) { + switch($archive) { + case *.gz + tool=zcat + case *.bz2 + tool=bzcat + case *.xz + tool=xzcat + case * + tool=() + } + if(! ~ $#tool 0) $tool $archive | pax -r -s '/^\.\|[^\/]*/src/' +} + +if([ -d patch ]) { + if(prefix=`{git rev-parse --show-prefix >[2]/dev/null}) dir=$prefix^src + if not dir=src + git apply -v --directory $dir patch/* +} +status=() diff --git a/scripts/fetch-git.rc b/scripts/fetch-git.rc new file mode 100755 index 00000000..fec6a809 --- /dev/null +++ b/scripts/fetch-git.rc @@ -0,0 +1,17 @@ +#!/bin/rc + +flag e + + +if(! ~ $#* 1) { + echo 'usage: fetch-git.rc dir' >[1=2] + exit 2 +} + +cd $1 + +git submodule update --init --checkout src +if([ -d patch ]) { + patches=patch/* + git -C src am ../$patches +} +status=() |
