]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Massively speed up of dep resolvation.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Nov 2009 16:24:48 +0000 (17:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Nov 2009 16:24:48 +0000 (17:24 +0100)
tools/common-package-functions
tools/common-ui-functions
tools/naoki-include

index 078d187bbac2f98efc1cc07f4683d2d6afd8cdb9..5bc707bfc9d9c03945d5fe31c03d5fc41c82cb49 100644 (file)
@@ -3,14 +3,8 @@
 function listmatch() {
        local arg=${1}
        shift
-       
-       local value
-       for value in $@; do
-               if [ "${arg}" == "${value}" ]; then
-                       return 0
-               fi
-       done
-       return 1
+
+       grep -q "<${arg}>" <<<$@
 }
 
 function listremove() {
@@ -44,31 +38,23 @@ function is_package() {
 }
 
 function find_package() {
-       local package
+       local package=${1}
        local i
-       local found
 
-       for package in $@; do
-               #log DEBUG "Searching for package \"${package}\"."
-       
-               if [ -e "${DIR_PKGS}/${package}" ]; then
-                       echo "${package}"
-                       continue
-               fi
-       
-               found=0
-               for i in $(package_list); do
-                       if [ "${i##*/}" = "${package}" ]; then
-                               echo "${i}"
-                               found=1
-                               break
-                       fi
-               done
-               [ "${found}" = "1" ] && continue
+       #log DEBUG "Searching for package \"${package}\"."
 
-               return 1
+       if [ -e "${DIR_PKGS}/${package}" ]; then
+               echo "${package}"
+               return 0
+       fi
+
+       for i in $(package_list); do
+               if [ "${i##*/}" = "${package}" ]; then
+                       echo "${i}"
+                       return 0
+               fi
        done
-       return 0
+       return 1
 }
 
 function find_packages() {
@@ -101,7 +87,7 @@ function package_repos() {
 
 ## Needs to be cached...
 #  Causes massive speed impact
-function package_list() {
+function __package_list() {
        local package
        local repo
        
@@ -121,6 +107,15 @@ function package_list() {
        done
 }
 
+function package_list() {
+       if [ -z "${__PACKAGE_LIST}" ]; then
+               log CACHE "Building packages_list."
+               export __PACKAGE_LIST=$(__package_list)
+       fi
+
+       echo "${__PACKAGE_LIST}"
+}
+
 function package_profile() {
        if [ "${1}" = "--wiki" ]; then
                echo "TODO: WIKI OUTPUT"
index 943b197945ca8a5a95708695039eb666e9cad610..36bda0ca97963fdd8222adee1509e671fdb75c37 100644 (file)
@@ -71,7 +71,7 @@ function log() {
        local facility=${1}
        shift
        
-       if [ "${facility}" == "DEBUG" ] && [ "${DEBUG}" != "1" ]; then
+       if [ "${facility}" == "DEBUG" -a "${DEBUG}" != "1" ]; then
                return 0
        fi
 
index dd9549064c62f9ee523cfde2f7e26ae2310a5a7c..7321a3485196fe948f47838a6238ec74785253d6 100644 (file)
@@ -13,3 +13,6 @@ export NAOKI_INCLUDE=1
 . ${BASEDIR}/tools/naoki-functions
 
 log DEBUG "Started up naoki instance with pid $$"
+
+# Build cache
+export __PACKAGE_LIST=$(package_list)