LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-10-2016, 11:26 AM   #496
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352

I wrote a script that does a full dist-upgrade.

This is useful when
1) I must do a distribution upgrade
2) I want trasform a non-full to a full installation

The idea is that
1) the install-new command just install packages added from latest stable
2) many files are presents in more than one package and in more than one repository
3) when I have two packages with different name in two different repositories, the upgrade of a package override the other that may be unwanted; for example when you install ktown5 you should uninstall kscreen becouse ktown5 has kscreen2; if you do not that, when slackware upgrade kde4 kscreen override kscreen2 even if it is in PKGS_PRIORITY. This script avoid it.

The script does
1) slackpkg install-new
2) slackpkg install all missing packages in PKGS_PRIORITY and patches and slackware repositories
3) slackpkg upgrade-all
4) slackpkg remove packages not in PKGS_PRIORITY or patches or slackware (so it remove extra and other REPOPLUS repository not in PKGS_PRIORITY)
5) check if packages installed at step 3 did some override some not opportune override
6) slackpkg clean-system
7) slackpkg new-config

I can add optionally the check of conflicts package installed previously; this take many time to run since has to test all packages, but it's the only way to repair a previous bad upgrade (tipically a large slackpkg upgrade as kde upgrade when there is ktown installed).

dist-upgrade.sh :
Code:
#!/bin/bash


slackpkg update

#SLACKPKGOPTS="-dialog=off -batch=on -default_answer=n"

CONF=${CONF:-/etc/slackpkg}

#TMPDIR=$(mktemp -p /tmp -d distupg.XXXXXX 2>/dev/null)
TMPDIR=/tmp/distupg
mkdir -p $TMPDIR
cd $TMPDIR
rm -f *

SLACKWARE_VERSION=$(cat /etc/slackware-version | cut -f2 -d\ )
SOURCE=$(sed -e 's/^[[:blank:]]*//' $CONF/mirrors | grep -m1 -e "^\([a-z]\)")
. $CONF/slackpkg.conf
. $CONF/slackpkgplus.conf



PKGS_PRIORITY=( ktown restricted_current:vlc )

