summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-06-07 00:43:30 -0700
committerMichael Forney <mforney@mforney.org>2016-06-07 00:43:30 -0700
commitcd95be727e4a727da3a3097bf68191c8a4a8e8b6 (patch)
tree640da16fd3e3fe0bd013e7bbd6283b7ccd0456da
parenta26f7ea299737660277c9775c41f57b74e8c21c4 (diff)
Add global fetch.rc script
l---------core/bzip2/fetch.rc1
l---------core/mdocml/fetch.rc1
l---------core/openbsd/fetch.rc1
l---------core/perp/fetch.rc1
l---------extra/pcre/fetch.rc1
l---------extra/transmission/fetch.rc1
-rwxr-xr-xfetch.rc101
-rwxr-xr-xscripts/fetch-curl.rc36
8 files changed, 101 insertions, 42 deletions
diff --git a/core/bzip2/fetch.rc b/core/bzip2/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/core/bzip2/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/core/mdocml/fetch.rc b/core/mdocml/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/core/mdocml/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/core/openbsd/fetch.rc b/core/openbsd/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/core/openbsd/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/core/perp/fetch.rc b/core/perp/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/core/perp/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/extra/pcre/fetch.rc b/extra/pcre/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/extra/pcre/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/extra/transmission/fetch.rc b/extra/transmission/fetch.rc
deleted file mode 120000
index 10ca3148..00000000
--- a/extra/transmission/fetch.rc
+++ /dev/null
@@ -1 +0,0 @@
-../../scripts/fetch-curl.rc \ No newline at end of file
diff --git a/fetch.rc b/fetch.rc
new file mode 100755
index 00000000..5c2137f1
--- /dev/null
+++ b/fetch.rc
@@ -0,0 +1,101 @@
+#!/bin/rc
+
+flag e +
+
+aflag=0
+if(~ $1 -a) aflag=1
+if not if(~ $#* 0) {
+ echo 'usage: '$0' package...'
+ echo ' '$0' -a'
+} >[1=2]
+
+packages=$*
+
+cd `{git rev-parse --show-toplevel}
+
+fn fetch-git {
+ git submodule update --init --checkout src
+ if([ -d patch ]) {
+ patches=patch/*
+ git -C src am ../$patches
+ }
+ status=()
+}
+
+fn fetch-curl {
+ if([ -d 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=()
+}
+
+fn fetch {
+ if (~ $aflag 1 || ~ $1 $packages) @ {
+ cd $1
+ switch($2) {
+ case git
+ fetch-git
+ case curl
+ fetch-curl
+ case *
+ echo 'unknown fetch type: '$2
+ }
+ }
+ status=()
+}
+
+fetch core/awk git
+fetch core/bzip2 curl
+fetch core/curl git
+fetch core/file git
+fetch core/git git
+fetch core/iproute2 git
+fetch core/kbd git
+fetch core/libressl git
+fetch core/loksh git
+fetch core/mdocml curl
+fetch core/msmtp git
+fetch core/ninja git
+fetch core/openbsd curl
+fetch core/openssh git
+fetch core/perp curl
+fetch core/pigz git
+fetch core/plan9port git
+fetch core/sbase git
+fetch core/sinit git
+fetch core/tz git
+fetch core/ubase git
+fetch core/zlib git
+fetch desktop/plan9fontsn git
+fetch devel/cparser git
+fetch devel/libfirm git
+fetch devel/make git
+fetch extra/libevent git
+fetch extra/libfuse git
+fetch extra/pcre curl
+fetch extra/sshfs git
+fetch extra/the_silver_searcher git
+fetch extra/transmission curl
diff --git a/scripts/fetch-curl.rc b/scripts/fetch-curl.rc
deleted file mode 100755
index 7199ee5c..00000000
--- a/scripts/fetch-curl.rc
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/rc
-
-flag e +
-
-ifs='
-'
-
-cd `{dirname $0}
-
-if([ -d 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=()