~ salmonella-environment-setup (master) cb56f6915a1d05d435bab451c7e5802b28b08da2


commit cb56f6915a1d05d435bab451c7e5802b28b08da2
Author:     Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Sun Dec 24 18:56:45 2017 +0100
Commit:     Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Sun Dec 24 19:19:15 2017 +0100

    salmonella: merge configuration directories into "conf"
    
    Merge all configuration directories into a single one ("conf").
    Machine/OS-specific settings can be conditioned on (software-version)
    and (machine-type) in config files.
    
    Machine/OS-specific shell settings are in conf/shell-settings.

diff --git a/README b/README
index 741d26c..dcf7283 100644
--- a/README
+++ b/README
@@ -118,23 +118,26 @@ $ $HOME/local/chicken-5/bin/chicken-install
 == Configuring salmonella jobs
 
 run-salmonella.sh will look for configuration files in the
-chicken-infrastructure repository, specifically:
-
-* $HOME/src/chicken-infrastructure/salmonella/${OS}-common
-* $HOME/src/chicken-infrastructure/salmonella/salmonella-${OS}-${ARCH}
-
-where ${OS} is the value returned by (software-version) and ${ARCH} is
-the value returned by (machine-type) by CHICKEN.
+chicken-infrastructure repository, specifically in
+$HOME/src/chicken-infrastructure/salmonella/conf
 
 run-salmonella.sh will look for configuration files with .conf suffix
-in those directories.  The conf files are Scheme files that usually
-set salmonella-run-publish parameters.  Take a look at the
-configuration files in linux-common for examples.
+in that directory.  The conf files are Scheme files that usually set
+salmonella-run-publish parameters.
 
-run-salmonella.sh will also read a `settings.sh' file from the
-directories mentioned above.  This file will be load shell settings
+run-salmonella.sh will also read `settings.sh' files from the
+configuration directory.  These files will be load shell settings
 ("source") in the current environment.  That can be useful if you want
-to set environment variables.
+to set environment variables.  run-salmonella.sh will look for
+settings files in the following directories, according to the
+following order:
+
+* $HOME/src/chicken-infrastructure/salmonella/conf/shell-settings/${OS}
+* $HOME/src/chicken-infrastructure/salmonella/conf/shell-settings/${OS}-${ARCH}
+
+Where ${OS} is the value returned by (software-version) and ${ARCH} is
+the value returned by (machine-type) by CHICKEN.
+
 
 
 == Running run-salmonella.sh
@@ -146,4 +149,4 @@ extension) as arguments.  Example:
   $HOME/src/chicken-infrastructure/salmonella/run-salmonella.sh chicken-4 chicken-5
 
 This will make run-salmonella.sh pick the chicken-4.conf and