( cd $ROOT/ ; ls -1tr ./var/log/packages/* ) | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist



SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"


cp $WORKDIR/pkglist ${TMPDIR}/pkglist-ori


PKGS_PRIORITY=( ${PKGS_PRIORITY[@]} patches slackware slackpkgplus )
for pp in ${PKGS_PRIORITY[@]} ; do
  repository=$(echo "$pp" | cut -f1 -d":")
  if [ "$pp" == "$repository" ];then
    package=".*"
  else
    package=$(echo "$pp" |cut -f2- -d":")
  fi
  if ! echo "$repository" | grep -qwE "$SLACKDIR_REGEXP" ; then
    repository=SLACKPKGPLUS_${repository}
  fi

  if grep -q "^${repository}[ ]" $WORKDIR/pkglist 2>/dev/null ; then
    NEW_PRIORITY=( ${NEW_PRIORITY[*]} $repository:$package )
    cat $WORKDIR/pkglist|grep -E "$repository $package " >> ${TMPDIR}/pkglist
  fi
done
echo ${NEW_PRIORITY[*]}

cat ${TMPDIR}/pkglist |awk '{if(!i[$2]++)print $0}' > ${TMPDIR}/pkglist-single


cat ${TMPDIR}/pkglist-single|sort -i |awk '{print "<",$6,$2}'  >$TMPDIR/toinstall
cat ${TMPDIR}/tmplist       |sort -i |awk '{print ">",$6,$2}'  >$TMPDIR/installed

cat installed toinstall |sort -k2|uniq -f1 -d|sort -k2 > $TMPDIR/ok
cat installed toinstall |sort -k2|uniq -f1 -u|sort -k2|uniq -f2 -D > $TMPDIR/upgrade
cat installed toinstall |sort -k2|uniq -f1 -u|sort -k2|uniq -f2 -D|grep '>' > $TMPDIR/upgrade-from
cat installed toinstall |sort -k2|uniq -f1 -u|sort -k2|uniq -f2 -D|grep '<' > $TMPDIR/upgrade-to
cat installed toinstall |sort -k2|uniq -f1 -u|sort -k2|uniq -f2 -u|grep '>' > $TMPDIR/remove
cat installed toinstall |sort -k2|uniq -f1 -u|sort -k2|uniq -f2 -u|grep '<' > $TMPDIR/add

echo "Install-new"

slackpkg $SLACKPKGOPTS -postinst=off install-new

echo "Upgrading"

slackpkg $SLACKPKGOPTS -postinst=off upgrade-all
#slackpkg -batch=on -dialog=off -default_answer=no upgrade-all
if [ ! -e ${WORKDIR}/pkglist ];then
  cp ${TMPDIR}/pkglist-ori ${WORKDIR}/pkglist
fi

echo "Install-all"

slackpkg $SLACKPKGOPTS -postinst=off install $(cat $TMPDIR/add|awk '{print $2}')
#slackpkg -batch=on -dialog=off -default_answer=no install $(cat $TMPDIR/add|awk '{print $2}')

echo "Remove"

slackpkg $SLACKPKGOPTS -postinst=off remove $(cat $TMPDIR/remove|awk '{print $2}')
#slackpkg -batch=on -dialog=off -default_answer=no remove $(cat $TMPDIR/remove|awk '{print $2}')


echo "Search conflicts"
cd /var/log/packages

r=""
for p in `ls -t`;do 
  echo -en "\r $p                "
  if grep -q $p $TMPDIR/upgrade-to;then
    echo "  Upgraded"
    D="$(cat $p|grep -v ' ' |grep /|grep -v /$|grep -v ^install/|sed -e 's/^/^/' -e 's/$/$/'|grep -f - *|grep -v ^$p:|sed 's/:/ /')"
    D="$(echo "$D"|awk '{print $1}'|sort -u)"
    echo "  Conflicts:" $D
    for c in $D;do
      echo -n "    $c "
      E=$(grep -e " $p " -e " $c " $TMPDIR/pkglist|head -1|awk '{print $6}')
      R=$(grep -e " $p " -e " $c " $TMPDIR/pkglist|awk '{print $1}'|sort -u|wc -l)
      if [ $R -eq 1 ];then
        echo "ok ($c and $p are on the same repository)"
      elif [ "$E" == "$p" ];then 
        echo "ok ($E is in priority)"
      elif [ $c -nt $p ];then
        echo "ok ($c is the latest installed)"
      else
        echo "to reinstall"
        r="$r $c"
      fi
    done
  fi
done
echo -e "\r                                               "

t=$(
for p in $r;do
  echo $p
done|sort -u
)

if [ ! -z "$t" ];then
  echo "To reinstall: $t"
  slackpkg $SLACKPKGOPTS -postinst=off reinstall $t
fi

echo

echo "To Clean"

slackpkg $SLACKPKGOPTS -postinst=off clean-system


echo "Postconf"
slackpkg new-config

echo "You may run $0 two times"
what do you think?
 
Old 02-10-2016, 11:57 AM   #497
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
Quote:
Originally Posted by zerouno View Post
what do you think?
I wouldn't use it. I would feel a lot safer using one of the known to work documented methods (either following UPGRADE.TXT or http://docs.slackware.com/howtos:sla...:systemupgrade), after having taken notes about all third party packages that I have installed, databases and such.

Actually I am even more comfortable doing a fresh installation, then installing the new versions of the third party packages and checking that they work, copying my data, eventually moving only when everything works as expected in the new system.

IMHO too much automation hurts. I am afraid that if users less knowledgeable than you use it, you will receive more support requests than you can handle.

Last edited by Didier Spaier; 02-10-2016 at 11:59 AM.
 
5 members found this post helpful.
Old 02-21-2016, 07:32 AM   #498
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
feature to show the url of package and full filelist in slackpkg info.

What do you think?

Code:
# DETAILED_INFO=yes slackpkg info slackpkg+

PACKAGE NAME:  slackpkg+-1.7.b2-noarch-1mt.txz
PACKAGE MIRROR:  http://www.slakfinder.org/slackpkg+dev/
PACKAGE LOCATION:  ./pkg
PACKAGE SIZE (compressed):  32 K
PACKAGE SIZE (uncompressed):  160 K
PACKAGE DESCRIPTION:
slackpkg+: slackpkg+ plugin for third-party repositories
slackpkg+:
slackpkg+: Slackpkg is a package manager for Slackware. 
slackpkg+:
slackpkg+: Slackpkg+ is a plugin for slackpkg.
slackpkg+:   It adds support for third-party repositories.
slackpkg+:   You can install, upgrade and search from multiple repositories.
slackpkg+:
slackpkg+:
slackpkg+:
slackpkg+:


Package:    slackpkg+-1.7.b2-noarch-1mt
Repository: slackpkgplus
Path:       ./pkg/slackpkg+-1.7.b2-noarch-1mt.txz
Url:        http://slakfinder.org/slackpkg+dev/pkg/slackpkg+-1.7.b2-noarch-1mt.txz
Code:
# DETAILED_INFO=filelist slackpkg info slackpkg+

PACKAGE NAME:  slackpkg+-1.7.b2-noarch-1mt.txz
PACKAGE MIRROR:  http://www.slakfinder.org/slackpkg+dev/
PACKAGE LOCATION:  ./pkg
PACKAGE SIZE (compressed):  32 K
PACKAGE SIZE (uncompressed):  160 K
PACKAGE DESCRIPTION:
slackpkg+: slackpkg+ plugin for third-party repositories
slackpkg+:
slackpkg+: Slackpkg is a package manager for Slackware. 
slackpkg+:
slackpkg+: Slackpkg+ is a plugin for slackpkg.
slackpkg+:   It adds support for third-party repositories.
slackpkg+:   You can install, upgrade and search from multiple repositories.
slackpkg+:
slackpkg+:
slackpkg+:
slackpkg+:

Package:    slackpkg+-1.7.b2-noarch-1mt
Repository: slackpkgplus
Path:       ./pkg/slackpkg+-1.7.b2-noarch-1mt.txz
Url:        http://slakfinder.org/slackpkg+dev/pkg/slackpkg+-1.7.b2-noarch-1mt.txz
Filelist:
  ./
  etc/
  etc/slackpkg/
  etc/slackpkg/notifymsg.conf.new
  etc/slackpkg/greylist.new
  usr/
  usr/doc/
  usr/doc/slackpkg+-1.7.b2/
  usr/doc/slackpkg+-1.7.b2/slackpkgplus.x86.sample
  usr/doc/slackpkg+-1.7.b2/slackpkg+.SlackBuild
  usr/doc/slackpkg+-1.7.b2/checkrepos.sh
  usr/doc/slackpkg+-1.7.b2/setupmultilib.sh
  usr/doc/slackpkg+-1.7.b2/slackpkgplus.x86_64.sample
  usr/doc/slackpkg+-1.7.b2/ChangeLog.txt
  usr/doc/slackpkg+-1.7.b2/README
  usr/doc/slackpkg+-1.7.b2/repositories.lst
  usr/doc/slackpkg+-1.7.b2/repositories.txt
  usr/libexec/
  usr/libexec/slackpkg/
  usr/libexec/slackpkg/functions.d/
  usr/libexec/slackpkg/functions.d/slackpkgplus.sh
  usr/libexec/slackpkg/makeinstlog.sh
  install/
  install/doinst.sh
  install/slack-desc

Code:
diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh
index 07191e6..4695169 100755
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -114,10 +114,37 @@ if [ "$SLACKPKGPLUS" = "on" ];then
   ##### ====== END BLACKLIST FUNCTIONS === #####
 
   ##### ====== INSTALL/POSTINSTALL FUNCTIONS ====== #####
+  function more_info(){
+    echo
+    cat $WORKDIR/pkglist|grep -E "^[^ ]* $NAME "|while read repository name version arch tag namepkg fullpath ext;do
+      echo "Package:    $namepkg"
+      echo "Repository: ${repository/SLACKPKGPLUS_/}"
+      echo "Path:       ${fullpath/\/SLACKPKGPLUS_${repository/SLACKPKGPLUS_/}/}/$namepkg.$ext"
+      URLFILE=${SOURCE}${fullpath}/${namepkg}.${ext}
+      if echo $URLFILE|grep -q /SLACKPKGPLUS_;then
+        PREPO=$(echo $URLFILE|sed -r 's#^.*/SLACKPKGPLUS_([^/]+)/.*$#\1#')
+        URLFILE=$(echo $URLFILE|sed "s#^.*/SLACKPKGPLUS_$PREPO/#${MIRRORPLUS[$PREPO]}#")
+      fi
+      echo "Url:        ${URLFILE/.\//}"
+      if [ "$DETAILED_INFO" == "filelist" ];then
+        FILELIST="$(zgrep ^${fullpath/\/${repository}/}/$namepkg.$ext $WORKDIR/$repository-filelist.gz 2>/dev/null)"
+        if [ -z "$FILELIST" ];then
+          echo "Filelist:   no file list available"
+        else
+          echo "Filelist:"
+          echo "$FILELIST"|sed "s/ /\n/g"|tail +2|sed 's/^/  /'
+        fi
+      fi
+      echo
+    done
+  }
 
     # Override cleanup() to improve log messages and debug functions
     #
   function cleanup(){
+    if [ "$CMD" == "info" ];then
+      [[ "$DETAILED_INFO" != "none" ]]&&more_info
+    fi
     rm -f ${TMPDIR}/waiting
     if [ "$CMD" == "update" ];then
       if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
 
Old 02-21-2016, 04:36 PM   #499
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
I do not see the need for one more front-end when for instance the file list can already be displayed several ways: pkgtool => view or "most /var/log/packages/<package name>".

“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).
 
