mirror of
https://github.com/sbopkg/sbopkg
synced 2024-12-28 09:58:58 +01:00
Fail gracefully when there's an error computing a pkg repo version.
Sometimes sbopkg can't determine the version of a package. For example, the google-chrome script looks at the source archive to determine it, and such archive can very well be unavailable. This patch makes sbopkg intercept the error condition and notify it to the user gracefully, while at the same time falling back to trusting the version provided in the .info file. Thanks to alkos333 for the bug report. Signed-off-by: Mauro Giachero <mauro.giachero@gmail.com>
This commit is contained in:
parent
246d57fe2e
commit
59ac74efb1
3 changed files with 27 additions and 6 deletions
|
@ -20,4 +20,8 @@ enhancements:
|
||||||
artourter for the report.
|
artourter for the report.
|
||||||
* Modify links in check_for_latest() function to use new sbopkg.org
|
* Modify links in check_for_latest() function to use new sbopkg.org
|
||||||
redirects.
|
redirects.
|
||||||
|
* Prevent sbopkg from spitting error messages when trying to determine the
|
||||||
|
version of some packages (e.g. google-chrome, whose version is discovered
|
||||||
|
looking into the source package which can be missing). Thanks to alkos333
|
||||||
|
for the bug report.
|
||||||
+--------------------------+
|
+--------------------------+
|
||||||
|
|
|
@ -15,3 +15,13 @@ tools it uses:
|
||||||
Details: http://code.google.com/p/sbopkg/issues/detail?id=30
|
Details: http://code.google.com/p/sbopkg/issues/detail?id=30
|
||||||
|
|
||||||
Workaround: use dialog's own exit methods - its buttons, escape, ^C, etc.
|
Workaround: use dialog's own exit methods - its buttons, escape, ^C, etc.
|
||||||
|
|
||||||
|
* when checking for updates, for some packages Sbopkg may tell you
|
||||||
|
"Note: repo version not obtainable by standard method, may be inaccurate.".
|
||||||
|
This happens with packages whose version is very difficult/impossible to
|
||||||
|
determine without actually building the package -- one example of this at
|
||||||
|
the time of writing is the google-chrome package, whose version is picked
|
||||||
|
from the source archive itself. In these cases sbopkg falls back to trusting
|
||||||
|
the .info file, and warns the user about it.
|
||||||
|
|
||||||
|
Workaround: none needed
|
||||||
|
|
|
@ -637,6 +637,7 @@ check_for_updates() {
|
||||||
# Giachero for this much-improved update code and related functions!
|
# Giachero for this much-improved update code and related functions!
|
||||||
|
|
||||||
local TEMPFILE=$SBOPKGTMP/sbopkg_updates_tempfile
|
local TEMPFILE=$SBOPKGTMP/sbopkg_updates_tempfile
|
||||||
|
local ERRORMSG=$SBOPKGTMP/sbopkg_updates_errormsg
|
||||||
local NEWSB NEWINFO NEWVER
|
local NEWSB NEWINFO NEWVER
|
||||||
local VERSION_EXPRESSION
|
local VERSION_EXPRESSION
|
||||||
local UPDATELIST VERSION_FILE PROGRESSBAR_INTERRUPTED
|
local UPDATELIST VERSION_FILE PROGRESSBAR_INTERRUPTED
|
||||||
|
@ -657,7 +658,7 @@ check_for_updates() {
|
||||||
# Check to see if there are any updates to installed SBo pkgs.
|
# Check to see if there are any updates to installed SBo pkgs.
|
||||||
check_if_repo_exists
|
check_if_repo_exists
|
||||||
UPDATELIST=$SBOPKGTMP/sbopkg_updatelist
|
UPDATELIST=$SBOPKGTMP/sbopkg_updatelist
|
||||||
rm -f $UPDATELIST
|
rm -f $UPDATELIST $ERRORMSG
|
||||||
cd /var/log/packages
|
cd /var/log/packages
|
||||||
PKGS=$(ls *$REPO_TAG 2> /dev/null)
|
PKGS=$(ls *$REPO_TAG 2> /dev/null)
|
||||||
NUMPKGS=$(wc -w <<< "$PKGS")
|
NUMPKGS=$(wc -w <<< "$PKGS")
|
||||||
|
@ -737,19 +738,20 @@ check_for_updates() {
|
||||||
|
|
||||||
# Step 3 - reverse the file order
|
# Step 3 - reverse the file order
|
||||||
# Because dependencies must be first...
|
# Because dependencies must be first...
|
||||||
tac $VERSION_FILE > $TEMPFILE
|
tac $VERSION_FILE >> $TEMPFILE
|
||||||
mv $TEMPFILE $VERSION_FILE
|
mv $TEMPFILE $VERSION_FILE
|
||||||
|
|
||||||
# Step 4 - let's get the version number!
|
# Step 4 - let's get the version number!
|
||||||
# Also, strip any residual program name token.
|
# Also, strip any residual program name token.
|
||||||
NEWVER=$(sh $VERSION_FILE | rev | cut -d- -f1 | rev)
|
NEWVER=$(sh $VERSION_FILE 2> $ERRORMSG | sed 's/.*-//g')
|
||||||
rm -f $VERSION_FILE
|
rm -f $VERSION_FILE
|
||||||
|
|
||||||
# Step 5 - fixup braindead cases
|
# Step 5 - fixup braindead cases
|
||||||
# Sometimes the above doesn't work -- see cpan2tgz for 12.1
|
# Sometimes the above doesn't work -- see cpan2tgz for 12.1
|
||||||
# In that case, let's trust the .info file...
|
# In that case, let's trust the .info file...
|
||||||
if [[ -z $NEWVER ]]; then
|
[[ -z $NEWVER ]] && echo "Empty version!" >> $ERRORMSG
|
||||||
NEWINFO=$(echo $NEWSB | rev | cut -d. -f2- | rev).info
|
if [[ $(< $ERRORMSG) ]]; then
|
||||||
|
NEWINFO=$(sed 's/\.SlackBuild$/\.info/g' <<< "$NEWSB")
|
||||||
NEWVER=$(grep "^VERSION" $NEWINFO | cut -d\" -f2)
|
NEWVER=$(grep "^VERSION" $NEWINFO | cut -d\" -f2)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -808,12 +810,17 @@ check_for_updates() {
|
||||||
echo " No update." >> $UPDATELIST
|
echo " No update." >> $UPDATELIST
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ $(< $ERRORMSG) ]]; then
|
||||||
|
echo " Note: repo version not obtainable by" \
|
||||||
|
"standard method, may be inaccurate." >> $UPDATELIST
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [[ $DEBUG -ge 1 ]]; then
|
if [[ $DEBUG -ge 1 ]]; then
|
||||||
echo $NAME: >> $UPDATELIST
|
echo $NAME: >> $UPDATELIST
|
||||||
echo " Not in the repository." >> $UPDATELIST
|
echo " Not in the repository." >> $UPDATELIST
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
rm -f $ERRORMSG
|
||||||
|
|
||||||
# Progress indicator, for the progressbar
|
# Progress indicator, for the progressbar
|
||||||
(( PROGRESSCOUNTER += 1 ))
|
(( PROGRESSCOUNTER += 1 ))
|
||||||
|
@ -1542,9 +1549,9 @@ queue_dir_lister() {
|
||||||
-maxdepth 1 | sed -e 's/.sqf//' | sort > $QFM
|
-maxdepth 1 | sed -e 's/.sqf//' | sort > $QFM
|
||||||
if [[ -z $(< $QFM) ]]; then
|
if [[ -z $(< $QFM) ]]; then
|
||||||
if [[ $DIAG ]]; then
|
if [[ $DIAG ]]; then
|
||||||
rm -f $QFM
|
|
||||||
dialog --title "ERROR" --msgbox "$(crunch "The queue directory \
|
dialog --title "ERROR" --msgbox "$(crunch "The queue directory \
|
||||||
$QUEUEDIR is empty.")" 8 30
|
$QUEUEDIR is empty.")" 8 30
|
||||||
|
rm -f $QFM
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue