From 4c815f5742ec2433f0db8dac403b9b2b7573cc68 Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Fri, 3 Oct 2008 13:11:05 +0000 Subject: [PATCH] Add support for if(var) conditional expression in pkgdef files. At pack time "var" is evaluated and if it's not defined then the line is skipped. --- buildpkg.packaging.solaris | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/buildpkg.packaging.solaris b/buildpkg.packaging.solaris index e6c2df5..5dd070a 100644 --- a/buildpkg.packaging.solaris +++ b/buildpkg.packaging.solaris @@ -651,6 +651,7 @@ parse_def() local secpos=0 local legalend=0 local hasaddedpkginfo=0 + local condexpr="" while read line do @@ -721,6 +722,14 @@ parse_def() if [ $foundfiles -eq 1 ]; then # We already found the 'files' line so this must be the filelist if [ "${line:0:4}" == "dir " ]; then add_dir $defaultperms $defaultuid $defaultgid "${line:4}" $secname # Add dir entry + elif [ "${line:0:3}" = "if(" ]; then + # Conditional expression + condexpr=${line#if(} + condexpr=${condexpr%%)*} + if [ "x${!condexpr}" != "x" ]; then + # value of condexpr was defined so we should process the line as normal + add_proto $defaultperms $defaultuid $defaultgid "${line#if(*)}" $secname + fi elif [ "${line:0:12}" = "default_docs" ]; then add_proto $defaultperms $defaultuid $defaultgid "${line:12}${metaprefix}${_docdir}/${secname}-${version}" $secname # Add std. doc location else