1 members found this post helpful.
Old 02-21-2016, 04:50 PM   #500
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Yes, I agree, but the var/log/packages contains just the installed packages.
For all other I must download it then tar tvf it or grep in /var/lib/slackpkg

Who use slackpkg & slackpkg+ WANT a frontend. There are other frontend for that?
 
Old 03-02-2016, 02:14 PM   #501
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
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}:.* )
 
Old 03-06-2016, 09:47 AM   #502
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
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?
 
Old 03-08-2016, 06:35 AM   #503
gegechris99
Senior Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 15.0 64bit
Posts: 1,159
Blog Entries: 5

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Quote:
Originally Posted by zerouno View Post
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.
 
Old 03-08-2016, 12:11 PM   #504
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
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...
 
Old 03-08-2016, 01:03 PM   #505
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
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 ).
 
1 members found this post helpful.
Old 03-10-2016, 11:10 AM   #506
phenixia2003
Senior Member
 
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
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 :

Click image for larger version

Name:	slackpkg-changelog-1.png
Views:	41
Size:	77.3 KB
ID:	21108

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

Click image for larger version

Name:	slackpkg-changelog-textbox.png
Views:	42
Size:	53.6 KB
ID:	21109

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

Click image for larger version

Name:	slackpkg-changelog-2.png
Views:	41
Size:	77.3 KB
ID:	21110


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

