[jhalfs] 12/14: Fix small bugs in func_download_pkgs

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 8c2b505caf76b2b014fbe23d8a1d52e3c8a3718f
Author: Pierre Labastie <[email protected]>
AuthorDate: Fri Apr 1 10:18:15 2022 +0200

    Fix small bugs in func_download_pkgs
    
    - If MISSING_FILES.DMP is left from a preceding attempt, it may
    generate a false warning a bout missing files even if they could
    all be downloaded.
    - do not try to copy a modified file to SRC_ARCHIVE if it already
    exists: it may belong to another user...
---
 common/libs/func_download_pkgs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/common/libs/func_download_pkgs b/common/libs/func_download_pkgs
index f2b23c7..537f6c0 100644
--- a/common/libs/func_download_pkgs
+++ b/common/libs/func_download_pkgs
@@ -3,6 +3,10 @@
 #----------------------------#
 get_sources() {              # Download file, write name to MISSING_FILES.DMP if an error
 #----------------------------#
+
+    # Test if the packages must be downloaded
+  [ ! "$GETPKG" = "y" ] && return
+
   local saveIFS=$IFS
   local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM
 
@@ -13,9 +17,6 @@ get_sources() {              # Download file, write name to MISSING_FILES.DMP if
   WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}"
   WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}"
 
-    # Test if the packages must be downloaded
-  [ ! "$GETPKG" = "y" ] && return
-
   gs_wrt_message(){
     echo "${RED}$1${OFF}"
     echo "$1" >> MISSING_FILES.DMP
@@ -27,6 +28,9 @@ get_sources() {              # Download file, write name to MISSING_FILES.DMP if
     # Generate URLs file
   create_urls
 
+    # Clean up leftovers from preceding attempts
+  >MISSING_FILES.DMP
+
   IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
   for line in `cat urls.lst`; do
     IFS=$saveIFS  # Restore the system defaults
@@ -110,6 +114,7 @@ get_sources() {              # Download file, write name to MISSING_FILES.DMP if
    if [ ! -z ${SRC_ARCHIVE}  ] &&
       [   -d ${SRC_ARCHIVE}  ] &&
       [   -w ${SRC_ARCHIVE}  ] &&
+      [ ! -f ${SRC_ARCHIVE}/$FILE ] &&
       [ "$fromARCHIVE" = "0" ] ; then
         echo "Storing file:<$FILE> in the package archive"
         cp -f $FILE ${SRC_ARCHIVE}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.