LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackpkg vs. third-party package repository (https://www.linuxquestions.org/questions/slackware-14/slackpkg-vs-third-party-package-repository-4175427364/)

zerouno 03-02-2016 02:14 PM

regards the issue for dir:// repositories, I fixed it and substituted ls with find.

When I wrote it, I did not use find becouse I can't know the structure of the tree, and if it contains many subdir it can slow down the start of slackpkg in any command (search,upgrade,update,...).
In effect, dir:// may be a dedicated directory containing just packages, but may be a directory containing any other things.
So I tried to put dir://home/ as local repository (about 200.000 mixed files)
It take about 10 seconds before start commands.
I think that it is an acceptable time (how many people set the entire home as local repository? He does it at his own risk).

please try it before I commit (apply to 1.7.b3):
Code:

--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -930,7 +930,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
          }' l_dir=${DIR} > $PKGINFOS
 
      else # -- CMD==search
-        grep ${GREPOPTS} "^$DIR" $WORKDIR/pkglist|grep ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/\|/$SEARCHSTR/\|/$SEARCHSTR \| [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
+        grep -h ${GREPOPTS} "^$DIR" ${WORKDIR}/pkglist ${TMPDIR}/pkglist-pre|grep ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/\|/$SEARCHSTR/\|/$SEARCHSTR \| [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
      fi
 
      while read PKGDIR PKGBASENAME PKGVER PKGARCH PKGBUILD PKGFULLNAME PKGPATH PKGEXT ; do
@@ -1423,7 +1423,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
        continue
      fi
      ( cd $localpath
-        ls -ld *.t[blxg]z|sort -rn|grep ^-|awk '{print "./SLACKPKGPLUS_'$PREPO'/"$NF}'|awk -f /usr/libexec/slackpkg/pkglist.awk >> ${TMPDIR}/pkglist-pre
+        find . -type f -name '*.t[blxg]z'|sed "s,^./,./SLACKPKGPLUS_$PREPO/,"|awk -f /usr/libexec/slackpkg/pkglist.awk|sort -k6 -rn >> ${TMPDIR}/pkglist-pre
      )
    fi
  done
@@ -1490,7 +1490,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
          localpath=$(pwd)/$localpath
        fi
        ( cd $localpath
-          ls -ld *.t[blxg]z 2>/dev/null|sort -rn|grep ^-|awk '{print "./SLACKPKGPLUS_'$repository'/"$NF}'|awk -f /usr/libexec/slackpkg/pkglist.awk >> ${TMPDIR}/pkglist-pre
+          find . -type f -name '*.t[blxg]z'|sed "s,^./,./SLACKPKGPLUS_$PREPO/,"|awk -f /usr/libexec/slackpkg/pkglist.awk|sort -k6 -rn >> ${TMPDIR}/pkglist-pre
        )
        MIRRORPLUS[$repository]="file:/$localpath/"
        PRIORITYLIST=( ${PRIORITYLIST[*]} SLACKPKGPLUS_${repository}:.* )


zerouno 03-06-2016 09:47 AM

I'm reorganizing the slackpkg+ official repositories.

I want continue to support the -1.6 version for a lot.
So I'm thinking that structure (that I will insert in repositories.txt in next commit)

http://slakfinder.org/slackpkg+/ --> latest slackpkg+ stable version
http://slakfinder.org/slackpkg+1.6/ --> the 1.6.x version; it will be supported for a lot
http://slakfinder.org/slackpkg+1.7/ --> the 1.7.x version; the next stable version
http://slakfinder.org/slackpkg+current/ --> the current version; use it to try new features
http://slakfinder.org/slackpkg+dev/ --> the development version; use it to help the development

currently
slackpkg+1.6/ is a link to slackpkg+/
slackpkg+1.7/ and slackpkg+current/ is a link to slackpkg+dev/

When slackpkg+ 1.7 stable will be released, slackpkg+/ will be a link to slackpkg+1.7/, so all users automatically upgrade to it.
Who want continue to use slackpkg+ 1.6 have to point to slackpkg+1.6/ directly.

slackpkg+current/ will be a snapshot of slackpkg+dev/ tree
slackpkg+1.6/ will be mantained for fixes
slackpkg+1.7/ will be mantained for fixes and minor updates

what do you think of that plan?


Currently repositories.txt contains some 14.2 repository from microlinux.
Someone are preparing some 14.2 repository?

gegechris99 03-08-2016 06:35 AM

Quote:

Originally Posted by zerouno (Post 5511133)
currently
slackpkg+1.6/ is a link to slackpkg+/
slackpkg+1.7/ and slackpkg+current/ is a link to slackpkg+dev/
[...]
slackpkg+current/ will be a snapshot of slackpkg+dev/ tree
slackpkg+1.6/ will be mantained for fixes
slackpkg+1.7/ will be mantained for fixes and minor updates

what do you think of that plan?

current and dev branches look like duplicates to me. Or do you really see a case when you'd want to play in dev/ without adjusting current/ accordingly?

Why not try to follow an approach similar to Slackware: One stable version + one development version?

You could have slackpkg+/ link to the latest stable version (1.6 today and 1.7 when it's released). So I would see:

slackpkg+dev/ will be the development tree (I would not name it "current" to avoid a possible confusion that it's a package for Slackware -current. It's not)
slackpkg+/ will be a link to the latest stable version (slackpkg+1.6/ for now)
slackpkg+1.7/ will be created when a new stable version is released based on dev tree. slackpkg+/ will then be changed to link to this latest stable version.

yars 03-08-2016 12:11 PM

In git, usually, the master branch is a development code, for stable versions you may use git tags and any non-master branches, and for testing new features you can use another branch(es). That will just simplify your work. Yes, I know, you prefer to do all the actions manually, but why you don't use git, I don't understand. IMO git is not so difficult to learn...

zerouno 03-08-2016 01:03 PM

Quote:

Originally Posted by gegechris99
current and dev branches look like duplicates to me. Or do you really see a case when you'd want to play in dev/ without adjusting current/ accordingly?

I don't know. I think that in dev/ I'm more free to do experiments, add features (or simplest patches), and then remove it.
The -current even if it is not a -stable tree, however should have less experiments.
The reason for a public -dev is just becouse I want keep public all experiments.

Quote:

Why not try to follow an approach similar to Slackware: One stable version + one development version?
Slackware has many stable versions, one -current version (that is not a development version), and one or more non-public tree for internal development.

Quote:

You could have slackpkg+/ link to the latest stable version (1.6 today and 1.7 when it's released).
yes

Quote:

So I would see:

slackpkg+dev/ will be the development tree (I would not name it "current" to avoid a possible confusion that it's a package for Slackware -current. It's not)
good observation. slackpkg+current should not exists with that name.




Quote:

Originally Posted by yars
In git, usually, the master branch is a development code

opinions...
however for git I'm trying to reorganizing the ideas, and one it to put -current as master and -dev in another branch. Many time I used git reset and git push forced in a branch; the -master branch is not a good candidate for that operation.


Quote:

for stable versions you may use git tags and any non-master branches
I did never used tags, but the idea is a branch 1.6 and a branch 1.7

Quote:

and for testing new features you can use another branch(es). That will just simplify your work. Yes, I know, you prefer to do all the actions manually, but why you don't use git, I don't understand. IMO git is not so difficult to learn...
I like git but I prefer to apply patches then commit&push instead to merge from other fork becouse I'm free to review before apply it.
Also git give best results when a project has many indipendent files. Here I've a single big file that is not simple to manage (I already tried to cut in in multiple files, but it did not add many value). Here git is just used to
1) keep track of modifies
2) keep it public in a simplest way
3) allow me to work from many computers

To discuss patches and bug the best way is linuxquestions (the real best place should be slacky.eu in italian language ;), but I cannot ask the moon :) ).

phenixia2003 03-10-2016 11:10 AM

4 Attachment(s)
Hello,

I have some new code (beta) that should be, I guess, useful.

This is currently for slackpkg+/devel (ie. 1.7.b3), but could be backported to previous version(s), and even, to slackpkg.

This is a simple extension to the dialog shown in response to commands install, upgrade, and upgrade-all, which allows users to check the changelog for the selected packages.

To do that, I added a button, called ChangeLog, between the Ok and Cancel buttons of the packages selection dialog.

For instance, running slackpkg upgrade patches will show this :

Attachment 21108

When the button ChangeLog is clicked, a textbox is displayed with the changelog entries for the selected packages, like as below :

Attachment 21109

When the changelog textbox is closed, the packages selection dialog is restored, with the exact same selection as before. For instance:

Attachment 21110


The code is in beta stage and must be tested and reviewed by anyone interrested.

Attachment 21111
Code:

--- slackpkgplus.sh.git.1.7.b3        2016-03-10 11:09:31.987399437 +0100
+++ slackpkgplus.sh        2016-03-10 18:07:39.172698579 +0100
@@ -1079,14 +1079,102 @@
    export DIALOG_ITEM_HELP="2"
    export DIALOG_OK="0"
 
+      # Prints, into a dialog box, the changelog entries about the packages listed in file $1
+      #
+    function showChangeLogInfo() {
+        local PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|removed|upgraded)"
+        local SEPREGEX="^[+][-]+[+][ ]*$"
+        local Cpkg
+        local CpkgInfos
+        local Idx
+        local CLogStartIdx
+        local CLogEndIdx
+        local Pathname
+        local Status
+        local Cline
+
+                # Extract each package entry in ChangeLog.txt and store them in
+                # $WORKDIR/ChangeLog-packages.idx
+                #
+                # The output file is formatted as below :
+                #  <idx>:<pathname>: <status>
+                #
+                # <idx> is the line index of the entry in original ChangeLog.txt
+                # <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)
+                #
+                # [PENDING] this should be done only once when slackpkg update is called
+                #
+        grep -inE "$PKGREGEX" $WORKDIR/ChangeLog.txt > $WORKDIR/ChangeLog-packages.idx
+
+        echo -n "" > $TMPDIR/Packages.clog
+
+        for Cpkg in $(<$TMPDIR/dialog.out) ; do
+
+                #  get infos about the current package from changeLog-packages.idx file, if any. The
+                #  variable CpkgInfos is a string formatted as below:
+                #    <idx1>:<clogidx>:<pathname>: <status>
+                #
+                #  idx1=index of the line in changelog-packages.idx which match Cpkg
+                #  clogidx=line index of the entry in ChangeLog.txt that match Cpkg
+                #
+                CpkgInfos=( $(grep -n $Cpkg  $WORKDIR/ChangeLog-packages.idx | tr ":" " ") )
+
+                if [ ! -z "$CpkgInfos" ] ; then       
+                        Idx=${CpkgInfos[0]}
+                        CLogStartIdx=${CpkgInfos[1]}
+                        Pathname=${CpkgInfos[2]}
+                        Status=$(echo ${CpkgInfos[3]} | tr --delete " .")
+
+                        echo "$Pathname ($Status)" >> $TMPDIR/Packages.clog
+
+                        # extra information on package Cpkg can be found in ChangeLog.txt file
+                        # starting at line CLogStartIdx+1 and ending the line before the first
+                        # line matching the regular expression SEPREGEX or PKGREGEX.
+                        #
+                        # SEPREGEX match the "standard" changelog separator entry, ie. a string
+                        # which start with a plus followed by dashes and a plus. For instance:
+                        #  +----------------------+
+                        #
+                        # PKGREGEX match the "standard" changelog package entry, ie. a string
+                        # which starts with a package pathname followed by colon, one or more
+                        # space and the status. For instance:
+                        #  n/bind-1.2.3-x86_64-1.txz: Upgraded.
+
+                        ((CLogStartIdx++))
+
+                        tail -n "+$CLogStartIdx" $WORKDIR/ChangeLog.txt | while read Cline ; do
+                                if ! echo "$Cline" | grep -qiE "($SEPREGEX)|($PKGREGEX)" ; then
+                                        echo -e "\t$Cline" >> $TMPDIR/Packages.clog
+                                else
+                                        break
+                                fi
+                        done
+                        echo "" >> $TMPDIR/Packages.clog
+                fi
+        done
+       
+        dialog        --title "ChangeLog" \
+                --backtitle "slackpkg $VERSION" $HINT \
+                --textbox $TMPDIR/Packages.clog 19 70
+    }
+
+
    # Show the lists and asks if the user want to proceed with that action
    # Return accepted list in $SHOWLIST
    #
    function showlist() {
+      local CLOGopt=false
+      local EXIT=false
+
      if [ "$ONOFF" != "off" ]; then
        ONOFF=on
      fi
 
+      if [ "$2" == "upgrade" ] || [ "$2" == "upgrade-all" ] || [ "$2" == "install" ] ; then
+        CLOGopt=true
+      fi
+
      cat $TMPDIR/greylist.* >$TMPDIR/greylist
      if [ "$GREYLIST" == "off" ];then
        >$TMPDIR/greylist
@@ -1149,23 +1237,90 @@
      if [ "$DOWNLOADONLY" == "on" ];then
        DTITLE="$DTITLE (download only)"
      fi
-      cat $TMPDIR/dialog.tmp|xargs dialog --title "$DTITLE" --backtitle "slackpkg $VERSION" $HINT --checklist "Choose packages to $2:" 19 70 13 2>$TMPDIR/dialog.out
-      case "$?" in
-        0|123)
-          dialog --clear
-        ;;
-        1|124|125|126|127)
-          dialog --clear
-          echo -e "DIALOG ERROR:\n-------------" >> $TMPDIR/error.log
-          cat $TMPDIR/dialog.out >> $TMPDIR/error.log
-          echo "-------------"
-          echo "If you want to continue using slackpkg, disable the DIALOG option in"
-          echo "$CONF/slackpkg.conf and try again."
-          echo "Help us to make slackpkg a better tool - report bugs to the slackpkg"
-          echo "developers" >> $TMPDIR/error.log
-          cleanup
-        ;;
-      esac
+
+      if $CLogOpt ; then
+        # When the user "click" the button <ChangeLog> to read the changelog of
+        # the selected pacakges, the
+        # duplicate TMPDIR/dialog.tmp so that all items are deselected to be able to
+        # regenerate the list of selected items when showChangeLogInfo() returns, ie.
+        # when the user has checked the changelog.
+
+        # When the user "clicks" the button "<ChangeLog>" to read the changelog of
+        # currently selected packages,  the dialog to select packages is terminated
+        # and the changelog is printed in a textbox.
+        #
+        # When the user exits from the textbox, the user must retrieve the packages
+        # selection dialog with the packages that were selected previously. To do that,
+        # the file $TMPDIR/dialog.tmp is duplicated with all items deselected into
+        # file $TMPDIR/dialog.tmp.off, so that the list of selected packages can
+        # be regenerated using the data in file $TMPDIR/dialog.out when
+        # showChangeLogInfos() returns.
+
+        cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
+      fi
+
+      while ! $EXIT ; do
+
+        if $CLOGopt ; then
+                dialog        --extra-button \
+                        --extra-label "ChangeLog" \
+                        --title "$DTITLE" \
+                        --backtitle "slackpkg $VERSION" $HINT \
+                        --checklist "Choose packages to $2:" \
+                        19 70 13 \
+                        --file $TMPDIR/dialog.tmp 2>$TMPDIR/dialog.out
+        else
+                dialog  --title "$DTITLE" \
+                        --backtitle "slackpkg $VERSION" $HINT \
+                        --checklist "Choose packages to $2:" \
+                        19 70 13 \
+                        --file $TMPDIR/dialog.tmp 2>$TMPDIR/dialog.out
+        fi
+
+        case $? in
+                0|1)
+                        EXIT=true
+                              dialog --clear
+                ;;
+
+                3)
+                        dialog --clear
+
+                        if $CLOGopt ; then
+
+                                if [ -s $TMPDIR/dialog.out ] ; then
+                                        showChangeLogInfo $TMPDIR/dialog.out
+
+                                        # regenerate the list of selected package from the patterns
+                                        # in TMPDIR/dialog.out and the file TMPDIR/dialog.tmp.off
+
+                                        PKGS_REGEX=$(cat $TMPDIR/dialog.out|sed "s/ /\\\|/g")
+
+                                        cat $TMPDIR/dialog.tmp.off > $TMPDIR/dialog.tmp
+                                        sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
+                                else
+                                        # all packages are deselected ...
+                                        cat $TMPDIR/dialog.tmp.off > $TMPDIR/dialog.tmp
+                                fi
+                        else
+                                EXIT=true
+                        fi
+                ;;
+
+                -1)
+                        EXIT=true
+                        dialog --clear
+                        echo -e "DIALOG ERROR:\n-------------" >> $TMPDIR/error.log
+                        cat $TMPDIR/dialog.out >> $TMPDIR/error.log
+                        echo "-------------"
+                        echo "If you want to continue using slackpkg, disable the DIALOG option in"
+                        echo "$CONF/slackpkg.conf and try again."
+                        echo "Help us to make slackpkg a better tool - report bugs to the slackpkg"
+                        echo "developers" >> $TMPDIR/error.log
+                        cleanup
+                ;;
+        esac
+      done
      echo
      echo
      SHOWLIST=$(cat $TMPDIR/dialog.out | tr -d \")

Cheers.

--
Seb

bamunds 03-13-2016 04:03 PM

Zerouno, do you want slackpkg+ "stable: questions/troubles here or in a separate thread?

Gerard Lally 03-13-2016 04:13 PM

Quote:

Originally Posted by Didier Spaier (Post 5503920)
“Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher.” (Antoine de Saint-Exupéry).

One of my favourite quotes of all time.

zerouno 03-13-2016 04:23 PM

Quote:

Originally Posted by bamunds (Post 5514851)
Zerouno, do you want slackpkg+ "stable: questions/troubles here or in a separate thread?

Here's the best place.

zerouno 03-14-2016 02:06 PM

Quote:

Originally Posted by phenixia2003 (Post 5513311)
I have some new code (beta) that should be, I guess, useful.

I was searching the code for the beta4 ;)


Version 1.7.b4 - 14/Mar/2016
- slackpkg search now search in dir:// repositories too.
- subdirectory allowed in dir:// repositories.
- slackpkg search honour correctly the '+' character
- Added 'ChangeLog' dialog box to show the changelog of selected packages
(thanks to phenixia2003)


the dialog function(s) contain a bug regard the size of it.
For the changelog, the dialog is 19x70, but the slackware changelog contains rows up to 79 columns.
For package list, 'package name'+'repository name' may be longer than 70 characters.
This is not a large problem since few packages have long name, and the changelog dialogbox is a non-critical feature, but I think it's the time to solve it.

phenixia2003 03-15-2016 10:23 AM

2 Attachment(s)
Hello,

Quote:

Originally Posted by zerouno (Post 5515337)
I was searching the code for the beta4 ;)

I don't know why, but I had the idea to add the changelog viewer after reading the first post of this thread.

Quote:

Originally Posted by zerouno (Post 5515337)
the dialog function(s) contain a bug regard the size of it.
For the changelog, the dialog is 19x70, but the slackware changelog contains rows up to 79 columns.
For package list, 'package name'+'repository name' may be longer than 70 characters.
This is not a large problem since few packages have long name, and the changelog dialogbox is a non-critical feature, but I think it's the time to solve it.

You can scroll left/right in the changelog viewer with left/right keys.

_____________________

I did some change to the changelog viewer so that it can display changelog entries from 3rd party repositories, too.

To achieve this, I modified getfile() so that, it downloads ChangeLog from 3rd party repositories, merges them with slackware changelog into a file called Unified-ChangeLog.txt, and, generates an index file called Unified-ChangeLog.idx.

Notes:
  1. This does not affect the ChangeLog.txt used by check-updates.

  2. There's no consequence when a repository has no ChangeLog.txt file.

  3. In some case, the ChangeLog.txt of a repository is not directly accessible from the URL specified in slackpkgplus.conf. In that case, getfile() automatically searches in parent URLs. For instance, if the URL specified in slackpkgplus.conf is a/b/c/d and the ChangeLog.txt is in a/, getfile() will try the URLs a/b/c/d/ChangeLog.txt, a/b/c/ChangeLog.txt, a/b/ChangeLog.txt, and a/ChangeLog.txt ...

  4. When the ChangeLog.txt is not found in a repository, a 404 error is reported by the downloader (see below). Maybe it would be better to redirect downloader error in /dev/null when downloading the changelog (lines #574-581 once the patch is applied):
    Code:

    http://taper.alienbase.nl/mirrors/people/alien/multilib/14.1//ChangeLog.txt:
    2016-03-15 16:00:30 ERROR 404: Not Found.

  5. the showChangeLogInfo() function expects the changelog entries follow the "standard" slackware changelog format, which can be described as being :
    Code:

    path/to/package_name.t[blgx]z:[ ]added|moved|rebuilt|upgraded"
    <text|null>
    <SEPARATOR|null>


    SEPARATOR is a string starting with a plus followed by dashed, followed by a plus, and followed by 0 to n spaces.


    Important:
    Some repositories don't follow this format. Therefore, in this case, showChangeLogInfo() will find no changelog entry for packages from these repositories, or could truncate some information from the changelog.

Here is a screenshot of changelog viewer with changelog entries from 3rd party repositories :

As I said earlier, when the repository don't follow the "standard" changelog format, some information can be truncated, which is the case for the entry compat32-tools in the screenshot above.



The patch (Attachment 21154) is for slackpkg+/devel 1.7.b4 :
Code:

--- slackpkgplus.sh.git.1.7.b4        2016-03-15 10:51:40.250215213 +0100
+++ slackpkgplus.sh        2016-03-15 15:46:52.422329359 +0100
@@ -12,6 +12,11 @@
  #
 SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"
 
+  # CLOG_PKGREGEX : regular expression used to find package entry in ChangeLog files
+  # CLOG_SEPREGEX : regular expression that match the "standard" entry separator in a ChangeLog file
+CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
+CLOG_SEPREGEX="^[+][-]+[+][ ]*$"
+
 if [ -e $CONF/slackpkgplus.conf ];then
  # You can override GREYLIST WGETOPTS SLACKPKGPLUS VERBOSE USEBL ALLOW32BIT SENSITIVE_SEARCH from command-line
  EXTGREYLIST=$GREYLIST
@@ -545,6 +550,60 @@
      fi
    fi
    if [ $(basename $1) = "ChangeLog.txt" ];then
+
+        # ChangeLog.txt from slackware and 3rd party repository are merged
+        # into WORKDIR/Unified-ChangeLog.txt
+        #
+        # At this point, ChangeLog.txt from slackware has been already
+        # download and is stored in WORKDIR/ChangeLog.txt
+
+      cat $WORKDIR/ChangeLog.txt > $WORKDIR/Unified-ChangeLog.txt
+
+      for PREPO in ${REPOPLUS[*]}; do
+        BASEDIR=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]%}
+        CLOGNAM=ChangeLog-$PREPO.txt
+
+        BDNAMES=( $(echo $BASEDIR | tr "/" " ") )
+        LIMIT=$(( ${#BDNAMES[@]} - 1 ))
+
+        LEVEL=1
+        while [ ! -s ${TMPDIR}/$CLOGNAM ] && [ $LEVEL -le $LIMIT ] ; do
+
+            URLFILE=$BASEDIR/ChangeLog.txt
+
+            if echo $URLFILE | grep -q "^file://" ; then
+                URLFILE=${URLFILE:6}
+                cp -v $URLFILE ${TMPDIR}/$CLOGNAM
+            elif echo $URLFILE | grep -q "^dir:/" ; then
+                touch ${TMPDIR}/$CLOGNAM
+            else
+                $DOWNLOADER ${TMPDIR}/$CLOGNAM $URLFILE
+            fi
+
+            ((LEVEL++))
+            BASEDIR=$(echo ${BASEDIR%/} |rev|cut -f2- -d/ |rev)
+        done
+
+        if [ -s ${TMPDIR}/$CLOGNAM ] ; then
+            echo -e "[INFO] Merging ChangeLog.txt from repository $PREPO with ${WORKDIR}/Unified-ChangeLog.txt.\n"
+            cat ${TMPDIR}/$CLOGNAM >> ${WORKDIR}/Unified-ChangeLog.txt
+        else
+            echo -e "[INFO] Repository $PREPO has no ChangeLog.txt.\n"
+        fi
+      done
+
+        # Extract each package entry in Unified-ChangeLog.txt and store them in
+        # $WORKDIR/Unified-ChangeLog.idx which is used by showChangeLogInfo()
+        #
+        # The output file is formatted as below :
+        #  <idx>:<pathname>: <status>
+        #
+        # <idx> is the line index of the entry in original Unified-ChangeLog.txt
+        # <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)
+        #
+      grep -inE "$CLOG_PKGREGEX" ${WORKDIR}/Unified-ChangeLog.txt > ${WORKDIR}/Unified-ChangeLog.idx
+
      for PREPO in ${REPOPLUS[*]};do
        # Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
        URLFILE=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]}CHECKSUMS.md5
@@ -1082,69 +1141,49 @@
      # Prints, into a dialog box, the changelog entries about the packages listed in file $1
      #
    function showChangeLogInfo() {
-      local PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|removed|upgraded)"
-      local SEPREGEX="^[+][-]+[+][ ]*$"
      local Cpkg
      local CpkgInfos
-      local Idx
      local CLogStartIdx
-      local CLogEndIdx
      local Pathname
      local Status
      local Cline
 
-          # Extract each package entry in ChangeLog.txt and store them in
-          # $WORKDIR/ChangeLog-packages.idx
-          #
-          # The output file is formatted as below :
-          #  <idx>:<pathname>: <status>
-          #
-          # <idx> is the line index of the entry in original ChangeLog.txt
-          # <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)
-          #
-          # [PENDING] this should be done only once when slackpkg update is called
-          #
-      grep -inE "$PKGREGEX" $WORKDIR/ChangeLog.txt > $WORKDIR/ChangeLog-packages.idx
-
      echo -n "" > $TMPDIR/Packages.clog
 
      for Cpkg in $(<$TMPDIR/dialog.out) ; do
 
        #  get infos about the current package from changeLog-packages.idx file, if any. The
        #  variable CpkgInfos is a string formatted as below:
-        #    <idx1>:<clogidx>:<pathname>: <status>
+        #    <clogidx>:<pathname>: <status>
        #
-        #  idx1=index of the line in changelog-packages.idx which match Cpkg
        #  clogidx=line index of the entry in ChangeLog.txt that match Cpkg
        #
-        CpkgInfos=( $(grep -n $Cpkg  $WORKDIR/ChangeLog-packages.idx | tr ":" " ") )
+        CpkgInfos=( $(grep $Cpkg  $WORKDIR/Unified-ChangeLog.idx | tr ":" " ") )
 
        if [ ! -z "$CpkgInfos" ] ; then
-          Idx=${CpkgInfos[0]}
-          CLogStartIdx=${CpkgInfos[1]}
-          Pathname=${CpkgInfos[2]}
-          Status=$(echo ${CpkgInfos[3]} | tr --delete " .")
+          CLogStartIdx=${CpkgInfos[0]}
+          Pathname=${CpkgInfos[1]}
+          Status=$(echo ${CpkgInfos[2]} | tr --delete " .")
 
          echo "$Pathname ($Status)" >> $TMPDIR/Packages.clog
 
          # extra information on package Cpkg can be found in ChangeLog.txt file
          # starting at line CLogStartIdx+1 and ending the line before the first
-          # line matching the regular expression SEPREGEX or PKGREGEX.
+          # line matching the regular expression CLOG_SEPREGEX or CLOG_PKGREGEX.
          #
-          # 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:
          #  +----------------------+
          #
-          # PKGREGEX match the "standard" changelog package entry, ie. a string
+          # CLOG_PKGREGEX match the "standard" changelog package entry, ie. a string
          # which starts with a package pathname followed by colon, one or more
          # space and the status. For instance:
          #  n/bind-1.2.3-x86_64-1.txz: Upgraded.
 
          ((CLogStartIdx++))
 
-          tail -n "+$CLogStartIdx" $WORKDIR/ChangeLog.txt | while read Cline ; do
-            if ! echo "$Cline" | grep -qiE "($SEPREGEX)|($PKGREGEX)" ; then
+          tail -n "+$CLogStartIdx" $WORKDIR/Unified-ChangeLog.txt | while read Cline ; do
+            if ! echo "$Cline" | grep -qiE "($CLOG_SEPREGEX)|($CLOG_PKGREGEX)" ; then
              echo -e "\t$Cline" >> $TMPDIR/Packages.clog
            else
              break
@@ -1153,7 +1192,11 @@
          echo "" >> $TMPDIR/Packages.clog
        fi
      done
-     
+
+      if [ ! -s $TMPDIR/Packages.clog ] ; then
+        echo "Sorry, no entry in the ChangeLog.txt matching the selected packages." > $TMPDIR/Packages.clog
+      fi
+
      dialog --title "ChangeLog" \
        --backtitle "slackpkg $VERSION" $HINT \
        --textbox $TMPDIR/Packages.clog 19 70

Hope this help.

--
Seb

zerouno 03-21-2016 04:03 PM

I'm sorry for the time, but I'm a lot occupied this period.

Yes, I like the Changelog for 3th party repository, even if just few repositories has useful information (well, when I wrote slackpkg+ there was few repositories with CHECKSUMS.md5 and very few with the GPG-KEY; today all have it) and not all Changelog files have a slackware-compatible format.

I dislike to search Changelog in parent directories becouse that means to go out the path specified from the user. I know the a lot o repositories have Changelog just in parent. So I think that we should add a setting in slackpkgplus.conf where the user explicitly allow to serch changelog in parent.

The 404 problem reported from wget I think that should be managed but it is to review later becouse we have a lot of downloader
1) wget
2) wgetdebug
3) cacheddownloader (that also use curl to retrieve the headers)
4) custom $DOWNLOADCMD

we have the same problem with some not existent MANIFEST.bz2 and other metadata that not all repositories have.

Also I want to reintroduce the function that we removed a lot of time ago, regarding the install-new working for multilib.
Everytime I run the install-new command I have to remember to run slackpkg install multilib; and if I have no a full slackware installation I have to remember which 32bit libraries I have to install. The idea is the same of years ago.. find for 32bit packages that have the corrispondent 64bit installed as setupmultilib.sh does.

phenixia2003 03-22-2016 08:19 AM

Hello,

Quote:

Originally Posted by zerouno (Post 5519351)
I'm sorry for the time, but I'm a lot occupied this period.

I understand and I see no problem with that.


Quote:

Originally Posted by zerouno (Post 5519351)
I dislike to search Changelog in parent directories becouse that means to go out the path specified from the user. I know the a lot o repositories have Changelog just in parent. So I think that we should add a setting in slackpkgplus.conf where the user explicitly allow to serch changelog in parent.

Something like that should do the trick :

1. add the variable SEARCH_CLOG_INPARENT which allows to define whether or not the 3rd party repository changelogs must be searched in parent:
Code:

# Defines if the changelog of any 3rd party repository must be searched in parent URL when not found in base URL.
 #
 # Can be set to "on" or "off" (default)
 #
SEARCH_CLOG_INPARENT=off

