in theory: do not generate code anymore

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-04-28 14:59:57 +02:00
parent 93ef73a645
commit fc01ceb914
2 changed files with 19 additions and 21 deletions

View file

@ -34,32 +34,35 @@ __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")"
__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")"
__cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")"
gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")"
__cdist_type_gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")"
# export variables for gencode
export __object_id="$__cdist_object_id"
export __object="$__cdist_object_dir"
export __global="$__cdist_out_dir"
# FIXME Needed?
cd "$__cdist_local_base_dir"
if [ -x "$gencode" ]; then
# cat << eof
# #
# # The following code is imported from output of $gencode
# #
#
# eof
if [ -x "$__cdist_type_gencode" ]; then
__cdist_exec_fail_on_error "$gencode" > "$__cdist_tmp_file"
else
if [ -f "$gencode" ]; then
__cdist_exit_err "$gencode exists, but is not executable"
if [ -f "$__cdist_type_gencode" ]; then
__cdist_exit_err "$__cdist_type_gencode exists, but is not executable"
fi
# No gencode? also fine! Ensure we exit 0
exit 0
# Ensure it's empty, if there is no gencode
: > "$__cdist_tmp_file"
fi
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
# Only create code, if gencode created output
if [ "$(wc -l < "$__cdist_tmp_file")" -gt 0 ]; then
cat - "$__cdist_tmp_file" << eof > "$__cdist_code_output"
#
# The following code was generated by $__cdist_type_gencode
#
eof
chmod u+x "${__cdist_code_output}"
fi

View file

@ -29,15 +29,10 @@ set -eu
__cdist_target_host="$1"; shift
__cdist_object_self="$1"; shift
__cdist_code_local="$(__cdist_object_code "$__cdist_object_self")-${__cdist_name_gencode_local}"
__cdist_code_remote="$(__cdist_object_code "$__cdist_object_self")-${__cdist_name_gencode_remote}"
__cdist_echo info "Generating local code "
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \
"${__cdist_name_gencode_local}" "${__cdist_code_local}"
"${__cdist_name_gencode_local}"
__cdist_echo info "Generating remote code "
cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \
"${__cdist_name_gencode_remote}" "${__cdist_code_remote}"
chmod u+x "${__cdist_code_local}" "${__cdist_code_remote}"
"${__cdist_name_gencode_remote}"