summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-19 23:08:25 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-19 23:08:25 (EST)
commit3ad9b0f39e50e4853ab6529e49f24fd0536cdcdb (patch)
tree5339b9cbd48fb1c481bc62bcc8009ad00d5b8dab /src
parent689aa03490b1cc21b907a15f32ecfc753135658c (diff)
Add sanity checks and comments to opkbuild.
Diffstat (limited to 'src')
-rw-r--r--src/opkbuild17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/opkbuild b/src/opkbuild
index e4d8d60..ce9fe34 100644
--- a/src/opkbuild
+++ b/src/opkbuild
@@ -24,8 +24,17 @@ print_usage()
printf 'Usage: %s\n' "$1"
}
-# TODO: Sanity checks.
+# Sanity checks.
+if [ ! -f format -o ! -f build -o ! -f control ]; then
+ printf 'Error: Current working directory is not a source package.\n' >&2
+ exit 1
+fi
+if [ "$(cat format)" != '1.0' ]; then
+ printf 'Error: Source package is of an incompatible version.\n' >&2
+ exit 1
+fi
+# Build *-src package.
mkdir -p tmp/dest/usr/src/${pkgname}_${pkgver}
cd tmp
for file in ../*; do
@@ -41,10 +50,14 @@ done
oh-buildpkg ${pkgname}-src
rm -Rf dest
+# Build other binary packages.
for binpkgdir in ../*.pkg/; do
# TODO: Check architecture.
if true; then
+ # Make installation directory.
+ # TODO: Maybe this should be an FHS-compliant filesystem hierarchy.
mkdir dest
+ # Copy or extract software sources to src.
if [ -d ../src ]; then
cp -Rp ../src src
elif [ -f ../${pkgname}_${pkgver}.tar.gz ]; then
@@ -53,7 +66,9 @@ for binpkgdir in ../*.pkg/; do
# TODO: Other compression formats, putting things in src/, ...
binpkg=${binpkgdir#'../'}
binpkg=${binpkg%'.pkg/}
+ # Build the package.
../build ${binpkg}
+ # Clean up everything except the build stamps.
for file in *; do
case ${file} in
*.buildstamp)