summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/genpkg16
-rwxr-xr-xbin/makepkgbuild12
-rwxr-xr-xbin/mkpkgdata (renamed from bin/makepkgmeta)36
-rwxr-xr-xbin/tweakmeta14
-rwxr-xr-xsetup4
5 files changed, 46 insertions, 36 deletions
diff --git a/bin/genpkg b/bin/genpkg
index 6693e6f..669f6c2 100755
--- a/bin/genpkg
+++ b/bin/genpkg
@@ -6,7 +6,7 @@ metad=~/.genpkg/metas
templd=~/.genpkg/templ
tweakd=~/pkg/tweaks
pkgd=~/pkg/dest
-vard=~/var
+vard=~/.genpkg/var
if [ $# -lt 1 ]
then
@@ -39,9 +39,10 @@ do
[ -d "$pkgd/$pkg" ] || mkdir "$pkgd/$pkg"
cd "$pkgd/$pkg"
- if METABIN="$metad" PKGVAR="$vard" makepkgmeta "$pkg" > PKGMETA
+ echo "$pkgd/$pkg"
+ if METABIN="$metad" PKGVAR="$vard" mkpkgdata "$pkg" > PKGDATA
then
- echo "Generated $pkgd/$pkg/PKGMETA"
+ echo "Generated PKGDATA."
else
exit $?
fi
@@ -49,13 +50,14 @@ do
twk="$tweakd/$pkg"
if [ -f "$twk" -a -r "$twk" ]
then
- if ! tweakmeta > PKGMETA.new < "$twk"
+ if ! tweakmeta < "$twk" > PKGDATA.new
then
- rm PKGMETA.new
+ echo "$prog: tweakmeta returned error: $?" 1>&2
+ rm PKGDATA.new
exit 1
fi
- mv PKGMETA.new PKGMETA
- echo "Tweaked PKGMETA with $tweakd/$pkg."
+ mv PKGDATA.new PKGDATA
+ echo "Tweaked PKGDATA with $twk."
fi
if TDIR="$templd" makepkgbuild
diff --git a/bin/makepkgbuild b/bin/makepkgbuild
index 7f9d4bd..67077fc 100755
--- a/bin/makepkgbuild
+++ b/bin/makepkgbuild
@@ -28,7 +28,7 @@ a" ;;
esac
txt=$(awk -v r="$regexp" 'BEGIN { FS = "\n"; RS = "" }
- $1 ~ r { for (i = 2; i <= NF; i++) print $i }' PKGMETA |\
+ $1 ~ r { for (i = 2; i <= NF; i++) print $i }' PKGDATA |\
sed 's/^/ /')
[ "$txt" ] || return 0
@@ -41,13 +41,13 @@ END
return $?
}
-[ -r PKGMETA ] || die 1 "PKGMETA could not be read."
+[ -r PKGDATA ] || die 1 "PKGDATA could not be read."
[ "$TDIR" ] || die 1 "TDIR env. var is unset."
[ -d "$TDIR" ] || die 1 "template dir ($TDIR) not found."
-tcmd=$(awk 'BEGIN { FS="\n"; RS="" } $1 == "template" { print $2 }' PKGMETA)
-[ "$tcmd" ] || die 1 "PKGMETA is missing 'template' entry."
+tcmd=$(awk 'BEGIN { FS="\n"; RS="" } $1 == "template" { print $2 }' PKGDATA)
+[ "$tcmd" ] || die 1 "PKGDATA is missing 'template' entry."
set -- $tcmd
cmd="$TDIR/$1"
@@ -55,8 +55,8 @@ cmd="$TDIR/$1"
|| die 2 "template command ($1) not in template dir ($TDIR)"
# Generate the PKGBUILD using basic pbfields script plus custom template.
-"$TDIR/pbfields" < PKGMETA > PKGBUILD || die 1 "pbfields returned error ${?}."
-"$TDIR"/$tcmd < PKGMETA >> PKGBUILD || die 1 "template pipeline ($tcmd) failed"
+"$TDIR/pbfields" < PKGDATA > PKGBUILD || die 1 "pbfields returned error ${?}."
+"$TDIR"/$tcmd < PKGDATA >> PKGBUILD || die 1 "template pipeline ($tcmd) failed"
# Prepand/append text to the package, check, or build functions.
for func in package check build
diff --git a/bin/makepkgmeta b/bin/mkpkgdata
index 82a7b1f..ced31db 100755
--- a/bin/makepkgmeta
+++ b/bin/mkpkgdata
@@ -1,6 +1,6 @@
#!/bin/sh
-prog=makepkgmeta
+prog=mkpkgdata
lazysource()
{
@@ -9,7 +9,7 @@ BEGIN { FS = "\n"; RS = ""; OFS = ORS = "\n\n" }
$1 == "pkgver" { ver = $2 }
$1 == "source" {
len = NF - 1
- for (i = 2; i <= NF; i++) sources[i - 1] = $i
+ for(i = 2; i <= NF; i++) sources[i - 1] = $i
next
}
1 # print everything but sources
@@ -17,7 +17,7 @@ $1 == "source" {
END {
# remember that metas emit no output when they cant match
# a package.
- if (NR == 0 || !ver) exit 2
+ if(NR == 0 || !ver) exit 2
ORS="\n"
@@ -25,7 +25,7 @@ END {
gsub(/[.]/, "\\\\&", ver)
print "source"
- for(i = 1; i <= len; i++) {
+ for(i = 1; i <= len; i++){
gsub(ver, "${pkgver}", sources[i])
print sources[i]
}
@@ -47,32 +47,40 @@ basicmeta()
}
case $# in
-0) echo "Usage: $prog [pkgname]" 1>&2
+0) echo "usage: $prog [package name]" 1>&2
exit 1
esac
case "$METABIN" in
'') echo "$prog: set METABIN before calling $prog" 1>&2
- exit 2
+ exit 1
esac
+tmp="/tmp/$prog.$$"
for flav in "$METABIN"/*
do
[ -f "$flav" -a -x "$flav" ] || continue
- PATH="$PATH:$flav.d" "$flav" $1 >PKGMETA.tmp
+ PATH="$PATH:$flav.d" "$flav" "$1" > "$tmp"
+ trap 'rm "$tmp"' 1 2 15
metaret=$?
+ if [ "$metaret" -eq 0 ]
+ then
+ basicmeta "$1"
+ lazysource < "$tmp"
+ rm "$tmp"
+ exit 0
+ fi
+
+ rm "$tmp"
+ trap '' 1 2 5
case $metaret in
- 0) basicmeta $1
- lazysource <PKGMETA.tmp
- rm PKGMETA.tmp
- exit 0 ;;
- 1) echo "makepkgmeta: $flav encountered an error" 1>&2
+ 1) echo "$prog: $flav encountered an error" 1>&2
exit 1 ;;
2) ;; # loop
- *) echo "makepkgmeta: $flav returned error code $metaret" 1>&2
+ *) echo "$prog: $flav returned error code $metaret" 1>&2
exit 1 ;;
esac
done
-echo "makepkgmeta: no matching meta generator found for '$1'" 1>&2
+echo "$prog: no matching meta generator found for '$1'" 1>&2
exit 1
diff --git a/bin/tweakmeta b/bin/tweakmeta
index d38f316..75198a2 100755
--- a/bin/tweakmeta
+++ b/bin/tweakmeta
@@ -2,24 +2,24 @@
##
# tweakmeta
#
-# First read a PKGMETA file in the current directory, loading its values.
+# First read a PKGDATA file in the current directory, loading its values.
# Next read a PKGTWEAK file from standard input.
-# The PKGTWEAK file tells us how to modify the PKGMETA data.
-# The modified PKGMETA is printed to standard output.
+# The PKGTWEAK file tells us how to modify the PKGDATA data.
+# The modified PKGDATA is printed to standard output.
#
# Justin Davis <jrcd83@gmail.com>
BEGIN {
PROG = "tweakmeta"
- if (system("test -r PKGMETA") != 0) {
- print PROG ": PKGMETA file could not be read." | "cat 1>&2"
+ if (system("test -r PKGDATA") != 0) {
+ print PROG ": PKGDATA file could not be read." | "cat 1>&2"
exit(errcode = 2)
}
FS = "\n"; RS = ""
- while (getline<"PKGMETA" > 0)
+ while (getline<"PKGDATA" > 0)
for (i = 2; i <= NF; i++) pushval($1, $i)
- close("PKGMETA")
+ close("PKGDATA")
FS = " "; RS = "\n"
}
diff --git a/setup b/setup
index f1c6328..dffd4ae 100755
--- a/setup
+++ b/setup
@@ -2,8 +2,8 @@
set -e
umask 022
-prog=install
-binfiles=(makepkgbuild makepkgmeta genpkg tweakmeta)
+prog=setup
+binfiles=(makepkgbuild mkpkgdata genpkg tweakmeta)
metas=(perl perl.d/ perl.d/fetchcpan perl.d/perl-dist perl.d/scrapecore)
templs=(pbfields perl-pkg)