Skip to content

Commit 9b8635a

Browse files
committed
updated version check etc
1 parent 6c671c1 commit 9b8635a

File tree

2 files changed

+50
-25
lines changed

2 files changed

+50
-25
lines changed

LFSFunctions

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ RED='\e[1;31m'
99
GREEN='\e[1;32m'
1010
BLACK='\e[0;30m'
1111
NORMAL='\e[0;0m'
12+
BLUE='\e[1;34m'
13+
1214

1315
ARCH=${ARCH:-$(uname -m)}
1416
case "$ARCH" in
@@ -133,8 +135,28 @@ findnextpair ()
133135

134136
checkversion ()
135137
{
136-
val1=( ${1//./ } )
137-
val2=( ${2//./ } )
138+
local maxlen=0
139+
local val1=( ${1//./ } )
140+
local val2=( ${2//./ } )
141+
local value1
142+
local value2
143+
local j
144+
local mult
145+
146+
maxlen=${#val1[@]}
147+
148+
if [ ${#val2[@]} -gt $maxlen ];then
149+
maxlen=${#val2[@]}
150+
fi
151+
for ((j=0;j<$maxlen;j++))
152+
do
153+
if [ "X${val1[$j]}" = "X" ];then
154+
val1[$j]=0
155+
fi
156+
if [ "X${val2[$j]}" = "X" ];then
157+
val2[$j]=0
158+
fi
159+
done
138160

139161
value1=0
140162
mult=1
@@ -476,17 +498,19 @@ printversioninfo ()
476498
{
477499
case $(checkversion $1 $2) in
478500
1)
479-
echo "Package $3 may need updating to $1"
480-
echo "$4"
501+
echo -e "${BLUE}Package $3 may need updating to $1${NORMAL}" >&2
502+
# echo "$4"
481503
;;
482504
-1)
483-
echo "Package $3 build script version greater than documented version ???"
484-
echo "Package $3 build script version=$2, documented version=$1"
505+
echo -e "${RED}Package $3 build script version greater than documented version ???${NORMAL}" >&2
506+
echo -e "${RED}Package $3 build script version=$2, documented version=$1${NORMAL}" >&2
507+
485508
;;
486509
0)
487-
echo "Package $3 version $2 is Ok ..."
510+
echo -e "${GREEN}Package $3 version $2 is Ok ...${NORMAL}" >&2
488511
;;
489512
esac
513+
echo "$4"
490514
}
491515

492516
checkforversion ()
@@ -503,28 +527,21 @@ checkforversion ()
503527
for packages in ${OPTS[@]}
504528
do
505529
appname=$packages
506-
for usepage in "blfsstable" "lfsstable" "14.1" "14.0" "13.37" "13.1" "blfsdev" "lfsdev"
530+
for usepage in "lfsstable" "blfsstable" "14.1" "14.0" "13.37" "13.1" "lfsdev" "blfsdev"
507531
do
508532
case $usepage in
509-
"blfsstable")
510-
echo -e "${GREEN}Checking BLFS (stable) for $appname version ...${NORMAL}" 1>&2
511-
subpage=$(cat blfsindex1.html | grep -i "/${appname}.html"|sed -n 's/.*\(".*.html"\).*/\1/g;s/"//gp'|head -n1)
512-
if [ X${subpage} != "X" ];then
513-
page="http://www.linuxfromscratch.org/blfs/view/stable/${subpage}"
514-
fi
515-
;;
516533
"lfsstable")
517534
echo -e "${GREEN}Checking LFS (stable) for $appname version ...${NORMAL}" 1>&2
518535
subpage=$(cat lfsindex1.html | grep -i "/${appname}.html"|sed -n 's/.*\(".*.html"\).*/\1/g;s/"//gp'|head -n1)
519536
if [ X${subpage} != "X" ];then
520537
page="http://www.linuxfromscratch.org/lfs/view/stable/${subpage}"
521538
fi
522539
;;
523-
"blfsdev")
524-
echo -e "${GREEN}Checking BLFS (development) for $appname version ...${NORMAL}" 1>&2
525-
subpage=$(cat blfsindex0.html | grep -i "/${appname}.html"|sed -n 's/.*\(".*.html"\).*/\1/g;s/"//gp'|head -n1)
540+
"blfsstable")
541+
echo -e "${GREEN}Checking BLFS (stable) for $appname version ...${NORMAL}" 1>&2
542+
subpage=$(cat blfsindex1.html | grep -i "/${appname}.html"|sed -n 's/.*\(".*.html"\).*/\1/g;s/"//gp'|head -n1)
526543
if [ X${subpage} != "X" ];then
527-
page="http://www.linuxfromscratch.org/blfs/view/svn/${subpage}"
544+
page="http://www.linuxfromscratch.org/blfs/view/stable/${subpage}"
528545
fi
529546
;;
530547
"lfsdev")
@@ -534,7 +551,13 @@ checkforversion ()
534551
page="http://www.linuxfromscratch.org/lfs/view/development/${subpage}"
535552
fi
536553
;;
537-
554+
"blfsdev")
555+
echo -e "${GREEN}Checking BLFS (development) for $appname version ...${NORMAL}" 1>&2
556+
subpage=$(cat blfsindex0.html | grep -i "/${appname}.html"|sed -n 's/.*\(".*.html"\).*/\1/g;s/"//gp'|head -n1)
557+
if [ X${subpage} != "X" ];then
558+
page="http://www.linuxfromscratch.org/blfs/view/svn/${subpage}"
559+
fi
560+
;;
538561
*)
539562
echo -e "${GREEN}Checking Slackbuilds version $usepage for $appname version ...${NORMAL}" 1>&2
540563
linenumber=$(grep --line-number -i "SLACKBUILD NAME:[ ]*${appname}$" "${usepage}.txt"|awk -F: '{print $1}')
@@ -556,12 +579,11 @@ checkforversion ()
556579
if [ ! -e ${appname}.html ];then
557580
wget $page -O ${appname}.html 2>/dev/null
558581
fi
559-
infodata=$(cat ${appname}.html|grep -i "\b$appname\b"|head -n1)
582+
infodata=$(cat ${appname}.html|grep -i "\b$appname\b"|head -n1)
560583
vers=${infodata##?*-}
561584
infodata=$(sed -n "/name=\b${appname}\b/I,/Installed version=/p" "${DATABASE}")
562585
packageversion=$(echo "$infodata"|sed -n '2p'|awk -F= '{print $2}')
563586
printversioninfo $vers $packageversion $appname "$infodata"
564-
echo "More info here: $page"
565587
continue 2
566588
fi
567589
done

lfspkg

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
############################################################
44
#keithhedger
5-
#Tue 2 May 16:30:30 BST 2017
5+
#Fri 5 May 15:58:00 BST 2017
66
#Built using: makeswitch -c LFSMakePkg.conf
77
############################################################
88

@@ -221,8 +221,11 @@ if [ X"$THISTTY" = "X" ];then
221221
export THISTTY=$(tty)
222222
fi
223223

224+
if [ "X$LOCAL" != "X" ];then
225+
. ./LFSFunctions
226+
else
224227
. /usr/share/LFSPkg/LFSFunctions
225-
#. ./LFSFunctions
228+
fi
226229

227230
init ()
228231
{
@@ -736,7 +739,7 @@ updatedatabase ()
736739
done
737740
popd &>/dev/null
738741
fi
739-
finddepends ${BUILDSCRIPTS} "${ROOTDIR}" L> "${DATABASE}"
742+
finddepends "${BUILDSCRIPTS}" "${ROOTDIR}" L> "${DATABASE}"
740743
}
741744

742745
finddependants ()

0 commit comments

Comments
 (0)