2. Once you have applied the patch I sent, replace the two lines below :
Code:

        BDNAMES=( $(echo $BASEDIR | tr "/" " ") )
        LIMIT=$(( ${#BDNAMES[@]} - 1 ))

by :
Code:

      LIMIT=1

      if [ "$SEARCH_CLOG_INPARENT" == "on" ] ; then
            BDNAMES=( $(echo $BASEDIR | tr "/" " ") )
            LIMIT=$(( ${#BDNAMES[@]} - 1 ))
      fi


Quote:

Originally Posted by zerouno (Post 5519351)
The 404 problem reported from wget I think that should be managed but it is to review later becouse we have a lot of downloader
1) wget
2) wgetdebug
3) cacheddownloader (that also use curl to retrieve the headers)
4) custom $DOWNLOADCMD

we have the same problem with some not existent MANIFEST.bz2 and other metadata that not all repositories have.

Ok.

Quote:

Originally Posted by zerouno (Post 5519351)
Also I want to reintroduce the function that we removed a lot of time ago, regarding the install-new working for multilib.
Everytime I run the install-new command I have to remember to run slackpkg install multilib; and if I have no a full slackware installation I have to remember which 32bit libraries I have to install. The idea is the same of years ago.. find for 32bit packages that have the corrispondent 64bit installed as setupmultilib.sh does.

Here is my point of view on this:
  • install-new should be left as is : dedicated to install new packages added to official slackware tree, and only that. Therefore, to install new packages from any other repository, slackpkg install <reponame> must be used instead.
  • Reintroducing install-new only for the multilib repository could be misunderstood by users. They could think that install-new works for all 3rd party repositories, and would not understand why the required package Y added to the repository R is not proposed by slackpkg.
  • As far as i remember, introducing install-new for all repositories is tricky, and anyway, could lead slackpkg to suggest a bunch of unexpected/undesired packages. So, doing that is not an option.


--
SeB

zerouno 04-10-2016 07:43 AM

Sorry for absence..
On my office I've currently double work to do and a lot to do on my house.

However if there are not other think to report, these days I will release beta5 with the only 3th party changelogs, and if it works well I think that we can release an rc release to freeze any other new feature and only fix current.
If someone has something to say, speak now or forever hold your peace :D

I have other ideas but I finished the time to elaborate it; I will add it in a further version.

I whould some feedback from who think to put slackpkg in her own repository and from who asked for a stable release.

My idea is to release slackpkg 1.7 stable before slackware 14.2 (that is currently -rc1) so to test it sufficiently to call it stable when slackware 14.2 will be release.

zerouno 04-11-2016 03:30 PM

I'm seeing the code for changelog and I found something to fix.

(aligned to latest patch excluding SEARCH_CLOG_INPARENT implementation)

* row 1284 and 1343
Code:

if $CLogOpt ; then
...
  cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
fi

Code:

                sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
CLogOpt is defined as CLOGopt
dialog.tmp does not ends with blank space so dialog.tmp.off is always == dialog.tmp


* row 1334
Code:

              if [ -s $TMPDIR/dialog.out ] ; then
                showChangeLogInfo $TMPDIR/dialog.out

if no packages are selected the selection dialogs return without an error, and the user think that it does not work.
I think that should appear a dialog with a similar of "Please, select at least a package"


* row 1187
Code:

              echo -e "\t$Cline" >> $TMPDIR/Packages.clog
changelog should not use tab becouse it has an anomaly when you scroll left<->right with the arrow keys.



Currently I've not tried all, but it is a great work.

Thankyou

phenixia2003 04-12-2016 03:13 AM

Quote:

Originally Posted by zerouno (Post 5529534)
I'm seeing the code for changelog and I found something to fix.

(aligned to latest patch excluding SEARCH_CLOG_INPARENT implementation)

* row 1284 and 1343
Code:

if $CLogOpt ; then
...
  cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
fi

Code:

                sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
CLogOpt is defined as CLOGopt

So the if $CLogOpt statement is always executed. Sorry. Just change it by if $CLOGopt ...

Quote:

Originally Posted by zerouno (Post 5529534)
dialog.tmp does not ends with blank space so dialog.tmp.off is always == dialog.tmp

Sorry, but I don't understand what you mean :
Code:

$ slackpkg upgrade kde-runtime kde-wallpapers kdelibs

Checking local integrity... DONE
Looking for kde-runtime kde-wallpapers kdelibs in package list. Please wait... DONE

(DEBUG) create dialog.tmp.off from dialog.tmp ...
(DEBUG) save /tmp/slackpkg.ewwQMv/{dialog.tmp,dialog.tmp.off} in /tmp


$ diff -u /tmp/dialog.tmp /tmp/dialog.tmp.off
--- /tmp/dialog.tmp    2016-04-12 09:34:20.148145646 +0200
+++ /tmp/dialog.tmp.off 2016-04-12 09:34:20.149145646 +0200
@@ -1,3 +1,3 @@
-kde-runtime-4.14.3-x86_64-2alien.txz "ktown" on "installed: kde-runtime-4.10.5-x86_64-1  -->  available: 4.14.3-2alien(ktown) , 4.10.5-1(slackware64) "
-kde-wallpapers-4.14.3-noarch-1alien.txz "ktown" on "installed: kde-wallpapers-4.10.5-noarch-1  -->  available: 4.14.3-1alien(ktown) , 4.10.5-1(slackware64) "
-kdelibs-4.14.6-x86_64-1alien.txz "ktown" on "installed: kdelibs-4.10.5-x86_64-2  -->  available: 4.14.6-1alien(ktown) , 4.10.5-2(slackware64) "
+kde-runtime-4.14.3-x86_64-2alien.txz "ktown" off "installed: kde-runtime-4.10.5-x86_64-1  -->  available: 4.14.3-2alien(ktown) , 4.10.5-1(slackware64) "
+kde-wallpapers-4.14.3-noarch-1alien.txz "ktown" off "installed: kde-wallpapers-4.10.5-noarch-1  -->  available: 4.14.3-1alien(ktown) , 4.10.5-1(slackware64) "
+kdelibs-4.14.6-x86_64-1alien.txz "ktown" off "installed: kdelibs-4.10.5-x86_64-2  -->  available: 4.14.6-1alien(ktown) , 4.10.5-2(slackware64) "

Quote:

Originally Posted by zerouno (Post 5529534)
* row 1334
Code:

              if [ -s $TMPDIR/dialog.out ] ; then
                showChangeLogInfo $TMPDIR/dialog.out

if no packages are selected the selection dialogs return without an error, and the user think that it does not work.
I think that should appear a dialog with a similar of "Please, select at least a package"

Right. This should do the trick :
Code:

  if [ -s $TMPDIR/dialog.out ] ; then
    showChangeLogInfo $TMPDIR/dialog.out
    ...
  else
    dialog --title "Changelog" --msgbox "Please, select at least one package." 5 40
    ...
  fi

Quote:

Originally Posted by zerouno (Post 5529534)
* row 1187
Code:

              echo -e "\t$Cline" >> $TMPDIR/Packages.clog
changelog should not use tab becouse it has an anomaly when you scroll left<->right with the arrow keys.

Maybe you can supersede it with 4 to 8 spaces.

--
SeB

zerouno 04-12-2016 09:03 AM

Quote:

Sorry, but I don't understand what you mean :
I have tried with slackpkg install, not upgrade.
There may have a different format.
I have not a pc now to test.

phenixia2003 04-12-2016 10:01 AM

Quote:

Originally Posted by zerouno (Post 5529889)
I have tried with slackpkg install, not upgrade.
There may have a different format.
I have not a pc now to test.

Ok, I didn't think about that. sorry.

So to fix the 1st problem, replace :

Code:

cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
by

Code:

          # in case of install, dialog.tmp is to the format (1), otherwise the format (2)
          # is used :
          #
          # format (1)
          #  <pkg-name> <repository> on|off
          # format (2)
          #  <pkg-name> <repository> on|off <installed-version> --> <available-version>

        if [ "$2" == "install" ] ; then
                cat $TMPDIR/dialog.tmp | sed "s/ on$/ off/g" > $TMPDIR/dialog.tmp.off
        else
                cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
        fi

and to fix the 2nd problem, replace :
Code:

                sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
by
Code:

                  # in case of install, dialog.tmp is to the format (1), otherwise the format (2)
                  # is used :
                  #
                  # format (1)
                  #  <pkg-name> <repository> on|off
                  # format (2)
                  #  <pkg-name> <repository> on|off <installed-version> --> <available-version>

                if [ "$2" == "install" ] ; then
                        sed -i -e "/^$PKGS_REGEX/ s= off$= on=" $TMPDIR/dialog.tmp
                else
                        sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
                fi

P.S: I think its better to have comments here to understand why we're doing that. However, you can get rid of one of the two if you want.


--
SeB

zerouno 04-15-2016 01:17 PM

slackpkg+-1.7.b4.1 released

I also removed some unuseful verbosity in cached_downloader for clarity and compact output. If you want some output set VERBOSE=2 or does not use the caching downoader

zerouno 04-20-2016 12:39 PM

May be useful to write - in the Unified-ChangeLog.idx - then repository name:

19127:slackpkgplus: pkg/slackpkg+-1.7.b4.2-noarch-2mt.txz: Rebuilt

zerouno 04-20-2016 03:38 PM

Only preparing the next slackpkg+ changelog I saw what we done in this release.
I needed a separated file to track all changes!!

A very thanks to all contributing with code, bug reporting, idea or comments!!!!

Now begins the bugfixing only.


Code:

== From 1.6 and 1.7 ==

*Configuration file:

- Added SEARCH_CLOG_INPARENT: available 'on'/'off'; default 'off'
  Allow/disallow to search ChangeLog.txt in parent url. May be unsafe.

- Added WW_FILE_SEARCH: available 'on'/'off'; default 'off'
  Allow you to enable or disable the Whole Word search in 'slackpkg file-search'

- Added DETAILED_INFO: available 'none'/'basic'/'filelist'; default 'none'
  Specify the verbosity of output in 'slackpkg info'.

- Added STRICTGPG: available 'on'/'off'; default 'on'
  Allow you to disable the Strict GPG Check. This is NOT SECURE, but some
  repository may need it.


*New features:

- slackpkg+ allow you to see the ChangeLog in dialog box.
    Now 'slackpkg update' download all ChangeLog.txt from all repositories (if
    available). Then when you go to in install/upgrade a package have a chance
    to read it before install the package. Note that the ChangeLog must be in
    the same Slackware changelog format. Some repository does not have the
    ChangeLog.txt in the main url but has it in a parent url. Be sure to set
    SEARCH_CLOG_INPARENT to 'on' to search it in parent. Note that ascend out
    of main url sometime may be unsafe; so if it does not work reset it to 'off'.

- slackpkg info allow you to see more details about the package.
    By default slackpkg info shows you the slackware metadata and package
    description. Set DETAILED_INFO to 'basic' and you can also see the
    repository and url. Set it to 'filelist' and you will see the full file
    listing in the package. Note that packages as kernel-source or other big
    packages give you a loooong list.

- slackpkg+ uses a Strict GPG Check for packages and metadata .asc files.
    This is a security fix.
    slackpkg was bird to install slackware packages from official mirrors; they
    are signed with the official slackware GPG-KEY, so no other packages may be
    added (unless you disable GPG check).
    slackpkg+ introduces the ability to download keys from many repositories; as
    implication, slackpkg+ allow also to copy packages from other repositories and
    the original signature; in this way a repository can contain a mix of packages
    that may confuse the user.
    Strict GPG check disallow users to do that. This improve the security.
    However some repository NEEDs the mixes of packages, so you can disable this
    function by setting STRICTGPG to 'off'

*Improvements

- Cached Download:
    Now it gives you a quick output for a most clear output.
    Now you can use it in slackpkg check-updates.
   
- Performance:
    slackpkg now is faster when search packages or prepare the package list in
    large install/upgrade

- slackpkg search:
    * If a package match in more than one repository, id did show just the package
    that had priority; now it show all matching packages from all repositories.
    It will mark as 'masked' the packages that would not selected in install/upgrade
    mode. Also always show repository source for official packages.
    * It does order the results by status and colors the output
    * It does search in dir:// repositories

   

- Graylist:
    Now it works for slackpkg remove and clean-system too (however it matches
    package name only, not match for repository name or package path)

- slackpkg check-updates:
    * Added spinning
    * Shows downloader output if VERBOSE=3
    * Does not more show notices about remember to run 'slackpkg update'

- slackpkg reinstall:
    Allow to choose the repository as in  install/upgrade; this becouse there are
    more than one repository containing packages with identical name.
 
- dir:// repositories:
    * dir:// repositories and inline repositories has most priority
    * slackpkg search does search in dir:// repositories
    * now dir:// allow subdirectories


*BugFixes

- slackpkg did give 'grep: write error' when running after "sudo su -"

- Fixed a bug on x86 hosts when a repository contains also x86_64 packages.

- Fixed a bug in slackpkg upgrade when used with $ROOT.

- Fixed Download Only feature when upgrade base packages (aaa_base, pkgtools...).

- Fixed a regression in SENSITIVE_SEARCH

- Fixed bad trap CTRL+C when spinning is on.

- Various fixes in TAG_PRIORITY functionality.

- slackpkg could corrupt the slackware database if running when there are
  some manual upgrades in progress.

- slackpkg search did not honour correctly the '+' character



*Various

- Repository name can contains letters, numbers, minus and underscore

- Added and fixed repositories; improved checkrepos.sh

- Code reordering; now slackpkg+ is only slackpkgplus.sh; removed zdialogplus.sh


phenixia2003 04-21-2016 09:07 AM

2 Attachment(s)
Hello,

Quote:

Originally Posted by zerouno (Post 5534076)
May be useful to write - in the Unified-ChangeLog.idx - then repository name:

19127:slackpkgplus: pkg/slackpkg+-1.7.b4.2-noarch-2mt.txz: Rebuilt

I guess you want to print the repository name in front of each entry displayed in the ChangeLog dialog.

I looked at this, but this would be too tricky to do with the current code because of the way files Unified-ChangeLog.txt and Unified-ChangeLog.idx are generated.

So to achieve this, I modified the code, so that, for each repository, there is a couple of files {<reponame>.txt, <reponame>.idx} stored in directory WORKDIR/ChangeLogs, and I updated the functions getfile() and showChangeLogInfo() accordingly.

the patch Attachment 21586 is for slackpkg+/dev 1.7.b4.2 :
Code:

--- slackpkgplus.sh.git.1.7.b4.2        2016-04-21 15:58:55.723360071 +0200
+++ slackpkgplus.sh        2016-04-21 15:58:55.723360071 +0200
@@ -564,18 +564,21 @@
    fi
    if [ $(basename $1) = "ChangeLog.txt" ];then
 
-      # ChangeLog.txt from slackware and 3rd party repository are merged
-      # into WORKDIR/Unified-ChangeLog.txt
-      #
-      # At this point, ChangeLog.txt from slackware has been already
-      # download and is stored in WORKDIR/ChangeLog.txt
+      # ChangeLog.txt from slackware and 3rd party repository are stored
+      # into WORKDIR/ChangeLogs directory
 
-      cat $WORKDIR/ChangeLog.txt > $WORKDIR/Unified-ChangeLog.txt
+      if [ -e ${WORKDIR}/ChangeLogs ] ; then
+        rm -f ${WORKDIR}/ChangeLogs/{*.txt,*.idx}
+      else
+        mkdir ${WORKDIR}/ChangeLogs
+      fi
+
+      # Copy slackware ChangeLog.txt into directory dedicated to changelogs...
+      cat $WORKDIR/ChangeLog.txt > $WORKDIR/ChangeLogs/slackware.txt
 
      for PREPO in ${REPOPLUS[*]}; do
-        echo "======== Repository: $PREPO ========" >>${WORKDIR}/Unified-ChangeLog.txt
        BASEDIR=${MIRRORPLUS[${PREPO/SLACKPKGPLUS_}]%}
-        CLOGNAM=ChangeLog-$PREPO.txt
+        CLOGNAM=$PREPO.txt
 
        LIMIT=1
 
@@ -604,24 +607,26 @@
        done
 
        if [ -s ${TMPDIR}/$CLOGNAM ] ; then
-          echo -e "                Merging ChangeLog.txt from repository $PREPO with Unified-ChangeLog.txt.\n"
-          cat ${TMPDIR}/$CLOGNAM >> ${WORKDIR}/Unified-ChangeLog.txt
+          echo -e "                Saving ChangeLog.txt from repository $PREPO ...\n"
+          cat ${TMPDIR}/$CLOGNAM >> ${WORKDIR}/ChangeLogs/$CLOGNAM
        else
          echo -e "                Repository $PREPO has no ChangeLog.txt.\n"
        fi
      done
 
-      # Extract each package entry in Unified-ChangeLog.txt and store them in
-      # $WORKDIR/Unified-ChangeLog.idx which is used by showChangeLogInfo()
+      # For each <reponame>.txt file in WORKDIR/ChangeLogs, create a corresponding
+      # <reponame>.idx which is used by showChangeLogInfo()
      #
      # The output file is formatted as below :
      #  <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)
      # <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" ${WORKDIR}/ChangeLogs/$PREPO.txt > ${WORKDIR}/ChangeLogs/$PREPO.idx
+      done
 
      for PREPO in ${REPOPLUS[*]};do
        # Not all repositories have the ChangeLog.txt, so I use md5 of CHECKSUMS.md5 instead
@@ -1168,33 +1173,42 @@
    function showChangeLogInfo() {
      local Cpkg
      local CpkgInfos
+      local CLogIdxFile
      local CLogStartIdx
      local Pathname
      local Status
      local Cline
+      local Repository
 
      echo -n "" > $TMPDIR/Packages.clog
 
      for Cpkg in $(<$TMPDIR/dialog.out) ; do
 
-        #  get infos about the current package from changeLog-packages.idx file, if any. The
-        #  variable CpkgInfos is a string formatted as below:
-        #    <clogidx>:<pathname>: <status>
+        #  get infos about the current package from *.idx files in WORKDIR/ChangeLogs,
+        #  if any. The  variable CpkgInfos is a string formatted as below:
+        #    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
-          CLogStartIdx=${CpkgInfos[0]}
-          Pathname=${CpkgInfos[1]}
-          Status=$(echo ${CpkgInfos[2]} | tr --delete " .")
-
-          echo "$Pathname ($Status)" >> $TMPDIR/Packages.clog
-
-          # extra information on package Cpkg can be found in ChangeLog.txt file
-          # starting at line CLogStartIdx+1 and ending the line before the first
-          # line matching the regular expression CLOG_SEPREGEX or CLOG_PKGREGEX.
+          CLogIdxFile=${CpkgInfos[0]}
+          CLogStartIdx=${CpkgInfos[1]}
+          Pathname=${CpkgInfos[2]}
+          Status=$(echo ${CpkgInfos[3]} | tr --delete " .")
+
+          # Get the repository name containing a changelog entry about the current
+          # package (ie Cpkg).
+          #
+          Repository=$(basename $CLogIdxFile .idx)
+
+          echo "$Repository::$Pathname ($Status)" >> $TMPDIR/Packages.clog
+
+          # 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
          # which start with a plus followed by dashes and a plus. For instance:
@@ -1207,7 +1221,7 @@
 
          ((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
              echo -e "    $Cline" >> $TMPDIR/Packages.clog
            else

Here is a screenshot of slackpkg with this patch in action :

Cheers.

--
SeB

zerouno 04-28-2016 03:00 AM

The ideas was to put repository name in Unified-ChangeLog.idx so to see it when opening manually that file, but it's a good idea to show it in dialog and put metadata in a dedicaded subdir.

I not jet merging that code, however I found a bug in the old code.

Code:

      #
      # At this point, ChangeLog.txt from slackware has been already
      # download and is stored in WORKDIR/ChangeLog.txt

      cat $WORKDIR/ChangeLog.txt > $WORKDIR/Unified-ChangeLog.txt

this is false.
In effect at this point the $WORKDIR contains the older changelog, so if you run slackpkg update after a slackware update you does not have the new slackware changes in Unified-ChangeLog.
The ChangeLog.txt is downloaded in $TMPDIR
Code:

2016-04-28 09:43:20 URL:http://ftp.osuosl.org/.2/slackware/slackware64-current/ChangeLog.txt [298373/298373] -> "/tmp/slackpkg.9fNs11/ChangeLog.txt" [1]
Also I think that the entire Unified-ChangeLog should be generated in $TMPDIR.
If you abort with ctrl+c the slackpkg update during changelog download, the older Unified-ChangeLog will be removed and the new is partial.

phenixia2003 04-28-2016 09:10 AM

Quote:

Originally Posted by zerouno (Post 5537701)
The ideas was to put repository name in Unified-ChangeLog.idx so to see it when opening manually that file, but it's a good idea to show it in dialog and put metadata in a dedicaded subdir.

I not jet merging that code.

So, do you plan to include it, or do you want to stick with older version with Unified-ChangeLog.{txt,idx} ?

Quote:

Originally Posted by zerouno (Post 5537701)
however I found a bug in the old code.

Oops, sorry.

Quote:

Originally Posted by zerouno (Post 5537701)
Code:

      #
      # At this point, ChangeLog.txt from slackware has been already
      # download and is stored in WORKDIR/ChangeLog.txt

      cat $WORKDIR/ChangeLog.txt > $WORKDIR/Unified-ChangeLog.txt

this is false.
In effect at this point the $WORKDIR contains the older changelog, so if you run slackpkg update after a slackware update you does not have the new slackware changes in Unified-ChangeLog.
The ChangeLog.txt is downloaded in $TMPDIR
Code:

2016-04-28 09:43:20 URL:http://ftp.osuosl.org/.2/slackware/slackware64-current/ChangeLog.txt [298373/298373] -> "/tmp/slackpkg.9fNs11/ChangeLog.txt" [1]

Ah, ok. In fact, on command "update", slackpkg calls updatefilelists() which calls checkchangelog(), so the ChangeLog.txt is downloaded in TMPDIR, then, when checkchangelog() returns, updatefilelists() copies ChangeLog.txt from TMPDIR into WORKDIR.


Quote:

Originally Posted by zerouno (Post 5537701)
Also I think that the entire Unified-ChangeLog should be generated in $TMPDIR.
If you abort with ctrl+c the slackpkg update during changelog download, the older Unified-ChangeLog will be removed and the new is partial.

In this case the Unified-ChangeLog.{txt,idx} (or files in ChangeLogs/) generated in TMPDIR by getfile() will need to be copied into WORKDIR before slackpkg exits. However, since we can't control when getfile() is called to download the ChangeLog file, we have 2 choices here :

1. Duplicate the code which handle the command "update" from original slackpkg, and add the required code to copy the ChangeLog from TMPDIR into WORKDIR :
Code:

    update)
                # If you are using "slackpkg update gpg" OR the system
                # doesn't have Slackware GPG key, download and install
                # the key
                #
                if [ "$UPARG" = "gpg" ] || [ "$GPGFIRSTTIME" = "0" ]; then
                        #
                        # Creates .gnupg directory if doesn't exist
                        # without this dir, gpg got an error.
                        #
                        if ! [ -e ~/.gnupg ]; then
                                mkdir ~/.gnupg
                        fi
                        getfile ${SOURCE}GPG-KEY $TMPDIR/gpgkey
                        gpg --yes --batch --delete-key "$SLACKKEY" &>/dev/null
                        gpg --import $TMPDIR/gpgkey &>/dev/null && \
                        echo -e "\t\t\tSlackware Linux Project's GPG key added"
                        if [ "$UPARG" = "gpg" ]; then
                                cleanup
                        fi
                fi
                echo "Updating the package lists..."
                updatefilelists

                # >> copy the ChangeLog from TMPDIR into WORKDIR
                cp $TMPDIR/Unified-ChangeLog.* $WORKDIR


                # exit to prevent original slackpkg to handle update command
                cleanup

2. copy the Unified-ChangeLog.{txt,idx} from TMPDIR into WORKDIR when the function cleanup() is called, unless this function is called in response to a CTRLC (ie. SIGINT) :
Code:

function cleanup() {
    local lEcode=$?

    if [ $lEcode -ne 130 ] && [ -e $TMPDIR/Unified-ChangeLog.txt ] ; then
        cp $TMPDIR/Unified-ChangeLog.{txt,idx} $WORKDIR
    fi

    ... original cleanup code here ...
}

Which solution do you want to implement ?

Another point which has nothing to do with the last changes.

This morning, when reading this thread, I've tried to run the command slackpkg search mozilla-firefox, but it returned nothing :
Code:

$ slackpkg search mozilla-firefox

Looking for mozilla-firefox in package list. Please wait... DONE

No package name matches the pattern.

However, the commands below show that firefox is installed, and referenced in slackpkg database. Furthermore, firefox is not blacklisted :
Code:

$ ls /var/log/packages/mozilla-firefox-38.6.1esr-x86_64-1_slack14.1
/var/log/packages/mozilla-firefox-38.6.1esr-x86_64-1_slack14.1

$ grep "mozilla-firefox" /var/lib/slackpkg/pkglist
patches mozilla-firefox 38.8.0esr x86_64 1_slack14.1 mozilla-firefox-38.8.0esr-x86_64-1_slack14.1 ./patches/packages txz
slackware64 mozilla-firefox 24.1.0esr x86_64 1 mozilla-firefox-24.1.0esr-x86_64-1 ./slackware64/xap txz
SLACKPKGPLUS_mleddesktop mozilla-firefox-langpack 38.7.1 x86_64 1_microlinux mozilla-firefox-langpack-38.7.1-x86_64-1_microlinux ./SLACKPKGPLUS_mleddesktop/slackware64/locale txz

So, I checked slackpkg+ code on github, and found that "search" works well until this commit. The problem comes from line #920 :

Code:

grep ${GREPOPTS} "^$DIR" $WORKDIR/pkglist|grep ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/\|/$SEARCHSTR/\|/$SEARCHSTR \| [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
This line fails because GREPOPTS include the option --word-regex and there are slashes in the regular-expression. However I don't understand the need of those slashes (in Bold RED). Can you explain this ?

Anyway, without these slash at line #920 :
Code:

grep ${GREPOPTS} "^$DIR" ${WORKDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "SLACKPKGPLUS_$SEARCHSTR|$SEARCHSTR|$SEARCHSTR | [^ ]*$SEARCHSTR[^ ]* " > $PKGINFOS
the command slackpkg search works as expected:
Code:

slackpkg search mozilla-firefox

Looking for mozilla-firefox in package list. Please wait... DONE

The list below shows all packages with name matching "mozilla-firefox".

[ Status          ] [ Repository              ] [ Package                                  ]
  uninstalled              mleddesktop                  mozilla-firefox-langpack-38.7.1-x86_64-1_microlinux 
  upgrade                  patches                      mozilla-firefox-38.6.1esr-x86_64-1_slack14.1 --> mozilla-firefox-38.8.0esr-x86_64-1_slack14.1 
  upgrade                  slackware64                  mozilla-firefox-38.6.1esr-x86_64-1_slack14.1 --> mozilla-firefox-24.1.0esr-x86_64-1 

You can search specific files using "slackpkg file-search file".

Hope this help.

--
SeB

zerouno 04-28-2016 09:33 AM

Now I've few time, so I reply quickly.


Quote:

Originally Posted by phenixia2003 (Post 5537830)
So, do you plan to include it, or do you want to stick with older version with Unified-ChangeLog.{txt,idx} ?

Yes, I will include it (so you can patch it directly)


Quote:

we have 2 choices here :
...
Which solution do you want to implement ?
I think that the second way (cleanup() modify) is the better way. There is already a similar use in that function:
Code:

    if [ "$CMD" == "update" ];then
      if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
        touch $WORKDIR/pkglist
      fi
    fi



[quote]
Code:

$ slackpkg search mozilla-firefox

Looking for mozilla-firefox in package list. Please wait... DONE

No package name matches the pattern.

Other users has experienced the same problem with the original slackpkg, but I have no time now to see the problem.



Quote:

Code:

grep ${GREPOPTS} "^$DIR" $WORKDIR/pkglist|grep ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/\|/$SEARCHSTR/\|/$SEARCHSTR \| [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
This line fails because GREPOPTS include the option --word-regex and there are slashes in the regular-expression. However I don't understand the need of those slashes (in Bold RED). Can you explain this ?

Anyway, without these slash at line #920 :
Code:

grep ${GREPOPTS} "^$DIR" ${WORKDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "SLACKPKGPLUS_$SEARCHSTR|$SEARCHSTR|$SEARCHSTR | [^ ]*$SEARCHSTR[^ ]* " > $PKGINFOS

Now I don't remember well, but with the '/' it searches only in url, without it, it search in repository too. I've to search the real reason, but I remember that there was a reason.

phenixia2003 04-29-2016 05:06 AM

1 Attachment(s)
Hello,

Quote:

Originally Posted by zerouno (Post 5537846)

Yes, I will include it (so you can patch it directly)

Attachment 21644


Cheers.

--
SeB

zerouno 05-02-2016 03:46 PM

uploaded.
Great work

gegechris99 05-05-2016 04:50 AM

Hello,

I've just upgraded to Slackware current. I cleaned up all third-party packages during the upgrade and I'm now slowly adding back some of them using stable slackpkg+ 1.6.1p2.

Everything is OK except for one package from alienBOB current repository: rhino-1_7R3-noarch-1alien.tgz

I get the error message when running "slackpkg install rhino":
Quote:

ERROR - Package not installed! md5sum error!
It's strange because I can install other packages from the repository (so it's not a GPG key issue). Also when I download manually the tgz, asc and md5 files, the checks are correct.

Could it be an issue with the stable version of slackpkg+?

zerouno 05-05-2016 05:02 AM

the tgz package is not failing.

If you see entire output you can see that fails the asc file.

Code:

2016-05-05 11:52:52 (45.6 MB/s) - '/var/cache/packages/./SLACKPKGPLUS_alienbob/rhino/rhino-1_7R3-noarch-1alien.tgz.asc' saved [198/198]

        ERROR - Package not installed! md5sum error!

is not a slackpkg+ problem; may be a problem in repository; contact Eric (that however should follow this thread)

Code:

$ wget http://bear.alienbase.nl/mirrors/people/alien/sbrepos/current/x86_64/CHECKSUMS.md5
--2016-05-05 11:59:47--  http://bear.alienbase.nl/mirrors/people/alien/sbrepos/current/x86_64/CHECKSUMS.md5
Resolving bear.alienbase.nl (bear.alienbase.nl)... 163.172.25.142
Connecting to bear.alienbase.nl (bear.alienbase.nl)|163.172.25.142|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 169841 (166K) [text/plain]
Saving to: 'CHECKSUMS.md5'

CHECKSUMS.md5                                100%[===============================================================================================>] 165.86K  89.2KB/s    in 1.9s   

2016-05-05 11:59:49 (89.2 KB/s) - 'CHECKSUMS.md5' saved [169841/169841]



$ wget http://bear.alienbase.nl/mirrors/people/alien/sbrepos/current/x86_64/rhino/rhino-1_7R3-noarch-1alien.tgz.asc
--2016-05-05 11:53:26--  http://bear.alienbase.nl/mirrors/people/alien/sbrepos/current/x86_64/rhino/rhino-1_7R3-noarch-1alien.tgz.asc
Resolving bear.alienbase.nl (bear.alienbase.nl)... 163.172.25.142
Connecting to bear.alienbase.nl (bear.alienbase.nl)|163.172.25.142|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 198 [text/plain]
Saving to: 'rhino-1_7R3-noarch-1alien.tgz.asc'

rhino-1_7R3-noarch-1alien.tgz.asc            100%[===============================================================================================>]    198  --.-KB/s    in 0s     

2016-05-05 11:53:26 (60.0 MB/s) - 'rhino-1_7R3-noarch-1alien.tgz.asc' saved [198/198]

root@rossini:~# md5sum rhino-1_7R3-noarch-1alien.tgz.asc
95daa4ecf38381032f401f5a576f3916  rhino-1_7R3-noarch-1alien.tgz.asc
$ grep rhino-1_7R3-noarch-1alien.tgz.asc CHECKSUMS.md5
d331cf2751e6e98cb0007b1a28ff20f3  ./rhino/rhino-1_7R3-noarch-1alien.tgz.asc


gegechris99 05-05-2016 05:52 AM

Thanks zerouno for the explanation.

I left a message on alienBOB blog to make sure he notices.

[EDIT]
rhino package has been updated in alienBOB repository. No more problem, I could upgrade the package using slackpkg.
[/EDIT]

zerouno 05-11-2016 02:25 AM

Quote:

Wed May 11 05:20:01 UTC 2016
ap/slackpkg-2.82.1-noarch-1.txz: Upgraded.
Updated x86* mirrors lists for Slackware 14.2.
it's the time to release a slackpkg+ rc.
:)

zerouno 05-19-2016 02:50 PM

rc1 is here

just some fix.
Please test it

Quote:

Version 1.7.0rc1 - 19/May/2016
- WW_FILE_SEARCH did affect file search AND package search
- fixed warning in update when one repository does not have the changelog
- ignore the package extension in package selection
- fixed a regression in dir: repository

zerouno 05-21-2016 08:41 AM

the regex for changelog detect does fail in some slackware update (Fri May 20 21:20:29 UTC 2016):

Code:

xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
+--------------------------+

in dialog does show
Code:

slackware::xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
    extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
    isolinux/initrd.img:  Rebuilt.
    kernels/*:  Upgraded.
    usb-and-pxe-installers/usbboot.img:  Rebuilt.

this should solve, but I dont known if it generate some regression:
Code:

--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -14,7 +14,8 @@ SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testin
 
  # CLOG_PKGREGEX : regular expression used to find package entry in ChangeLog files
  # CLOG_SEPREGEX : regular expression that match the "standard" entry separator in a ChangeLog file
-CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
+#CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
+CLOG_PKGREGEX="^[^ ]*:[ ]+(added|moved|rebuilt|upgraded)"
 CLOG_SEPREGEX="^[+][-]+[+][ ]*$"
 
 if [ -e $CONF/slackpkgplus.conf ];then


phenixia2003 what do you think?

phenixia2003 05-21-2016 02:13 PM

1 Attachment(s)
Hello,

Quote:

Originally Posted by zerouno (Post 5548673)
the regex for changelog detect does fail in some slackware update (Fri May 20 21:20:29 UTC 2016):

Code:

xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
+--------------------------+

in dialog does show
Code:

slackware::xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
    extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
    isolinux/initrd.img:  Rebuilt.
    kernels/*:  Upgraded.
    usb-and-pxe-installers/usbboot.img:  Rebuilt.


Quote:

Originally Posted by zerouno (Post 5548673)
this should solve, but I dont known if it generate some regression:
Code:

--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -14,7 +14,8 @@ SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testin
 
  # CLOG_PKGREGEX : regular expression used to find package entry in ChangeLog files
  # CLOG_SEPREGEX : regular expression that match the "standard" entry separator in a ChangeLog file
-CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
+#CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
+CLOG_PKGREGEX="^[^ ]*:[ ]+(added|moved|rebuilt|upgraded)"
 CLOG_SEPREGEX="^[+][-]+[+][ ]*$"
 
 if [ -e $CONF/slackpkgplus.conf ];then


phenixia2003 what do you think?


I'm ok with that. I did some tests with the attached script and all seems ok. This script downloads a slackware changelog, extract the packages informations using the old and new regex and show the diff (in vim) between these two set of data.

for instance, if you want to see the impact of the new regex for slackware64-current, run it as below :

Code:

$ sh show-clog-diff.sh.txt current 64
Downloading Slackware64-current ChangeLog.txt
extracting infos from ChangeLog64.current using NEW regex in Infos64-NEW-regex.current ...
    3351/3352                 
extracting infos from ChangeLog64.current using OLD regex in Infos64-OLD-regex.current ...
    3351/3352                 
prepare diff between Infos64-OLD-regex.current and Infos64-NEW-regex.current ...
hit return to see diff in vim ...

--
SeB

zerouno 05-21-2016 03:51 PM

You are what an italian people call "Pazzo scatenato" :D

the script has found a bug in changelog :)
Code:

n/openssl-1.0.1j-x86_64-1.tx:  Upgraded.
xap/seamonkey-2.26-x86_64-1.tx:  Upgraded.


I've readapted the script for thirdy party repository. It has found other bugs in other changelogs.

But as regression I intend another thing.

With the new regex we have many other things in .idx file.
slackware:
Code:

29:xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
30:extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
31:isolinux/initrd.img:  Rebuilt.

alienbob:
Code:

27:qt5-webkit: added v5.6.0 - this is a component of Qt5 which was split off
30:libxkbcommon: added v0.5.0 - a dependency for the qt5 package.
67:heimdall: Upgraded to 1.4.1 for Slackware 14.2. This package no longer

...

I don't think that this can cause problems or regressions in changelog search code but I must to consider that possibility.

phenixia2003 05-22-2016 05:48 AM

Quote:

Originally Posted by zerouno (Post 5548881)
You are what an italian people call "Pazzo scatenato" :D

:cool:

Quote:

Originally Posted by zerouno (Post 5548881)
the script has found a bug in changelog :)
Code:

n/openssl-1.0.1j-x86_64-1.tx:  Upgraded.
xap/seamonkey-2.26-x86_64-1.tx:  Upgraded.


The only way to prevent this is to change the expression used to build the index (see at the end of this post)


Quote:

Originally Posted by zerouno (Post 5548881)
I've readapted the script for thirdy party repository. It has found other bugs in other changelogs.

But as regression I intend another thing.

With the new regex we have many other things in .idx file.
slackware:
Code:

29:xap/vim-gvim-7.4.1832-i586-1.txz:  Upgraded.
30:extra/linux-4.4.11-nosmp-sdk/*:  Upgraded.
31:isolinux/initrd.img:  Rebuilt.

alienbob:
Code:

27:qt5-webkit: added v5.6.0 - this is a component of Qt5 which was split off
30:libxkbcommon: added v0.5.0 - a dependency for the qt5 package.
67:heimdall: Upgraded to 1.4.1 for Slackware 14.2. This package no longer

...

I don't think that this can cause problems or regressions in changelog search code but I must to consider that possibility.

This will cause no problems, nor regressions. showChangeLogInfos() uses the index to only get informations (start position in changelog, pathname, status) about the packages listed in file TMPDIR/dialog.out, which, contains package names (ie. basename-version-arch-build.t[gx]z) only. But, if you want to avoid this, you can use the "old" regular-expression to create the index at line #646-#648 (slackpkg/devel).

Current code:
Code:

646:for PREPO in slackware ${REPOPLUS[*]} ; do
647:    grep -inE "$CLOG_PKGREGEX" ${TMPDIR}/ChangeLogs/$PREPO.txt > ${TMPDIR}/ChangeLogs/$PREPO.idx
648:done

New code:
Code:

646:for PREPO in slackware ${REPOPLUS[*]} ; do
647:    grep -inE "[.]t[blxg]z?[ ]*[:][ ]+(added|moved|rebuilt|upgraded)" ${TMPDIR}/ChangeLogs/$PREPO.txt > ${TMPDIR}/ChangeLogs/$PREPO.idx
648:done

Note, that the regular expression above is a bit different from the one currently used by slackpkg+ :

1. I added "[ ]*" after "t[blxg]z" because I've found an entry (in slackware 13.0 changelog) which match this particular case.

2. the "z?" is to prevent the malformed entries, like those you mentioned earlier (ie.n/openssl-1.0.1j-x86_64-1.tx and xap/seamonkey-2.26-x86_64-1.tx: )

Code:

$ CLOG_PKGREGEX="[.]t[blxg]z[:][ ]+(added|moved|rebuilt|upgraded)"
$ CLOG_PKGREGEX_NEW="[.]t[blxg]z?[ ]*[:][ ]+(added|moved|rebuilt|upgraded)"
$ diff -u <(grep -inE "$CLOG_PKGREGEX" ChangeLog64.current) <(grep -inE "$CLOG_PKGREGEX_NEW" ChangeLog64.current)
--- /dev/fd/63  2016-05-22 12:49:46.250211376 +0200
+++ /dev/fd/62  2016-05-22 12:49:46.250211376 +0200
@@ -2938,6 +2938,7 @@
 5254:e/emacs-24.4-x86_64-1.txz:  Upgraded.
 5257:n/openssh-6.7p1-x86_64-1.txz:  Upgraded.
 5266:a/openssl-solibs-1.0.1j-x86_64-1.txz:  Upgraded.
+5268:n/openssl-1.0.1j-x86_64-1.tx:  Upgraded.
 5305:xap/mozilla-firefox-33.0-x86_64-1.txz:  Upgraded.
 5310:xap/mozilla-thunderbird-31.2.0-x86_64-1.txz:  Upgraded.
 5317:a/elilo-3.16-x86_64-1.txz:  Upgraded.
@@ -3215,6 +3216,7 @@
 6007:xap/ddd-3.3.12-x86_64-2.txz:  Rebuilt.
 6014:l/seamonkey-solibs-2.26-x86_64-1.txz:  Upgraded.
 6015:xap/mozilla-firefox-29.0.1-x86_64-1.txz:  Upgraded.
+6016:xap/seamonkey-2.26-x86_64-1.tx:  Upgraded.
 6023:a/glibc-solibs-2.19-x86_64-1.txz:  Upgraded.
 6024:a/glibc-zoneinfo-2014b-noarch-1.txz:  Upgraded.
 6025:a/kernel-firmware-20140506git-noarch-1.txz:  Upgraded.

Cheers.


--
SeB

zerouno 05-22-2016 05:58 AM

I've no a computer in this moment, but I don't think that we must manage the exceptions to the normality.

The best way is to report the bug to Patrick (but that problem is about two years old).
Sometime a user may not see a changelog, this is not a real problem.

zerouno 06-02-2016 05:18 PM

Patrik gave us a "Last call"
Quote:

This could be the last batch of updates before 14.2 stable, so please test!
I decided to reciprocate with a "Last Call" for slackpkg+1.7, so please test! :)

zerouno 06-03-2016 01:58 PM

Seems that
Code:

sed -e 1d -e 1iTEXT filename
does not means exactly "remove first line and insert TEXT instead it", so if both expressions start with the same number, the line is dropped instead replaced.
So if $LINEIDX == $PRIORITYIDX the selected package is dropped from pkglist in givepriority():
Code:

sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
They have a similar case when using "slackpkg upgrade file:./package-1-x86-1.txz"; the package is added on top of pkglist and that sed drop it.

Seems that
Code:

sed -e 1iTEXT -e 1d filename
does work, but I'm not sure that
Code:

sed --expression "${PRIORITYIDX}i${PKGDATA[*]}"  --expression "${LINEIDX}d" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
does work for any $PRIORITYIDX and for any $LINEIDX


currently I've solved with
Code:

if [ ${PRIORITYIDX} -ne ${LINEIDX} ];then
  mv ${TMPDIR}/pkglist ${TMPDIR}/pkglist.old
  sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
fi

since it is not useful to remove and reinsert the same line at the same point

zerouno 06-03-2016 05:30 PM

1 Attachment(s)
Do you like bash-completation?

install the bash-completation package, then copy following code in /etc/bash_completion.d/slackpkg the close and reopen the shell, then test and give me feedback.

Code:

# Slackware slackpkg(8) completion                            -*- shell-script -*-


_slackpkg()
{
    local cur prev words cword
    _init_completion || return

    local special i
    for (( i=0; i < ${#words[@]}-1; i++ )); do
        if [[ ${words[i]} == @(upgrade|install|remove|update) ]]; then
            special=${words[i]}
        fi
    done

    if [[ -n $special ]]; then
        case $special in
            upgrade|remove)
                COMPREPLY=( $( cd /var/log/packages; ls $cur*|rev|cut -f4- -d-|rev ) )
                return 0
                ;;
            update) COMPREPLY=( gpg )
              return 0
              ;;
            install)
                COMPREPLY=( $( cd /var/log/packages
                                grep "^[^ ]* $cur" /var/lib/slackpkg/pkglist|awk '{print $2}'|
                                      grep -v -f <(ls $cur*|rev|cut -f4- -d-|rev|sed -r "s/^/^/")
                            ) )
                return 0
                ;;
            update)
                COMPREPLY=( gpg )
                return 0
                ;;
        esac
    fi

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '
                                    -delall=off -checkmd5=off -checkgpg=off -checksize=on
                                    -postinst=off -onoff=off -download_all=off -dialog=off
                                    -batch=on -only_new_dotnew=on
                                    -use_includes=off -spinning=off -default_answer=yes
            ' -- "$cur" ) )
    else

        COMPREPLY=( $( compgen -W 'install remove search upgrade reinstall
                                    clean-system upgrade-all install-new
                                    search file-search
                                    info update new-config check-updates
                                    - ' -- "$cur" ) )

    fi

    return 0
} &&
complete -F _slackpkg slackpkg


phenixia2003 06-04-2016 12:21 PM

Hello,

Quote:

Originally Posted by zerouno (Post 5555429)
Seems that
Code:

sed -e 1iTEXT -e 1d filename
does work, but I'm not sure that
Code:

sed --expression "${PRIORITYIDX}i${PKGDATA[*]}"  --expression "${LINEIDX}d" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
does work for any $PRIORITYIDX and for any $LINEIDX

hmm, correct me if I'm wrong, but, if you insert before deleting, you should delete at LINEIDX+1 when PRIORITYIDX (ie. insert point) < LINEIDX (ie. delete point).


Quote:

Originally Posted by zerouno (Post 5555429)
currently I've solved with
Code:

if [ ${PRIORITYIDX} -ne ${LINEIDX} ];then
  mv ${TMPDIR}/pkglist ${TMPDIR}/pkglist.old
  sed --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist.old > ${TMPDIR}/pkglist
fi

since it is not useful to remove and reinsert the same line at the same point

I'm ok with that.

--
SeB

zerouno 06-04-2016 04:29 PM

Quote:

Originally Posted by phenixia2003 (Post 5555890)
hmm, correct me if I'm wrong, but, if you insert before deleting, you should delete at LINEIDX+1 when PRIORITYIDX (ie. insert point) < LINEIDX (ie. delete point).

The same that I thought. But seems that the new inserted lines are not considered by the other expressions.

No one of the following statement respect what I thought.
Code:

$ cat foo
a
b
c
d

$ cat foo|sed -e '3d' -e '1d'
b
d

(ok)

$ cat foo|sed -e '1d' -e '3d'
b
d

(expected 'b,c')

$ cat foo|sed -e '2ihello' -e 's/hello/world/'
a
hello
b
c
d

(expected 'a,world,b,c,d')

$ cat foo|sed -e '2ihello' -e 's/a/z/'
z
hello
b
c
d

(ok)

$ cat foo|sed  -e 's/a/z/' -e '2iaaa'
z
aaa
b
c
d

(ok)

$ cat foo|sed -e '2iaaa' -e 's/a/z/'
z
aaa
b
c
d

(expected 'z,zaa,b,c,d')

$ cat foo|sed  -e '2d' -e '1iz'       
z
a
c
d

(ok)

$ cat foo|sed  -e '1iz' -e '2d'
z
a
c
d

(expected 'z,b,c,d')

but the line number in the expression seems that just match the input file, not the manipulation. From 'man sed'
Quote:

number Match only the specified line number (which increments cumulatively across files, unless the -s option is specified on the
command line).
Well, today I learned another thing :)

Didier Spaier 06-04-2016 05:46 PM

Quote:

Originally Posted by zerouno (Post 5555990)
The same that I thought. But seems that the new inserted lines are not considered by the other expressions.

These lines are not inserted in the file, just written to standard output. The sed commands takes each line of the file as input, not a text written to standard output, so the sed commands have no effect on such text. In other words, the commands you use apply to the pattern space and the 'i' command doesn't write to the pattern space so no further command is applied to that text.

Quote:

No one of the following statement respect what I thought.
Code:

$ cat foo
a
b
c
d

$ cat foo|sed -e '3d' -e '1d'
b
d

(ok)

$ cat foo|sed -e '1d' -e '3d'
b
d

(expected 'b,c')

=> No. The '1d' command doedn't change the line numbering of the
  input file but deletes the pattern space and starts a new cycle.

$ cat foo|sed -e '2ihello' -e 's/hello/world/'
a
hello
b
c
d

(expected 'a,world,b,c,d')

=> No, as stated above "hello" is just output on your terminal,
  not to the pattern space, so the 's' command does nothing to it.

$ cat foo|sed -e '2ihello' -e 's/a/z/'
z
hello
b
c
d

(ok)

$ cat foo|sed  -e 's/a/z/' -e '2iaaa'
z
aaa
b
c
d

(ok)


$ cat foo|sed -e '2iaaa' -e 's/a/z/'
z
aaa
b
c
d

(expected 'z,zaa,b,c,d')

=> Again, 'aaa' is not written to the pattern space so no further command is applied to it.

$ cat foo|sed  -e '2d' -e '1iz'       
z
a
c
d

(ok)


$ cat foo|sed  -e '1iz' -e '2d'
z
a
c
d

(expected 'z,b,c,d')

=> No, that you write 'z' to stdout doen't change the numbering of lines of the input file,
  so the line that contains 'b' has still the #2 and thus is the one deleted

but the line number in the expression seems that just match the input file, not the manipulation. From 'man sed'


Well, today I learned another thing :)
IMO the right way to learn sed is not to read "man sed" but rather the POSIX specification. The same apply to other utilities as well as to the shell command language.

gegechris99 06-04-2016 05:55 PM

Quote:

Originally Posted by zerouno (Post 5555990)
but the line number in the expression seems that just match the input file, not the manipulation

Should you want to have the second sed expression applied to the result of the first one why not used a | ? It might be ugly but it works.

Code:

$ cat foo | sed -e '1d' | sed -e '3d'
b
c

Maybe a bit off-topic but I'm not sure that the quoted section of sed man page is relevant to your issue.

Quote:

number Match only the specified line number (which increments cumulatively across files, unless the -s option is specified on the
command line).
I'm no sed expert but my understanding of the above is relevant when you have more than one input file for the sed command as explained here.

Code:

$ cat foo
a
b
c
d
$ cat bar
e
f
g
$ sed -n '1,6p' foo bar
a
b
c
d
e
f
$ sed -n '1,2p' foo bar
a
b
$ sed -s -n '1,2p' foo bar
a
b
e
f


Didier Spaier 06-04-2016 06:07 PM

Quote:

Originally Posted by gegechris99 (Post 5556015)
Should you want to have the second sed expression applied to the result of the first one why not used a | ? It might be ugly but it works.

Code:

$ cat foo | sed -e '1d' | sed -e '3d'
b
c


It works but is overly complicated. Also, cat is useless. Just write instead:
Code:

sed -e '1d' -e '4d' foo
or:
Code:

sed '1d;4d' foo
And the order of the commands doesn't matter in this case so this works as well:
Code:

sed '4d;1d' foo

zerouno 06-05-2016 01:46 PM

1 Attachment(s)
Someone has tested bash completation?

here another version (copy as /etc/bash-completation/slackpkg)

Code:

# Slackware slackpkg(8) completion                            -*- shell-script -*-

                                                                                                                                                       
_slackpkg()                                                                                                                                           
{                                                                                                                                                     
    local cur prev words cword                                                                                                                         
    _init_completion || return                                                                                                                         
                                                                                                                                                       
    local special i wc                                                                                                                                 
    wc=${#words[@]}                                                                                                                                   
                                                                                                                                                       
    for (( i=0; i < ${#words[@]}-1; i++ )); do                                                                                                         
      if [[ ${words[i]} == @(install|remove|search|upgrade|reinstall|clean-system|upgrade-all|install-new|search|file-search|info|update|new-config|check-updates) ]]; then
        special=${words[i]}
        break
      fi
    done

    if [[ -n $special ]]; then
      case $special in
        upgrade|remove) COMPREPLY=( $( cd /var/log/packages; ls -- $cur* 2>/dev/null|rev|cut -f4- -d-|rev ) ) ;;
        update)  (( i++ )) ; (( wc-- )) ; [ $i -eq $wc ]&& COMPREPLY=( $( echo gpg|grep "^$cur" ) ) ;;
        search) COMPREPLY=( $( grep -- "$cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}'|grep -- "$cur" ) ) ;;
        info) COMPREPLY=( $( grep -- " $cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}'|grep -- "^$cur" ) ) ;;
        install) COMPREPLY=( $(cd /var/log/packages
                              grep "^[^ ]* $cur" /var/lib/slackpkg/pkglist 2>/dev/null|awk '{print $2}' |
                                      grep -v -f <(ls -- $cur* 2>/dev/null|rev|cut -f4- -d-|rev|sed -r -e "s/^/^/" -e "s/$/$/")
                            ) )
                ;;
        reinstall) [ ! -z "$cur" ]&& COMPREPLY=( $( cd /var/log/packages
                                grep "^[^ ]* $cur" /var/lib/slackpkg/pkglist 2>/dev/null|
                                      grep -f <(ls -- $cur* 2>/dev/null) |awk '{print $2}'
                            ) )
                ;;
        update) COMPREPLY=( gpg ) ;;
      esac
      return 0
    fi

    if [[ "$cur" == -* ]]; then
      COMPREPLY=( $( compgen -W '
                                    -delall=off -checkmd5=off -checkgpg=off -checksize=on
                                    -postinst=off -onoff=off -download_all=off -dialog=off
                                    -batch=on -only_new_dotnew=on
                                    -use_includes=off -spinning=off -default_answer=yes
            ' -- "$cur" ) )
    else

      COMPREPLY=( $( compgen -W '
                                    install remove search upgrade reinstall
                                    clean-system upgrade-all install-new
                                    search file-search
                                    info update new-config check-updates
                                    -
            ' -- "$cur" ) )

    fi

    return 0
} &&
complete -F _slackpkg slackpkg


Drakeo 06-05-2016 02:09 PM

Through the years Slackpkg has become KISS. after that it is well not Slack it is just to much work trying to tell people like I like it.
so create your own repo. Your a slacker that's what it is about. And KISS the the work away. Some times you just have to do it by your self.
:)

zerouno 06-06-2016 03:19 PM

slackpkg+ 1.7.0 is ready. I've just to reorder the changelog, adjust the slackbuild and my build/upload scripts.

Also I have to re-organize the github repository.
The proposal is the following: https://github.com/zuno/testplus
"devel" branch was removed and the "master" will be the main line (development) branch, as slackware-current does; and the branches "1.6" and "1.7" will be the stable packages (and the following backported patches from "master" branch)
This means that I must do a forced commit to rename master to 1.6 and devel to master.

However if I want to hold the current structure, the "devel" branch have to be merged in "master" branch, but the 'merge' command fails since the "stable" branch was merged in "master", so I must however do a forced commit with no-fastforward option (I'm not a git expert).

zerouno 06-07-2016 01:22 PM

Slackpkg+ 1.7.0 stable was released.

Currently http://slakfinder.org/slackpkg+/ contains the 1.6 and
http://slakfinder.org/slackpkg+dev/ contains the 1.7.0rc3
You can find the new version in http://slakfinder.org/slackpkg+1.7/


I ask you to test it by configuring the 1.7 repository for last minute bug (packaging or uploading bugs; remember that the 1.7 was bird as a more tested release before the official release).

this is the git branch https://github.com/zuno/slackpkgplus/tree/1.7

gegechris99 06-07-2016 04:07 PM

Thanks for the new stable version 1.7.0

I just installed it and ran an upgrade. It was OK and the changelog (from Slackware only for now) was correctly displayed.

Using the default values for the new parameters, I tested the file search with incomplete/complete word (upgradep/upgradepkg), the case-sensitive search (MPlayer, mplayer and Mplayer) and got the expected results.

The search of changelog.txt in parent directory for alienbob current repository worked. I'm just wondering if it's wise to show in the stderr log that there is an error when looking into the initial directory. I was a bit confused initially and thought that there was an issue with alienbob repository. Maybe the error message could be hidden and replaced by a warning when SEARCH_CLOG_INPARENT=on.

Here are cosmetic comments:
In slackpkgplus.conf:
- the default value of SEARCH_CLOG_INPARENT is not mentioned in the comments
- typo error in comments for STRICTGPG: heterogeneous
In README:
- there is no info for parameter SEARCH_CLOG_INPARENT

Finally, I don't understand the verb "bird" in
Quote:

1.7 was bird as a more tested release
or (in README)
Quote:

slackpkg was bird to install slackware packages from official mirrors
Could you please explain? If it's a technical term, I'm sorry for my lack of tech knowledge.

Thanks again to you and the other developers for this wonderful tool.


All times are GMT -5. The time now is 03:04 AM.