]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Code cleanup. No functional changes.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 31 Oct 2009 11:26:27 +0000 (12:26 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 31 Oct 2009 11:26:27 +0000 (12:26 +0100)
make.sh
tools/common-constants [new file with mode: 0644]
tools/common-include [new file with mode: 0644]
tools/common-package-functions [moved from tools/package-functions with 93% similarity]
tools/common-ui-functions [moved from tools/ui-functions with 100% similarity]
tools/naoki
tools/naoki-constants
tools/naoki-functions
tools/naoki-include

diff --git a/make.sh b/make.sh
index d3d8f691491ea49247ae5e802f0c0ad125c3f9f0..c55dd14b82af5abaed1a84006113f6d5533552d9 100755 (executable)
--- a/make.sh
+++ b/make.sh
 ###############################################################################
 #
 
-NAME="IPFire"                       # Software name
-SNAME="ipfire"                      # Short name
-VERSION="3.0-prealpha2"             # Version number
-SLOGAN="Gluttony"                   # Software slogan
-
 BASEDIR=/ipfire-3.x
 
-. ${BASEDIR}/tools/ui-functions
-
-NAOKI=${BASEDIR}/tools/naoki
+. ${BASEDIR}/tools/common-include
 
 while [ $# -gt 0 ]; do
        case "${1}" in
@@ -37,6 +30,10 @@ while [ $# -gt 0 ]; do
                        DEBUG=1
                        log DEBUG "Debugging mode enabled by command line."
                        ;;
+               --toolchain)
+                       TOOLCHAIN=1
+                       log DEBUG "Toolchain mode enabled by command line."
+                       ;;
                *)
                        action=${1}
                        shift
@@ -46,23 +43,25 @@ while [ $# -gt 0 ]; do
        shift
 done
 
+export DEBUG TOOLCHAIN
+
 function package() {
        local action=${1}
        shift
 
        case "${action}" in
                dependencies|deps)
-                       echo -e "${BOLD}Build dependencies:${NORMAL} $(package_build_dependencies $@)"
-                       echo -e "${BOLD}Dependencies:${NORMAL}       $(package_dependencies $@)"
+                       echo -e "${BOLD}Build dependencies:${NORMAL} $(package_build_dependencies $@ | tr '\n' ' ')"
+                       echo -e "${BOLD}Dependencies:${NORMAL}       $(package_runtime_dependencies $@ | tr '\n' ' ')"
                        ;;
                find)
                        find_package $@
                        ;;
                list)
-                       ${NAOKI} --toolchain list
+                       package_list
                        ;;
                profile|info)
-                       ${NAOKI} profile $@
+                       package_profile $(find_package $@)
                        ;;
                _info)
                        package_info $(find_package $@)
@@ -70,23 +69,9 @@ function package() {
        esac
 }
 
-function listmatch() {
-       local arg=${1}
-       shift
-       
-       local value
-       for value in $@; do
-               if [ "${arg}" == "${value}" ]; then
-                       return 0
-               fi
-       done
-       return 1
-}
-
-
 case "${action}" in
        package|pkg)
-               package $@
+               package $@e
                ;;
        toolchain)
                TOOLCHAIN=1
