Skip to content

Commit

Permalink
Several minor bugfixes around package and variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Sep 8, 2011
1 parent 2250602 commit e629231
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 6 additions & 2 deletions core/api/shell/package/functions
Expand Up @@ -46,6 +46,9 @@ package()
do
_token="$1" && shift
case "${_token}" in
(cli)
_command=cli
;;
(is)
_command=is
case "$1" in
Expand Down Expand Up @@ -145,8 +148,9 @@ package()
esac
done

true ${package_name:=${extension}}

[[ -n "${package_name}" ]] || fail "Package name must be set/given"
[[ -n "${package_version}" ]] || fail "Package version must be set/given"

case "${_command}" in
(make)
Expand All @@ -162,7 +166,7 @@ package()
(is)
case "$_subcommand" in
(active|installed)
__sm.package.is.${_subcommand}
__sm.package.is.${_subcommand} "${_params[@]}"
;;
esac
;;
Expand Down
8 changes: 6 additions & 2 deletions core/api/shell/variables/functions
@@ -1,12 +1,16 @@
#!/bin/sh

variable() { variables "$@"; }

variables()
{
trace_filter variables

local _command _variables=() _type

if __sm.string.starts.with.one.of "$* " \
"is empty " \
"is nonempty " \
"are empty " \
"are nonempty " \
"must be empty " \
Expand Down Expand Up @@ -47,9 +51,9 @@ variables()

# TODO: Think through variables more...
case "${_command}" in
(are.empty|are.nonempty)
(is.empty|is.nonempty|are.empty|are.nonempty)
[[ -n "${_variables[*]}" ]] || error "No variable names given for validation"
__sm.variables.${_command} "${_variables[@]}"
__sm.variables.${_command/#is/are} "${_variables[@]}"
;;
(must.be.empty|must.be.nonempty)
[[ -n "${_variables[*]}" ]] || error "No variable names given for validation"
Expand Down
5 changes: 2 additions & 3 deletions core/internal/shell/package/functions
Expand Up @@ -423,7 +423,7 @@ __sm.package.init()

for variable in default_version base_url md5_url user
do
if variable is empty package_${variable}
if variable is empty "package_${variable}"
then
config read file defaults from ${package_name} \
key ${variable} variable ${variable} prefix package
Expand All @@ -432,7 +432,7 @@ __sm.package.init()

for variable in website_url archive_format
do
if variable is empty ${variable}
if variable is empty "${variable}"
then
config read file defaults from ${package_name} \
key ${variable} variable ${variable}
Expand Down Expand Up @@ -810,7 +810,6 @@ __sm.package.patches.apply()
done
}


__sm.package.is.active()
{
local _name="${1:-}" _version="${2:-}"
Expand Down
2 changes: 2 additions & 0 deletions core/internal/shell/package/includes
Expand Up @@ -5,3 +5,5 @@ api/os
api/defaults
api/templates
api/user
api/variables
api/config

0 comments on commit e629231

Please sign in to comment.