commit 8aa7ece468c40d18e770d358f9f215e407db3d84
parent 3c2c0d24e1116b5ea60b70bf5a093c9b88886927
Author: Daniel Bainton <dpb@driftaway.org>
Date: Sun, 9 Mar 2014 20:42:56 +0000
Move the pkgs.mk creation to it's own sh file
Diffstat:
3 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/mkfile b/mkfile
@@ -19,25 +19,11 @@ fetchpkgs = ${pkgs:%=%-fetch}
fetch-all fetch-world:VQ: ${fetchpkgs}
-# generate a pkgs.mk file with the targets for all packages in pkgs/
`{ mkdir -p src }
`{ mkdir -p .cache }
-`{ printf '# auto-generated file, do not edit\n' > pkgs.mk }
-`{ cd pkgs && for pkg in *; do \
- fdeps=`$top/stuff/get-fetch-deps $pkg` &&\
- cat $pkg/build ../stuff/fetch-pkg.mk |\
- sed -e "s,^build:,$pkg:QP./stuff/cmp-pkgs: $pkg-fetch pkgs/$pkg/build," |\
- sed -e "s,^fetch-target:,$pkg-fetch:QP./stuff/cmp-fetch: $fdeps," |\
- sed -e "s,^v=,_${pkg}_v=," |\
- sed -e "s,^pkgdir=,_${pkg}_pkgdir=$top/pkgs/$pkg," |\
- sed -e "s,\$v,\${_${pkg}_v},g" |\
- sed -e "s,\$pkgdir,\${_${pkg}_pkgdir},g" |\
- sed -e "s,\$url,\${_${pkg}_url},g" |\
- sed -e "s, url=, _${pkg}_url=,g" |\
- sed -e "s,\$git,\${_${pkg}_git},g" |\
- sed -e "s,^git=,_${pkg}_git=," |\
- sed -e "s,^url=,_${pkg}_url=," >> ../pkgs.mk; \
- echo >> ../pkgs.mk; done }
+
+# generate a pkgs.mk file with the targets for all packages in pkgs/
+`{ stuff/generate-pkgs.sh pkgs > pkgs.mk }
<pkgs.mk
diff --git a/stuff/generate-pkgs.sh b/stuff/generate-pkgs.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+f=`pwd`/`dirname $0`
+p=$1
+
+printf '# auto-generated file, do not edit\n'
+
+cd $p
+
+for pkg in *; do
+ deps=$(cat $pkg/build | sed -n '1{x;d};${H;x;s/\\\n\t/ /g;p};{H}' | grep ^build: | cut -d ':' -f 2-)
+ fdeps=`for d in $deps; do echo -n "$d-fetch "; done`
+ cat $pkg/build $f/fetch-pkg.mk |
+ sed -e "s,^build:,$pkg:QP${f}/cmp-pkgs: $pkg-fetch `pwd`/$pkg/build," \
+ -e "s,^fetch-target:,$pkg-fetch:QP${f}/cmp-fetch: $fdeps," \
+ -e "s,^v=,_${pkg}_v=," \
+ -e "s,^pkgdir=,_${pkg}_pkgdir=`pwd`/$pkg," \
+ -e "s,\$v,\${_${pkg}_v},g" \
+ -e "s,\$pkgdir,\${_${pkg}_pkgdir},g" \
+ -e "s,\$url,\${_${pkg}_url},g" \
+ -e "s, url=, _${pkg}_url=,g" \
+ -e "s,\$git,\${_${pkg}_git},g" \
+ -e "s,^git=,_${pkg}_git=," \
+ -e "s,^url=,_${pkg}_url=,"
+
+ echo
+done
diff --git a/stuff/get-fetch-deps b/stuff/get-fetch-deps
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-deps=$(cat $1/build | sed -n '1{x;d};${H;x;s/\\\n\t/ /g;p};{H}' | grep ^build: | cut -d ':' -f 2-)
-for d in $deps; do echo -n "$d-fetch "; done