diff --git a/tools/common-constants b/tools/common-constants
new file mode 100644 (file)
index 0000000..2622e95
--- /dev/null
@@ -0,0 +1,21 @@
+
+
+BASEDIR=/ipfire-3.x
+
+DEBUG=1 ## XXX currently always on
+
+DISTRO_NAME=IPFire
+DISTRO_SNAME=ipfire
+DISTRO_EPOCH=3
+DISTRO_VERSION=${DISTRO_EPOCH}.0-prealpha2
+DISTRO_SLOGAN="Gluttony"
+
+# Machine's infotmation
+HOSTNAME=$(</proc/sys/kernel/hostname)
+MACHINE=$(uname -m)
+
+NAOKI=${BASEDIR}/tools/naoki
+
+DIR_LOGS=${BASEDIR}/logs
+DIR_PACKAGES=${BASEDIR}/packages
+DIR_PKGS=${BASEDIR}/pkgs
diff --git a/tools/common-include b/tools/common-include
new file mode 100644 (file)
index 0000000..f995572
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+if [ -z "${BASEDIR}" ]; then
+       echo "${0##*/}: ERROR: BASEDIR is not set." >&2
+       exit 1
+fi
+
+. ${BASEDIR}/tools/common-constants
+. ${BASEDIR}/tools/common-package-functions
+. ${BASEDIR}/tools/common-ui-functions
+
+# Read in .config
+if [ -e "${BASEDIR}/.config" ]; then
+       log DEBUG "Loading .config..."
+       source ${BASEDIR}/.config
+fi
similarity index 93%
rename from tools/package-functions
rename to tools/common-package-functions
index c6db5906093028e15d0a64c67abb69850d19967e..845eef4a788118985bed5b12cd402d2bdb366d01 100644 (file)
@@ -1,5 +1,4 @@
-
-PKG_DIR=${BASEDIR}/pkgs
+#!/bin/bash
 
 function listmatch() {
        local arg=${1}
@@ -17,7 +16,7 @@ function listmatch() {
 function is_package() {
        local package=$(find_package ${1})
 
-       if [ -e "${PKG_DIR}/${package}/${package##*/}.nm" ]; then
+       if [ -e "${DIR_PKGS}/${package}/${package##*/}.nm" ]; then
                return 0
        else
                log ERROR "Package ${package} is not known."
@@ -29,7 +28,7 @@ function find_package() {
        local package=${1}
        #log DEBUG "Searching for package \"${package}\"."
 
-       if [ -e "${PKG_DIR}/${package}" ]; then
+       if [ -e "${DIR_PKGS}/${package}" ]; then
                echo "${package}"
                return 0
        fi
@@ -47,7 +46,7 @@ function find_package() {
 function package_repos() {
        local repo
        
-       for repo in ${PKG_DIR}/*; do
+       for repo in ${DIR_PKGS}/*; do
                if [ ! -d "${repo}" ]; then
                        continue
                fi
@@ -70,12 +69,12 @@ function package_list() {
        local repo
        
        for repo in $(package_repos); do
-               for package in ${PKG_DIR}/${repo}/*; do
+               for package in ${DIR_PKGS}/${repo}/*; do
                        if [ ! -d "${package}" ]; then
                                continue
                        fi
 
-                       package=${package#${PKG_DIR}/}
+                       package=${package#${DIR_PKGS}/}
 
                        # Skip if package does not fullfill our criteria
                        is_package ${package} || continue
@@ -110,11 +109,17 @@ function package_profile() {
 function package_info() {
        local p=$(find_package ${1})
 
-       log DEBUG "Fetching package information from ${PKG_DIR}/${p}..."
+       log DEBUG "Fetching package information from ${DIR_PKGS}/${p}..."
+       
+       echo "gothere: ${p}" > .test
 
        is_package ${p} || return 1
 
-       CHROOT=0 naoki_make ${p} --without-chroot info | grep -v "^make:"
+       if [ "${NAOKI_INCLUDE}" = "1" ]; then
+               CHROOT=0 naoki_make ${p} --without-chroot info | grep -v "^make:"
+       else
+               ${NAOKI} info ${p}
+       fi
 }
 
 function package_get() {
similarity index 100%
rename from tools/ui-functions
rename to tools/common-ui-functions
index e7c663368af8eb21c871ceab2af1fbb8c7a71f8f..e9deaa9f859abfbc8195fb587780ce1098267ec7 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+BASEDIR=/ipfire-3.x
+
 . /ipfire-3.x/tools/naoki-include
 
 # Read in global configuration
@@ -103,7 +105,7 @@ case "${ACTION}" in
                package_profile ${PKG_NAME}
                ;;
        
-       raw)
+       raw|info)
                package_info ${PKG_NAME}
                ;;
 
index 02a4b1755a0a851f0bc6208d19e6976e5e6f4d28..480fa0f4eca85002f63b7916ed8c549646667e40 100644 (file)
@@ -1,25 +1,8 @@
 #!/bin/bash
 
-DEBUG=1 ## XXX currently always on
-
-DISTRO_NAME=IPFire
-DISTRO_SNAME=ipfire
-DISTRO_EPOCH=3
-DISTRO_VERSION=${DISTRO_EPOCH}.0-prealpha2
-DISTRO_SLOGAN="Gluttony"
-
-# Machine's infotmation
-HOSTNAME=$(</proc/sys/kernel/hostname)
-MACHINE=$(uname -m)
-
-BASEDIR=/ipfire-3.x
-
-
 BUILD_DIR="${BASEDIR}/naoki_$$"
 BUILD_ROOT="/buildroot.$$"
-LOG_DIR=${BASEDIR}/logs
 TOOLS_DIR=/tools_${MACHINE}
-PACKAGES_DIR=${BASEDIR}/packages
 
 ARCH=i686
 
@@ -37,13 +20,6 @@ case "${ARCH}" in
                ;;
 esac
 
-# Read in .config
-
-if [ -e "${BASEDIR}/.config" ]; then
-       log DEBUG "Loading .config..."
-       source ${BASEDIR}/.config
-fi
-
 log INFO "Machine information:"
 log INFO "    Hostname     : ${HOSTNAME}"
 log INFO "    Architecture : ${MACHINE}"
index cee1d8c8b57eb5aefc07ada5295311d9839199e2..7e8b674273b6dfd1fb2ce8318adc4d5cdff813a9 100644 (file)
@@ -1,7 +1,6 @@
 #!/bin/bash
 
-. ${BASEDIR}/tools/ui-functions
-. ${BASEDIR}/tools/package-functions
+LOGFILE=${BASEDIR}/naoki.log
 
 function exithandler() {
        local mount
@@ -208,7 +207,7 @@ function naoki_make() {
 
        local cmd="make --no-print-directory -C"
        if [ "${CHROOT}" = "0" ] || [ "${TOOLCHAIN}" = "1" ]; then
-               cmd="${cmd} ${PKG_DIR}/${p}"
+               cmd="${cmd} ${DIR_PKGS}/${p}"
        else
                cmd="${cmd} /usr/src/pkgs/${p}"
        fi
index 03fb7e46bb99790655b87cf07e194cdadadee659..dd9549064c62f9ee523cfde2f7e26ae2310a5a7c 100644 (file)
@@ -1,11 +1,15 @@
 #!/bin/bash
 
-BASEDIR="/ipfire-3.x/"
+if [ -z "${BASEDIR}" ]; then
+       echo "${0##*/}: ERROR: BASEDIR is not set." >&2
+       exit 1
+fi
 
-LOGFILE=${BASEDIR}/naoki.log
+export NAOKI_INCLUDE=1
 
-. ${BASEDIR}/tools/naoki-functions
-. ${BASEDIR}/tools/naoki-constants
+. ${BASEDIR}/tools/common-include
 
+. ${BASEDIR}/tools/naoki-constants
+. ${BASEDIR}/tools/naoki-functions
 
 log DEBUG "Started up naoki instance with pid $$"