mirror of
https://github.com/zuno/slackpkgplus
synced 2024-12-27 09:58:34 +01:00
Version 1.7.b4.3 - 02/May/2016
- Optimized code for generating ChangeLogs. (phenixia2003)
This commit is contained in:
parent
15bab88651
commit
80cf09386d
3 changed files with 64 additions and 27 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
Version 1.7.b4.3 - 02/May/2016
|
||||||
|
- Optimized code for generating ChangeLogs. (phenixia2003)
|
||||||
|
|
||||||
Version 1.7.b4.2 - 18/Apr/2016
|
Version 1.7.b4.2 - 18/Apr/2016
|
||||||
- Improved cached downloader with specifics output for ChangeLogs
|
- Improved cached downloader with specifics output for ChangeLogs
|
||||||
- Fixed a bug in TAG_PRIORITY when the package is not installed
|
- Fixed a bug in TAG_PRIORITY when the package is not installed
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
Version 1.7.b4.3 - 02/May/2016
|
||||||
|
- Optimized code for generating ChangeLogs. (phenixia2003)
|
||||||
|
|
||||||
Version 1.7.b4.2 - 18/Apr/2016
|
Version 1.7.b4.2 - 18/Apr/2016
|
||||||
- Improved cached downloader with specifics output for ChangeLogs
|
- Improved cached downloader with specifics output for ChangeLogs
|
||||||
- Fixed a bug in TAG_PRIORITY when the package is not installed
|
- Fixed a bug in TAG_PRIORITY when the package is not installed
|
||||||
|
|
|
@ -129,6 +129,10 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
# Override cleanup() to improve log messages and debug functions
|
# Override cleanup() to improve log messages and debug functions
|
||||||
#
|
#
|
||||||
function cleanup(){
|
function cleanup(){
|
||||||
|
# Get the current exit-code so that we can check if cleanup is
|
||||||
|
# called in response of a CTRL+C (ie. $?=130) or not.
|
||||||
|
local lEcode=$?
|
||||||
|
|
||||||
if [ "$CMD" == "info" ];then
|
if [ "$CMD" == "info" ];then
|
||||||
DETAILED_INFO=${DETAILED_INFO:-none}
|
DETAILED_INFO=${DETAILED_INFO:-none}
|
||||||
[[ "$DETAILED_INFO" != "none" ]]&&more_info
|
[[ "$DETAILED_INFO" != "none" ]]&&more_info
|
||||||
|
@ -138,6 +142,19 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
|
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
|
||||||
touch $WORKDIR/pkglist
|
touch $WORKDIR/pkglist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# When cleanup() has not been called in response of a CTRL+C, copy
|
||||||
|
# the files -downloaded and generated by getfile()- from
|
||||||
|
# TMPDIR/ChangeLogs into WORKDIR/ChangeLogs
|
||||||
|
#
|
||||||
|
if [ $lEcode -ne 130 ] && [ -e ${TMPDIR}/ChangeLogs ] ; then
|
||||||
|
if [ ! -e ${WORKDIR}/ChangeLogs ] ; then
|
||||||
|
mkdir ${WORKDIR}/ChangeLogs
|
||||||
|
else
|
||||||
|
rm -f ${WORKDIR}/ChangeLogs/*
|
||||||
|
fi
|
||||||
|
cp ${TMPDIR}/ChangeLogs/* ${WORKDIR}/ChangeLogs
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
[ "$TTYREDIRECTION" ] && exec 1>&3 2>&4
|
[ "$TTYREDIRECTION" ] && exec 1>&3 2>&4
|
||||||
[ "$SPINNING" = "off" ] || tput cnorm
|
[ "$SPINNING" = "off" ] || tput cnorm
|
||||||
|
@ -564,18 +581,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
fi
|
fi
|
||||||
if [ $(basename $1) = "ChangeLog.txt" ];then
|
if [ $(basename $1) = "ChangeLog.txt" ];then
|
||||||
|
|
||||||
# ChangeLog.txt from slackware and 3rd party repository are merged
|
# ChangeLog.txt from slackware and 3rd party repository are stored
|
||||||
# into WORKDIR/Unified-ChangeLog.txt
|
# into TMPDIR/ChangeLogs directory. This directory is automatically
|
||||||
|
# moved into WORKDIR by function cleanup() unless when this function
|
||||||
|
# is called in response to a CTRL+C
|
||||||
#
|
#
|
||||||
# At this point, ChangeLog.txt from slackware has been already
|
# see http://www.linuxquestions.org/questions/slackware-14/slackpkg-vs-third-party-package-repository-4175427364/page35.html#post5537830
|
||||||
# download and is stored in WORKDIR/ChangeLog.txt
|
|
||||||
|
|
||||||
cat $WORKDIR/ChangeLog.txt > $WORKDIR/Unified-ChangeLog.txt
|
mkdir ${TMPDIR}/ChangeLogs
|
||||||
|
|
||||||
|
# Copy slackware ChangeLog.txt into directory dedicated to changelogs...
|
||||||
|
cat ${TMPDIR}/ChangeLog.txt > ${TMPDIR}/ChangeLogs/slackware.txt
|
||||||
|
|
||||||
for PREPO in ${REPOPLUS[*]}; do
|
for PREPO in ${REPOPLUS[*]}; do
|
||||||
echo "======== Repository: $PREPO ========" >>${WORKDIR}/Unified-ChangeLog.txt
|
|
||||||
BASEDIR=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]%}
|
BASEDIR=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]%}
|
||||||
CLOGNAM=ChangeLog-$PREPO.txt
|
CLOGNAM=$PREPO.txt
|
||||||
|
|
||||||
LIMIT=1
|
LIMIT=1
|
||||||
|
|
||||||
|
@ -604,24 +624,26 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -s ${TMPDIR}/$CLOGNAM ] ; then
|
if [ -s ${TMPDIR}/$CLOGNAM ] ; then
|
||||||
echo -e " Merging ChangeLog.txt from repository $PREPO with Unified-ChangeLog.txt.\n"
|
echo -e " Saving ChangeLog.txt from repository $PREPO ...\n"
|
||||||
cat ${TMPDIR}/$CLOGNAM >> ${WORKDIR}/Unified-ChangeLog.txt
|
cat ${TMPDIR}/$CLOGNAM >> ${TMPDIR}/ChangeLogs/$CLOGNAM
|
||||||
else
|
else
|
||||||
echo -e " Repository $PREPO has no ChangeLog.txt.\n"
|
echo -e " Repository $PREPO has no ChangeLog.txt.\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Extract each package entry in Unified-ChangeLog.txt and store them in
|
# For each <reponame>.txt file in TMPDIR/ChangeLogs, create a corresponding
|
||||||
# $WORKDIR/Unified-ChangeLog.idx which is used by showChangeLogInfo()
|
# <reponame>.idx which is used by showChangeLogInfo()
|
||||||
#
|
#
|
||||||
# The output file is formatted as below :
|
# The output file is formatted as below :
|
||||||
# <idx>:<pathname>: <status>
|
# <idx>:<pathname>: <status>
|
||||||
#
|
#
|
||||||
# <idx> is the line index of the entry in original Unified-ChangeLog.txt
|
# <idx> is the line index of the entry in original changelog <reponame>.txt
|
||||||
# <pathname> is the full pathname of the package (ie. a/cryptsetup-1.7.1-x86_64-1.txz)
|
# <pathname> is the full pathname of the package (ie. a/cryptsetup-1.7.1-x86_64-1.txz)
|
||||||
# <status> is the package status, which can be added,moved,rebuilt,removed,upgraded)
|
# <status> is the package status, which can be added,moved,rebuilt,removed,upgraded)
|
||||||
#
|
#
|
||||||
grep -inE "$CLOG_PKGREGEX" ${WORKDIR}/Unified-ChangeLog.txt > ${WORKDIR}/Unified-ChangeLog.idx
|
for PREPO in slackware ${REPOPLUS[*]} ; do
|
||||||
|
grep -inE "$CLOG_PKGREGEX" ${TMPDIR}/ChangeLogs/$PREPO.txt > ${TMPDIR}/ChangeLogs/$PREPO.idx
|
||||||
|
done
|
||||||
|
|
||||||
for PREPO in ${REPOPLUS[*]};do
|
for PREPO in ${REPOPLUS[*]};do
|
||||||
# Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
|
# Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
|
||||||
|
@ -1168,33 +1190,42 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
function showChangeLogInfo() {
|
function showChangeLogInfo() {
|
||||||
local Cpkg
|
local Cpkg
|
||||||
local CpkgInfos
|
local CpkgInfos
|
||||||
|
local CLogIdxFile
|
||||||
local CLogStartIdx
|
local CLogStartIdx
|
||||||
local Pathname
|
local Pathname
|
||||||
local Status
|
local Status
|
||||||
local Cline
|
local Cline
|
||||||
|
local Repository
|
||||||
|
|
||||||
echo -n "" > $TMPDIR/Packages.clog
|
echo -n "" > $TMPDIR/Packages.clog
|
||||||
|
|
||||||
for Cpkg in $(<$TMPDIR/dialog.out) ; do
|
for Cpkg in $(<$TMPDIR/dialog.out) ; do
|
||||||
|
|
||||||
# get infos about the current package from changeLog-packages.idx file, if any. The
|
# get infos about the current package from *.idx files in WORKDIR/ChangeLogs,
|
||||||
# variable CpkgInfos is a string formatted as below:
|
# if any. The variable CpkgInfos is a string formatted as below:
|
||||||
# <clogidx>:<pathname>: <status>
|
# path/<reponame>.idx:<clogidx>:<pathname>:<status>
|
||||||
#
|
#
|
||||||
# clogidx=line index of the entry in ChangeLog.txt that match Cpkg
|
# clogidx=line index of the entry in WORKDIR/ChangeLogs/<reponame>.txt that match Cpkg
|
||||||
#
|
#
|
||||||
CpkgInfos=( $(grep $Cpkg $WORKDIR/Unified-ChangeLog.idx | tr ":" " ") )
|
CpkgInfos=( $(grep -R $Cpkg $WORKDIR/ChangeLogs/*.idx | tr ":" " ") )
|
||||||
|
|
||||||
if [ ! -z "$CpkgInfos" ] ; then
|
if [ ! -z "$CpkgInfos" ] ; then
|
||||||
CLogStartIdx=${CpkgInfos[0]}
|
CLogIdxFile=${CpkgInfos[0]}
|
||||||
Pathname=${CpkgInfos[1]}
|
CLogStartIdx=${CpkgInfos[1]}
|
||||||
Status=$(echo ${CpkgInfos[2]} | tr --delete " .")
|
Pathname=${CpkgInfos[2]}
|
||||||
|
Status=$(echo ${CpkgInfos[3]} | tr --delete " .")
|
||||||
|
|
||||||
echo "$Pathname ($Status)" >> $TMPDIR/Packages.clog
|
# Get the repository name containing a changelog entry about the current
|
||||||
|
# package (ie Cpkg).
|
||||||
|
#
|
||||||
|
Repository=$(basename $CLogIdxFile .idx)
|
||||||
|
|
||||||
# extra information on package Cpkg can be found in ChangeLog.txt file
|
echo "$Repository::$Pathname ($Status)" >> $TMPDIR/Packages.clog
|
||||||
# starting at line CLogStartIdx+1 and ending the line before the first
|
|
||||||
# line matching the regular expression CLOG_SEPREGEX or CLOG_PKGREGEX.
|
# extra information on package Cpkg can be found in file
|
||||||
|
# WORKDIR/ChangeLogs/${Repository}.txt starting at line
|
||||||
|
# CLogStartIdx+1 and ending the line before the first line matching
|
||||||
|
# the regular expression CLOG_SEPREGEX or CLOG_PKGREGEX.
|
||||||
#
|
#
|
||||||
# CLOG_SEPREGEX match the "standard" changelog separator entry, ie. a string
|
# CLOG_SEPREGEX match the "standard" changelog separator entry, ie. a string
|
||||||
# which start with a plus followed by dashes and a plus. For instance:
|
# which start with a plus followed by dashes and a plus. For instance:
|
||||||
|
@ -1207,7 +1238,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
|
|
||||||
((CLogStartIdx++))
|
((CLogStartIdx++))
|
||||||
|
|
||||||
tail -n "+$CLogStartIdx" $WORKDIR/Unified-ChangeLog.txt | while read Cline ; do
|
tail -n "+$CLogStartIdx" $WORKDIR/ChangeLogs/${Repository}.txt | while read Cline ; do
|
||||||
if ! echo "$Cline" | grep -qiE "($CLOG_SEPREGEX)|($CLOG_PKGREGEX)" ; then
|
if ! echo "$Cline" | grep -qiE "($CLOG_SEPREGEX)|($CLOG_PKGREGEX)" ; then
|
||||||
echo -e " $Cline" >> $TMPDIR/Packages.clog
|
echo -e " $Cline" >> $TMPDIR/Packages.clog
|
||||||
else
|
else
|
||||||
|
@ -1504,7 +1535,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
SPKGPLUS_VERSION="1.7.b4.2"
|
SPKGPLUS_VERSION="1.7.b4.3"
|
||||||
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION"
|
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue