Source code notes: Downloading Packages in ppm

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

Source code notes: Downloading Packages in ppm

#1 Post by s243a »

Recently, in the Arch32Pup thread, we thought that there was a naming issue related to the epoch in the package name. (see thread). This may not be the case as the issue is likely related to how the tar utility handles colons in the file name (see post).

That said, I would like to note some key points in the source code that define how the puppy package manager, (i.e. ppm) downloads packages.

The download function is /usr/sbin/download_file. The two main places it is called are in downloadpkgs.sh and in petget. In the modified code (shown below), I specify a filename option that can be used with the download_file function:

around line# 247 of /usr/local/petget/downloadpkgs.sh

Code: Select all

   DLPKG="`basename $ONEFILE`"
   download_file -O "${DL_PATH}/$DLPKG" ${DOWNLOADFROM}/${ONEFILE}
** added -O "${DL_PATH}/$DLPKG"

around line#79 of /usr/local/petget/petget

Code: Select all

 #101116 use download_file utility...
 download_file -O "$FULLPKGNAME" "$PASSEDPARAM"
** added -O "$FULLPKGNAME"

For this to work I added the option processing shown below:

around line #45 of /usr/sbin/download_file

Code: Select all

wget_opts=()
while [ $# -gt 0 ]; do
  case "$1" in
  -O|--output-document) 
    wget_opts+=( "$1" "$2" ); 
    shift 2
    ;;
  --) 
    shift 1
    break; ;;    
  *)
    break; ;;
  esac
done    
    
URLSPEC="$@"
FILENAME="`basename "$@"`"
URLDIR="`dirname "$@"`" #121019
around line#264 of the same file:

Code: Select all

wget ${wget_opts[@]} -4 ${CONTPARAM} -t 5 -w 5 "${URLSPEC}" > /tmp/download_file_spider.log2 2>&1

My hunch is that these changes are not necessary. One wierd things is that the script is using "$@" to assign variables, rather than $1. Perhaps this is an unusual way to handle spaces in file paths.

Anyway, As I noted above, I think that the changes mentioned in this post probably aren't necessary but if one is having issues with the ppm finding downloaded files then it gives one a clue where to look.
Find me on [url=https://www.minds.com/ns_tidder]minds[/url] and on [url=https://www.pearltrees.com/s243a/puppy-linux/id12399810]pearltrees[/url].

Post Reply