diff options
author | Mark Ferrell <major@homeonderanged.org> | 2012-04-23 14:12:08 -0500 |
---|---|---|
committer | Mark Ferrell <major@homeonderanged.org> | 2012-04-23 14:12:08 -0500 |
commit | 4cd905f10396cfea62900ac0d7800c9e3c65eacf (patch) | |
tree | 241bcac6c9d6c016b9e7433fbfc64a14f328a50e | |
parent | 6465e40415965f35404b09eac407a497de51512f (diff) |
Added mkenv to reduce duplicated lines of code
-rwxr-xr-x | scripts/build | 16 | ||||
-rwxr-xr-x | scripts/builder/build-archive | 1 | ||||
-rwxr-xr-x | scripts/builder/build-compile | 13 | ||||
-rwxr-xr-x | scripts/builder/build-prep | 11 | ||||
-rwxr-xr-x | scripts/builder/build-query | 10 |
5 files changed, 25 insertions, 26 deletions
diff --git a/scripts/build b/scripts/build index 8df25f9..1e53436 100755 --- a/scripts/build +++ b/scripts/build @@ -66,6 +66,22 @@ Commands EOF } +## mkenv +# prepare the environment structure for the current package +mkenv() +{ + [ -d "${S}" ] || mkdir -p "${S}" + [ -d "${L}" ] || mkdir -p "${L}" + [ -d "${E}" ] || mkdir -p "${E}" + [ -d "${T}" ] || mkdir -p "${T}" + [ -d "${D}" ] || mkdir -p "${D}" + + if [ "$#" -gt "0" ]; then + cat /dev/null > "${L}/${1}.log" + set > "${E}/${1}.env" + fi +} + ## cleanup # deal with temporary junk when we exit cleanup() diff --git a/scripts/builder/build-archive b/scripts/builder/build-archive index 8ddde97..24db888 100755 --- a/scripts/builder/build-archive +++ b/scripts/builder/build-archive @@ -2,6 +2,7 @@ echo "archiving: ${1}" eval $(build query --environ "${1}") +mkenv "archive" ARCHIVE_TMP1= ARCHIVE_TMP2= diff --git a/scripts/builder/build-compile b/scripts/builder/build-compile index 6165e93..9eb02e8 100755 --- a/scripts/builder/build-compile +++ b/scripts/builder/build-compile @@ -40,21 +40,12 @@ if [ -d "${D}" ]; then mv "${D}" "${D}.old" rm -rf "${D}.old" & fi -[ -d "${S}" ] || mkdir -p "${S}" -[ -d "${L}" ] || mkdir -p "${L}" -[ -d "${E}" ] || mkdir -p "${E}" -[ -d "${T}" ] || mkdir -p "${T}" -[ -d "${D}" ] || mkdir -p "${D}" - -## Prep the logging -cat /dev/null > "${L}/compile.log" -set > "${E}/compile.env" +mkenv "compile" ## Build the source and install it into the DESTDIR # Ironically this is the heart of what the build-engine does, and yet it has # been reduced to the simplest component of the entire system. -cd "${S}" -pkg_compile >> "${L}/compile.log" 2>&1 +cd "${S}" && pkg_compile >> "${L}/compile.log" 2>&1 ## Save Space! # At this point everything important should be installed into ${D}, and any diff --git a/scripts/builder/build-prep b/scripts/builder/build-prep index cf38fa1..7b1d698 100755 --- a/scripts/builder/build-prep +++ b/scripts/builder/build-prep @@ -9,16 +9,7 @@ if [ -d "${S}" ]; then mv "${S}" "${S}.old" rm -rf "${S}.old" & fi - -[ -d "${S}" ] || mkdir -p "${S}" -[ -d "${L}" ] || mkdir -p "${L}" -[ -d "${E}" ] || mkdir -p "${E}" -[ -d "${T}" ] || mkdir -p "${T}" -[ -d "${D}" ] || mkdir -p "${D}" - -## Prep the logging -cat /dev/null > "${L}/prep.log" -set > "${E}/prep.env" +mkenv "prep" if [ -d "${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/source" ]; then if [ "$(command -v rsync)" ]; then diff --git a/scripts/builder/build-query b/scripts/builder/build-query index 67e9da4..1d6e184 100755 --- a/scripts/builder/build-query +++ b/scripts/builder/build-query @@ -152,11 +152,11 @@ shift # These variables are used by the Buildrules and fundmentally make up the # majority of their environ data F="${BUILDER_PKGDIR}/${CATEGORY}/${NAME}/files" -W="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/build" -L="${W}/log" -E="${W}/env" -T="${W}/tmp" -D="${W}/install" +W="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/work" +L="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/log" +E="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/env" +T="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/tmp" +D="${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/install" export F W L E T D |