Upgrade to hv-utilities-0.2.0
[hvlinux.git] / functions / fpkg
index 7138cad..133b123 100644 (file)
@@ -90,6 +90,7 @@ wget_wrapper()
     local URL=${1}
     local SOURCE=${2}
     local DESTDIR=${LFS_PKG_DIR}
+    local wget_status
 
     if [ ${#} -eq 3 ]; then
         DESTDIR=${3}
@@ -154,17 +155,24 @@ wget_wrapper()
 # Arg. #2: Destination filename.
 static_fetch_patches_list()
 {
+    local wget_status
+
     PATCHES_URL=${1}
     PATCHES_LIST_FILENAME=${2}
 
     # Appending a slash (/) will download the directory content as a file named
     # index.html
-    ${WGETCMD} "${PATCHES_URL}/" &&
+    ${WGETCMD} "${PATCHES_URL}/"
+    wget_status=$?
 
     # Append log to global log file
-    cat ${WGET_LOG_FILE} >> ${LFS_LOG_FILE} &&
+    cat ${WGET_LOG_FILE} >> ${LFS_LOG_FILE}
 
-    mv ${LFS_PKG_DIR}/index.html ${PATCHES_LIST_FILENAME}
+    if [ ${wget_status} -eq 0 ]; then
+        mv ${LFS_PKG_DIR}/index.html ${PATCHES_LIST_FILENAME}
+    else
+        return 1
+    fi
 }
 
 # Arg. #1: If "test" is specified, set TEST_INTEGRITY to 1
@@ -208,23 +216,23 @@ update_packages_init()
        return 1
     fi
 
-    if [ -n "${USE_LFS_PATCHES}" ]; then
-        # Getting list of all patches from LFS server.
-        rcmd "Fetching LFS  patches list" static_fetch_patches_list \
-            ${LFS_PATCHES_URL} ${LFS_PATCHES_LIST}
-    fi
+    # Temporary deactivate error checking.
+    set +e
 
-    if [ -n "${USE_BLFS_PATCHES}" ]; then
-        # Getting list of all patches from BLFS server.
-        rcmd "Fetching BLFS patches list" static_fetch_patches_list \
-            ${BLFS_PATCHES_URL} ${BLFS_PATCHES_LIST}
-    fi
+    # Getting list of all patches from LFS server.
+    rcmd "Fetching LFS  patches list" static_fetch_patches_list \
+        ${LFS_PATCHES_URL} ${LFS_PATCHES_LIST}
 
-    if [ -n "${USE_CLFS_PATCHES}" ]; then
-        # Getting list of all patches from CLFS server.
-        rcmd "Fetching CLFS patches list" static_fetch_patches_list \
-            ${CLFS_PATCHES_URL} ${CLFS_PATCHES_LIST}
-    fi
+    # Getting list of all patches from BLFS server.
+    rcmd "Fetching BLFS patches list" static_fetch_patches_list \
+        ${BLFS_PATCHES_URL} ${BLFS_PATCHES_LIST}
+
+    # Getting list of all patches from CLFS server.
+    rcmd "Fetching CLFS patches list" static_fetch_patches_list \
+        ${CLFS_PATCHES_URL} ${CLFS_PATCHES_LIST}
+
+    # Reactivate error checking.
+    set -e
 }
 
 # Get patch for package if it is not in the repository
@@ -237,6 +245,11 @@ static_checkpatch()
     local PATCHES_LIST=${2}
     local PATCHES_URL=${3}
 
+    # Make sure patch list file exists
+    if [ ! -f ${PATCHES_LIST} ]; then
+        return
+    fi
+
     # Remplace les "+" par "%2B"
     local PACK_URL=$(echo $PACK | sed s!\+!%2B!g)
 
@@ -276,20 +289,14 @@ static_getpatch()
        return 1
     fi
 
-    if [ -n "${USE_LFS_PATCHES}" ]; then
-        # Checking if patch is available from LFS.
-        static_checkpatch ${PACK} ${LFS_PATCHES_LIST} ${LFS_PATCHES_URL}
-    fi
+    # Checking if patch is available from LFS.
+    static_checkpatch ${PACK} ${LFS_PATCHES_LIST} ${LFS_PATCHES_URL}
 
-    if [ -n "${USE_BLFS_PATCHES}" ]; then
-        # Checking if patch is available from BLFS.
-        static_checkpatch ${PACK} ${BLFS_PATCHES_LIST} ${BLFS_PATCHES_URL}
-    fi
+    # Checking if patch is available from BLFS.
+    static_checkpatch ${PACK} ${BLFS_PATCHES_LIST} ${BLFS_PATCHES_URL}
 
-    if [ -n "${USE_CLFS_PATCHES}" ]; then
-        # Checking if patch is available from CLFS.
-        static_checkpatch ${PACK} ${CLFS_PATCHES_LIST} ${CLFS_PATCHES_URL}
-    fi
+    # Checking if patch is available from CLFS.
+    static_checkpatch ${PACK} ${CLFS_PATCHES_LIST} ${CLFS_PATCHES_URL}
 }
 
 detect_file_not_found()