Skip to content

Commit

Permalink
sbopkg: Added option to download from third party source.
Browse files Browse the repository at this point in the history
Thanks to B. Watson for the patch.

Signed-off-by: Willy Sudiarto Raharjo <willysr@sbopkg.org>
  • Loading branch information
B. Watson authored and willysr committed Oct 30, 2015
1 parent 3c268bb commit b0bd626
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/etc/sbopkg/sbopkg.conf
Expand Up @@ -48,3 +48,9 @@ DIFF=${DIFF:-diff}
DIFFOPTS=${DIFFOPTS:--u}
RSYNCFLAGS="${RSYNCFLAGS:---verbose --timeout=30}"
WGETFLAGS="${WGETFLAGS:--c --progress=bar:force --timeout=30 --tries=5}"

# SRC_REPO defaults to "http://slackware.org.uk/sbosrcarch". To use
# a different repository, uncomment and edit this variable. The value
# must be the URL of the directory containing the by-name and by-md5
# sub directories, and should NOT have a trailing slash.
# SRC_REPO="http://slackware.org.uk/sbosrcarch"
27 changes: 22 additions & 5 deletions src/usr/sbin/sbopkg
Expand Up @@ -2891,7 +2891,8 @@ check_source() {
# - $3 = source file name
# Returns 0 if the source is OK, 1 if the source should be (re)downloaded
# (this includes the cases where $3 is empty or refers to a nonexistent
# file) and 2 if the user asked to abort the build.
# file) and 2 if the user asked to abort the build or 3 if the user
# asked to look in the alternate repository

local PKG=$1
local MD5SUM="$2"
Expand Down Expand Up @@ -2931,11 +2932,11 @@ $SRCNAME in $SRCDIR?
You can choose among the following options:
- (Y)es, keep the source and continue the build process;
- (N)o, delete the source and abort the build process; or
- (R)etry download and continue the build process.
- (N)o, delete the source and abort the build process;
- (R)etry download and continue the build process; or
- (A)ttempt to download from third party source repository.
EOF
printf "(Y)es, (N)o, (R)etry?: "
printf "(Y)es, (N)o, (R)etry, (A)lternative ?: "
error_read
case $REPLY in
Y|y)
Expand All @@ -2953,6 +2954,10 @@ EOF
echo " Downloading again." | tee -a $TMPSUMMARYLOG
return 1
;;
A|a)
echo " Searching source repository." | tee -a $TMPSUMMARYLOG
return 3
;;
*)
unknown_response
;;
Expand Down Expand Up @@ -2988,6 +2993,15 @@ check_cert_prompt() {
done
}

make_archive_url() {
# Get (and echo) the sbosrcarch URL for a source
local MD5SUM=$1
local SRCNAME=$2

local ARCHIVE=${SRC_REPO:-"http://slackware.org.uk/sbosrcarch"}
echo $ARCHIVE/by-md5/${MD5SUM:0:1}/${MD5SUM:1:1}/$MD5SUM/$SRCNAME
}

get_source() {
# Check to see if the source tarball exists in the local cache directory.
# If it does, make a symlink to the package directory in the local mirror.
Expand Down Expand Up @@ -3045,6 +3059,9 @@ get_source() {
FAILURE=download
break 2
;;
3 ) # Archive
DOWNLOAD[$i]=$( make_archive_url ${MD5SUM[$i]} ${SRCNAME[$i]} )
;;
esac

rm -rf $DLDIR
Expand Down
7 changes: 7 additions & 0 deletions tools/ChangeLog-latest.txt
@@ -1,5 +1,12 @@
SBOPKG NEWS

sbopkg-dev (2015-10-30 00:25:09 UTC)
FEATURES
* Added option to download from third party source repository
in case the one mentioned in .info failed or having bad checksums.
* Added new option in sbopkg.conf: SRC_REPO
This is used to define third party source repository

sbopkg-0.37.1 (2015-10-27 03:02:59 UTC)

FEATURES
Expand Down

0 comments on commit b0bd626

Please sign in to comment.