slackpkgplus-1.7.b3-changelog-ext.diff.txt
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
 
1 members found this post helpful.
Old 03-13-2016, 04:03 PM   #507
bamunds
Member
 
Registered: Sep 2013
Location: Mounds View MN
Distribution: Slackware64-14.2-Multilib XDM/FVWM3
Posts: 780

Rep: Reputation: 260Reputation: 260Reputation: 260
Zerouno, do you want slackpkg+ "stable: questions/troubles here or in a separate thread?
 
Old 03-13-2016, 04:13 PM   #508
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by Didier Spaier View Post
“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.
 
Old 03-13-2016, 04:23 PM   #509
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Originally Posted by bamunds View Post
Zerouno, do you want slackpkg+ "stable: questions/troubles here or in a separate thread?
Here's the best place.
 
Old 03-14-2016, 02:06 PM   #510
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Originally Posted by phenixia2003 View Post
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.
 
  


Reply

Tags
slackpkg



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Holding a package update from slackpkg gazj Slackware 2 01-25-2011 04:58 PM
Where can I find a 3rd Party Repository for RHEL 5? tightlikethat Linux - Newbie 3 02-27-2010 08:46 PM
Best 3rd Party RPM Repository for FC9 kromberg Fedora 11 11-13-2008 08:04 PM
Package Kit Error-- "Cannot retrieve repository metadata (repomd.xml) for repository" mbvpixies78 Linux - Newbie 11 08-22-2008 07:20 PM
3rd party package managers? crontab Slackware 3 10-06-2007 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration