From 16afe4d6569a92127a4f27dfb36e0acc1889b392 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 21 Sep 2016 20:46:13 -0400 Subject: [PATCH] many updates to change BINDIR to FEISTY_MEOW_BINARIES. expands on previous changes that removed use of short_path. --- building.txt | 2 +- .../utilities/time_running_app.cpp | 2 +- production/codescan.ini | 2 +- .../whole_build_manifest.txt | 5 -- scripts/archival/snarf_feisty_meow.pl | 1 - scripts/cgi/prepare_cgi_bin_for_apache.sh | 5 +- scripts/core/functions.sh | 87 +++++++++++++++++++ scripts/core/generate_aliases.pl | 6 +- scripts/core/inventory.sh | 4 +- scripts/core/variables.sh | 6 +- scripts/generator/vis_stu_vars.sh | 3 - scripts/processes/process_manager.sh | 2 +- scripts/text/nechung_signature.sh | 2 +- scripts/text/new_sig.pl | 2 +- 14 files changed, 105 insertions(+), 24 deletions(-) diff --git a/building.txt b/building.txt index 5e9f0a48..b1a1c295 100644 --- a/building.txt +++ b/building.txt @@ -21,7 +21,7 @@ Quick Start for the Feisty Meow Codebase: bash ~/feisty_meow/scripts/generator/produce_feisty_meow.sh - All the applications can be found in $BINDIR + All the applications can be found in $FEISTY_MEOW_BINARIES after the build is complete. Cleaning the Codebase: diff --git a/nucleus/applications/utilities/time_running_app.cpp b/nucleus/applications/utilities/time_running_app.cpp index 19bdbafa..cf8b8141 100644 --- a/nucleus/applications/utilities/time_running_app.cpp +++ b/nucleus/applications/utilities/time_running_app.cpp @@ -57,7 +57,7 @@ int time_running_app::execute() int test_runs = 10000; time_stamp start; // start of test. - astring bins = environment::get("$BINDIR"); + astring bins = environment::get("$FEISTY_MEOW_BINARIES"); astring app = bins + "/example_application"; // save real stdout. int real_stdout = dup(1); diff --git a/production/codescan.ini b/production/codescan.ini index f81ae475..288986ba 100644 --- a/production/codescan.ini +++ b/production/codescan.ini @@ -1,5 +1,5 @@ [manifest] -output=$BINDIR/manifest.txt +output=$FEISTY_MEOW_BINARIES/manifest.txt [searches] DEFINE_OUTCOME=1 diff --git a/production/setup_src/whole_build_package/whole_build_manifest.txt b/production/setup_src/whole_build_package/whole_build_manifest.txt index e6e16e30..99f3d961 100644 --- a/production/setup_src/whole_build_package/whole_build_manifest.txt +++ b/production/setup_src/whole_build_package/whole_build_manifest.txt @@ -28,7 +28,6 @@ setup_src=t binaries=t clam_bin=t packages=t -#win32_helper=t ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -171,8 +170,4 @@ source=$RUNTIME_DIR/packages target=$TARGET/runtime/packages recurse=1 -#[win32_helper] -#source=$PRODUCTION_DIR/win32_helper -#target=$TARGET/production/win32_helper -#recurse=1 diff --git a/scripts/archival/snarf_feisty_meow.pl b/scripts/archival/snarf_feisty_meow.pl index 5afe131e..1785a958 100644 --- a/scripts/archival/snarf_feisty_meow.pl +++ b/scripts/archival/snarf_feisty_meow.pl @@ -59,7 +59,6 @@ local($root) = &canonicalize("$HOME/feisty_meow"); &backup_hierarchy($snarf_file_base, $number, "$root", "production/assign_bases"); &backup_hierarchy($snarf_file_base, $number, "$root", "production/check_versions"); &backup_hierarchy($snarf_file_base, $number, "$root", "production/setup_src"); -#old &backup_hierarchy($snarf_file_base, $number, "$root", "production/win32_helper"); # now rename the file so only the unpacker can access it. &rename_archive($snarf_file); diff --git a/scripts/cgi/prepare_cgi_bin_for_apache.sh b/scripts/cgi/prepare_cgi_bin_for_apache.sh index 543404b3..7f7fa90b 100755 --- a/scripts/cgi/prepare_cgi_bin_for_apache.sh +++ b/scripts/cgi/prepare_cgi_bin_for_apache.sh @@ -3,6 +3,9 @@ # this script needs to run as root. it will copy all the important # assets for cgi into the right places. +echo "antiquated approach, we now do this with links instead." +exit 1 + cd ~/feisty_meow/scripts/cgi cp call_version_utils.sh cgi_cat.pl cgi_display.pl cgi_nechung.cgi cgi_show_file_date.sh \ count.cgi nechung.cgi \ @@ -20,7 +23,7 @@ cd ~/feisty_meow/infobase cp fortunes.dat \ /usr/lib/cgi-bin -cp $BINDIR/*nechung* /usr/lib/cgi-bin +cp $FEISTY_MEOW_BINARIES/*nechung* /usr/lib/cgi-bin chmod a+x /usr/lib/cgi-bin/* diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 72aa777e..a7babc22 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -441,6 +441,8 @@ if [ -z "$skip_all" ]; then done } + ############################ + # takes a file to modify, and then it will replace any occurrences of the # pattern provided as the second parameter with the text in the third # parameter. @@ -457,6 +459,91 @@ if [ -z "$skip_all" ]; then sed -i -e "s%$pattern%$replacement%g" "$file" } + # similar to replace_pattern_in_file, but also will add the new value + # when the old one did not already exist in the file. + function replace_if_exists_or_add() + { + local file="$1"; shift + local phrase="$1"; shift + local replacement="$1"; shift + if [ -z "$file" -o ! -f "$file" -o -z "$phrase" -o -z "$replacement" ]; then + echo "replace_if_exists_or_add: needs a filename, a phrase to replace, and the" + echo "text to replace that phrase with." + return 1 + fi + grep "$phrase" "$file" >/dev/null + # replace if the phrase is there, otherwise add it. + if [ $? -eq 0 ]; then + replace_pattern_in_file "$file" "$phrase" "$replacement" + else + # this had better be the complete line. + echo "$replacement" >>"$file" + fi + } + + ############################ + + # finds a variable (first parameter) in a particular property file + # (second parameter). the expected format for the file is: + # varX=valueX + function seek_variable() + { + local find_var="$1"; shift + local file="$1"; shift + if [ -z "$find_var" -o -z "$file" -o ! -f "$file" ]; then + echo -e "seek_variable: needs two parameters, firstly a variable name, and\nsecondly a file where the variable's value will be sought." 1>&2 + return 1 + fi + + while read line; do + if [ ${#line} -eq 0 ]; then continue; fi + # split the line into the variable name and value. + IFS='=' read -a assignment <<< "$line" + local var="${assignment[0]}" + local value="${assignment[1]}" + if [ "${value:0:1}" == '"' ]; then + # assume the entry was in quotes and remove them. + value="${value:1:$((${#value} - 2))}" + fi + if [ "$find_var" == "$var" ]; then + echo "$value" + fi + done < "$file" + } + + # finds a variable (first parameter) in a particular XML format file + # (second parameter). the expected format for the file is: + # ... name="varX" value="valueX" ... + function seek_variable_in_xml() + { + local find_var="$1"; shift + local file="$1"; shift + if [ -z "$find_var" -o -z "$file" -o ! -f "$file" ]; then + echo "seek_variable_in_xml: needs two parameters, firstly a variable name, and" + echo "secondly an XML file where the variable's value will be sought." + return 1 + fi + + while read line; do + if [ ${#line} -eq 0 ]; then continue; fi + # process the line to make it more conventional looking. + line="$(echo "$line" | sed -e 's/.*name="\([^"]*\)" value="\([^"]*\)"/\1=\2/')" + # split the line into the variable name and value. + IFS='=' read -a assignment <<< "$line" + local var="${assignment[0]}" + local value="${assignment[1]}" + if [ "${value:0:1}" == '"' ]; then + # assume the entry was in quotes and remove them. + value="${value:1:$((${#value} - 2))}" + fi + if [ "$find_var" == "$var" ]; then + echo "$value" + fi + done < "$file" + } + + ############################ + # goes to a particular directory passed as parameter 1, and then removes all # the parameters after that from that directory. function push_whack_pop() diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index eb6775e8..968cf360 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -23,7 +23,7 @@ require "filename_helper.pl"; -use Env qw(BINDIR BUILD_TOP FEISTY_MEOW_APEX FEISTY_MEOW_LOADING_DOCK FEISTY_MEOW_SCRIPTS SHELL_DEBUG ); +use Env qw(FEISTY_MEOW_BINARIES BUILD_TOP FEISTY_MEOW_APEX FEISTY_MEOW_LOADING_DOCK FEISTY_MEOW_SCRIPTS SHELL_DEBUG ); # given a possible aliasable filename, this will decide whether to create a perl # or bash alias for it. it needs the filename of the possible alias and the @@ -173,8 +173,8 @@ if (! -d $FEISTY_MEOW_LOADING_DOCK) { ############## # set the executable bit for binaries for just this current user. -if (-d $BINDIR) { - system("chmod -R u+x \"$BINDIR\"/*"); +if (-d $FEISTY_MEOW_BINARIES) { + system("chmod -R u+x \"$FEISTY_MEOW_BINARIES\"/*"); } # generate the first set of alias files that are defined in the core diff --git a/scripts/core/inventory.sh b/scripts/core/inventory.sh index 00a8213f..2f58c54c 100644 --- a/scripts/core/inventory.sh +++ b/scripts/core/inventory.sh @@ -36,10 +36,10 @@ else fi # decide whether they've got splitter available or not. -if [ -f "$BINDIR/splitter" -o -f "$BINDIR/splitter.exe" ]; then +if [ -f "$FEISTY_MEOW_BINARIES/splitter" -o -f "$FEISTY_MEOW_BINARIES/splitter.exe" ]; then # calculate the number of columsn in the terminal. cols=$(stty size | awk '{print $2}') - splitter="$BINDIR/splitter --maxcol $(($cols - 1))" + splitter="$FEISTY_MEOW_BINARIES/splitter --maxcol $(($cols - 1))" else # not available, so just emit as huge overly long string. splitter="cat" diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index f8004df5..da6d3511 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -204,11 +204,11 @@ if [ -z "$NECHUNG" ]; then # now augment the environment if we found our build variables. if [ $found_build_vars == 1 ]; then # the binary directory contains our collection of handy programs. - define_yeti_variable BINDIR=$TARGETS_DIR + define_yeti_variable FEISTY_MEOW_BINARIES=$TARGETS_DIR # add binaries created within build to the path. - define_yeti_variable PATH="$(dos_to_unix_path $BINDIR):$PATH" + define_yeti_variable PATH="$(dos_to_unix_path $FEISTY_MEOW_BINARIES):$PATH" # Shared libraries are located via this variable. - define_yeti_variable LD_LIBRARY_PATH="$(dos_to_unix_path $LD_LIBRARY_PATH):$(dos_to_unix_path $BINDIR)" + define_yeti_variable LD_LIBRARY_PATH="$(dos_to_unix_path $LD_LIBRARY_PATH):$(dos_to_unix_path $FEISTY_MEOW_BINARIES)" fi } diff --git a/scripts/generator/vis_stu_vars.sh b/scripts/generator/vis_stu_vars.sh index 12f8a4aa..546d8627 100644 --- a/scripts/generator/vis_stu_vars.sh +++ b/scripts/generator/vis_stu_vars.sh @@ -19,9 +19,6 @@ fi function setup_visual_studio_variables() { -# chmod 755 $PRODUCTION_DIR/win32_helper/*.exe -# export PATH="$(dos_to_unix_path $PRODUCTION_DIR)/win32_helper:$PATH" - # we try to use the most recent compiler location, and work backwards as # needed for the supported range (10 = vs 2010, 9 = vs 2008, 8 = vs 2005). export VSxTOOLS="$VS100COMNTOOLS" diff --git a/scripts/processes/process_manager.sh b/scripts/processes/process_manager.sh index 548f2593..31049f5e 100644 --- a/scripts/processes/process_manager.sh +++ b/scripts/processes/process_manager.sh @@ -52,7 +52,7 @@ function nechung() { start_background_action \ 'echo "your nechung oracle pronouncement of the moment..."' \ - '$BINDIR/nechung' + '$FEISTY_MEOW_BINARIES/nechung' } function sum_dir() diff --git a/scripts/text/nechung_signature.sh b/scripts/text/nechung_signature.sh index 72536595..42448571 100644 --- a/scripts/text/nechung_signature.sh +++ b/scripts/text/nechung_signature.sh @@ -2,6 +2,6 @@ echo "
" echo "
" echo "--
" -$BINDIR/nechung +$FEISTY_MEOW_BINARIES/nechung diff --git a/scripts/text/new_sig.pl b/scripts/text/new_sig.pl index 50c55fcc..d622893d 100644 --- a/scripts/text/new_sig.pl +++ b/scripts/text/new_sig.pl @@ -29,7 +29,7 @@ open(FILE, ">" . $temp_filename) || die "couldn't open $temp_filename for writin print FILE "_______ chosen by the Nechung Oracle Program [ http://gruntose.com/ ] _______\n"; print FILE "\n"; close(FILE); -local($bindir) = $ENV{'BINDIR'}; +local($bindir) = $ENV{'FEISTY_MEOW_BINARIES'}; $bindir = &sanitize_name($bindir); system("$bindir/nechung >>$temp_filename"); ###always hits this. nechung gives an error? || die "couldn't run nechung."; -- 2.34.1