-chicken-5.conf files for ${OS} and ${ARCH}.
+chicken-5.conf files and shell settings files for ${OS} and ${ARCH}.
diff --git a/linux-common/chicken-4-clang.conf b/conf/chicken-4-clang.conf
similarity index 100%
rename from linux-common/chicken-4-clang.conf
rename to conf/chicken-4-clang.conf
diff --git a/linux-common/chicken-4-common.scm b/conf/chicken-4-common.scm
similarity index 100%
rename from linux-common/chicken-4-common.scm
rename to conf/chicken-4-common.scm
diff --git a/conf/chicken-4-debugbuild.conf b/conf/chicken-4-debugbuild.conf
new file mode 100644
index 0000000..50ced6c
--- /dev/null
+++ b/conf/chicken-4-debugbuild.conf
@@ -0,0 +1,11 @@
+(load-relative "./common.scm")
+(load-relative "./chicken-4-common.scm")
+
+;; The salmonella-linux-x86-64 machine builds eggs without cache
+(when (and (eq? (machine-type) 'x86-64)
+           (eq? (software-type) 'linux))
+  (keep-repo? #f))
+
+(branch-publish-transformer
+  (lambda (branch)
+    (string-append branch "-debugbuild")))
diff --git a/linux-common/chicken-4.conf b/conf/chicken-4.conf
similarity index 100%
rename from linux-common/chicken-4.conf
rename to conf/chicken-4.conf
diff --git a/linux-common/chicken-5-common.scm b/conf/chicken-5-common.scm
similarity index 100%
rename from linux-common/chicken-5-common.scm
rename to conf/chicken-5-common.scm
diff --git a/linux-common/chicken-5.conf b/conf/chicken-5.conf
similarity index 100%
rename from linux-common/chicken-5.conf
rename to conf/chicken-5.conf
diff --git a/linux-common/common.scm b/conf/common.scm
similarity index 70%
rename from linux-common/common.scm
rename to conf/common.scm
index 45b9084..87adc8b 100644
--- a/linux-common/common.scm
+++ b/conf/common.scm
@@ -8,4 +8,5 @@
 (web-dir (get-environment-variable "SALMONELLA_REPORTS_DIR"))
 
 (feeds-server
- (sprintf "salmonella-linux-~a.call-cc.org" (machine-type)))
+ (sprintf "salmonella-~a-~a.call-cc.org"
+          (software-version) (machine-type)))
diff --git a/linux-common/prerelease.conf b/conf/prerelease.conf
similarity index 100%
rename from linux-common/prerelease.conf
rename to conf/prerelease.conf
diff --git a/salmonella-linux-x86-64/settings.sh b/conf/shell-settings/linux-x86-64/settings.sh
similarity index 100%
rename from salmonella-linux-x86-64/settings.sh
rename to conf/shell-settings/linux-x86-64/settings.sh
diff --git a/salmonella-linux-x86/settings.sh b/conf/shell-settings/linux-x86/settings.sh
similarity index 100%
rename from salmonella-linux-x86/settings.sh
rename to conf/shell-settings/linux-x86/settings.sh
diff --git a/linux-common/settings.sh b/conf/shell-settings/linux/settings.sh
similarity index 100%
rename from linux-common/settings.sh
rename to conf/shell-settings/linux/settings.sh
diff --git a/run-salmonella.sh b/run-salmonella.sh
index eece9ec..f9e19ea 100755
--- a/run-salmonella.sh
+++ b/run-salmonella.sh
@@ -22,23 +22,26 @@ export SALMONELLA_REPORTS_DIR=$HOME/salmonella/reports
 OS=$($CHICKEN_4_PREFIX/bin/csi -p '(software-version)')
 ARCH=$($CHICKEN_4_PREFIX/bin/csi -p '(machine-type)')
 
-# Load OS-specific settings
-[ -e "$SRC_DIR/salmonella/${OS}-common/settings.sh" ] && \
-    . "$SRC_DIR/salmonella/${OS}-common/settings.sh"
+# FIXME: make it an array
+settings_files="\
+    $SRC_DIR/salmonella/conf/shell-settings/${OS}/settings.sh
+    $SRC_DIR/salmonella/conf/shell-settings/${OS}-${ARCH}/settings.sh
+"
 
-# Load ARCH-specific settings
-[ -e "$SRC_DIR/salmonella/salmonella-${OS}-${ARCH}/settings.sh" ] && \
-    . "$SRC_DIR/salmonella/salmonella-${OS}-${ARCH}/settings.sh"
+for settings_file in $settings_file; do
+    if [ -e "$settings_file" ]; then
+        echo "Loading $settings_file"
+        . "$settings_file"
+    fi
+done
 
 
 main() {
     confs=$@
 
     # Check if all conf files exist
-    set -x
     for conf in $confs; do
-        if [ ! -e "$SRC_DIR/salmonella/salmonella-${OS}-${ARCH}/${conf}.conf" ] && \
-           [ ! -e "$SRC_DIR/salmonella/${OS}-common/${conf}.conf" ]; then
+        if [ ! -e "$SRC_DIR/salmonella/conf/${conf}.conf" ]; then
             echo "No configuration file found for '$conf'.  Aborting." >&2
             exit 1
         fi
@@ -76,13 +79,7 @@ main() {
             debugbuild=
         fi
 
-        # Prefer machine-specific configuration files
-        if [ -e "$SRC_DIR/salmonella/salmonella-${OS}-${ARCH}/${conf}.conf" ]; then
-            conf_path=$SRC_DIR/salmonella/salmonella-${OS}-${ARCH}/${conf}.conf
-        else
-            conf_path=$SRC_DIR/salmonella/${OS}-common/${conf}.conf
-        fi
-
+        conf_path=$SRC_DIR/salmonella/conf/${conf}.conf
         DEBUGBUILD=$debugbuild "$CHICKEN_4_PREFIX/bin/salmonella-run-publish" "$conf_path"
         mv salmonella-run-publish "salmonella-$conf"
     done
diff --git a/salmonella-linux-x86-64/chicken-4-debugbuild.conf b/salmonella-linux-x86-64/chicken-4-debugbuild.conf
deleted file mode 100644
index e53e564..0000000
--- a/salmonella-linux-x86-64/chicken-4-debugbuild.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-(load-relative "../linux-common/common.scm")
-(load-relative "../linux-common/chicken-4-common.scm")
-
-(keep-repo? #f)
-
-(branch-publish-transformer
-  (lambda (branch)
-    (string-append branch "-debugbuild")))
diff --git a/salmonella-linux-x86/chicken-4-debugbuild.conf b/salmonella-linux-x86/chicken-4-debugbuild.conf
deleted file mode 100644
index 006d4f8..0000000
--- a/salmonella-linux-x86/chicken-4-debugbuild.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-(load-relative "../linux-common/common.scm")
-(load-relative "../linux-common/chicken-4-common.scm")
-
-(branch-publish-transformer
-  (lambda (branch)
-    (string-append branch "-debugbuild")))
diff --git a/linux-common/scripts/hunt-a.out.sh b/scripts/linux/hunt-a.out.sh
similarity index 100%
rename from linux-common/scripts/hunt-a.out.sh
rename to scripts/linux/hunt-a.out.sh
diff --git a/linux-common/scripts/hunt-scsh-defunct.sh b/scripts/linux/hunt-scsh-defunct.sh
similarity index 100%
rename from linux-common/scripts/hunt-scsh-defunct.sh
rename to scripts/linux/hunt-scsh-defunct.sh
Trap