LinuxQuestions.org
Review your favorite Linux distribution.
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 01-24-2016, 02:34 AM   #451
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

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

Yes, spinning is useful for search, install, etc. I don't use slackpkg from many time and I forgot which functions use it.
My question regards the check-updates function.
 
Old 01-24-2016, 03:00 AM   #452
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
In my opinion, spinning also useful for check-updates, just as a activity indicator, and will keep the design of the application.
 
Old 01-24-2016, 02:06 PM   #453
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
Seems case (in)sensitive searching was broken again, so I pushed some commits on spinning and searching. Please check it.
For example, try with "slackpkg search ConsoleKit", it will not work when case-sensitive searching is disabled.
 
Old 01-24-2016, 04:31 PM   #454
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Code:
    # Show spinning if enabled:  
    touch ${TMPDIR}/waiting
    echo -n "Searching for updates... "
    [[ ! ${SPINNING} = "off" ]]; spinning ${TMPDIR}/waiting &
note that the ; must be &&
But better is
Code:
    if [[ ! ${SPINNING} = "off" ]];then
      echo -n "Searching for updates... "
      spinning ${TMPDIR}/waiting &
    fi
so if spinning is disabled it show nothing before ending.
The idea - and my doubt for spinning in check-updates - was that it is usually used in batch/cron scripts, where the user do not see nothing, and the output is parsed in a variable:
Code:
CHECK=$(slackpkg check-updates)
that should be modified in
Code:
CHECK=$(slackpkg -spinning=off check-updates)


Code:
grep ${GREPOPTS} "^$DIR" /var/lib/slackpkg/pkglist|......
my error. should be
Code:
grep ${GREPOPTS} "^$DIR" $WORKDIR/pkglist|......
 
Old 01-25-2016, 09:29 AM   #455
phenixia2003
Senior Member
 
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
Hello,

The spinning seems to cause troubles when user hit CTRL+C. In this case, slackpkg hangs and needs to be killed manually :

Code:
$ slackpkg upgrade-all

Checking local integrity... DONE
Looking for packages to upgrade. Please wait... ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^
C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^
C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C/
In fact, slackpkg+ hangs because of the statement "wait" in function cleanup() :
Code:
120-  function cleanup(){
121-    if [ "$CMD" == "update" ];then
122-      if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
123-        touch $WORKDIR/pkglist
124-      fi
125-    fi
126-    [ "$SPINNING" = "off" ] || tput cnorm
127-    if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
128-      rm $CACHEPATH/$NAMEPKG &>/dev/null
129-    fi
130:    wait
Without this statement, slackpkg+ can be stopped with CTRL+C :
Code:
$ slackpkg upgrade-all

Checking local integrity... DONE
Looking for packages to upgrade. Please wait... ^C
Another way, if the statement "wait" is required, is to delete the file ${TMPDIR}/waiting at start of cleanup(). Here is a patch to do that (for slackpkg+ dev/1.7b1) :

Code:
--- slackpkgplus.sh.git_1.7b1   2016-01-25 16:21:50.898399670 +0100
+++ slackpkgplus.sh     2016-01-25 16:21:50.898399670 +0100
@@ -118,6 +118,8 @@
     # Override cleanup() to improve log messages and debug functions
     #
   function cleanup(){
+    [ "$SPINNING" != "off" ] && rm -f ${TMPDIR}/waiting
+
     if [ "$CMD" == "update" ];then
       if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
         touch $WORKDIR/pkglist

--
SeB
 
Old 01-25-2016, 12:40 PM   #456
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
I've reworked the pull-request and splitted it into 2 new one, the first is for spinning and another for sensitive search fix.

Last edited by yars; 01-25-2016 at 01:22 PM.
 
Old 01-25-2016, 12:48 PM   #457
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
wait was added in 1.3.1 version, to wait the end of makeinstlog.sh; this feature was removed after a few and the 'wait' was not removed, so yes, it is not needed.
I think that we can both remove the wait statement and add the rm waiting (sometime in past I obtained that after an unclean exit, the spinning remained active out of slackpkg).
 
Old 01-25-2016, 01:35 PM   #458
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
@yars
thankyou for patch.
But I prefer to see and discuss it here, so next time please post patch here.
slackpkg+ is has monolitic code, so is many difficult manage it via github. I prefer apply patch manually. Specially when I've some unpushed commits.
Also I'm not an expert of git/github (I use it just to versioning and backup the code and keep it available from anywhere; no more)
 
Old 01-25-2016, 02:32 PM   #459
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
Thanks, ok, next time I will propose patches here. just in case, I attached these patches here.
 
Old 01-25-2016, 02:44 PM   #460
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
However for now seems that spinning in check-updates contains a bug due the >/dev/null 2>&1 when you press ctrl+c
it seems to not reset correctly the tty, so you must to run 'reset' manually to see the cursor.
removing >/dev/null 2>&1 to checkchangelog all works fine.

I made small needed adjustment.
Code:
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -118,6 +118,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     # Override cleanup() to improve log messages and debug functions
     #
   function cleanup(){
+    rm -f ${TMPDIR}/waiting
     if [ "$CMD" == "update" ];then
       if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
         touch $WORKDIR/pkglist
@@ -127,7 +128,6 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
       rm $CACHEPATH/$NAMEPKG &>/dev/null
     fi
-    wait
     if [ $VERBOSE -gt 2 ];then
       echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
       echo
@@ -877,6 +877,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
 
     touch ${TMPDIR}/waiting
+    echo -n "Looking for $PATTERN in package list. Please wait... "
+    [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
 
     [ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
 
@@ -945,11 +947,11 @@ if [ "$SLACKPKGPLUS" = "on" ];then
 
       done < $PKGINFOS
     done
+    rm ${TMPDIR}/waiting
     rm -f $PKGLIST $PKGINFOS
 
     LIST=$(echo -e $LIST | tr \  "\n" | uniq )
 
-    rm ${TMPDIR}/waiting
 
     echo -e "DONE\n"
   } # END function searchPackages()
@@ -1617,6 +1619,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     echo -n "" > ~/.slackpkg/updated-repos.txt
 
     UPDATES=false
+    
+    touch ${TMPDIR}/waiting
+    if [[ ! ${SPINNING} = "off" ]]; then
+      echo -n "Searching for updates... "
+      spinning ${TMPDIR}/waiting &
+    fi
+
     if [ $VERBOSE -eq 3 ];then
       checkchangelog
     else
@@ -1666,6 +1675,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
               
       [ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
     fi
+    rm -f ${TMPDIR}/waiting
     
     if $UPDATES ; then
       echo "News on ChangeLog.txt"
 
Old 01-25-2016, 03:04 PM   #461
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
this is a draft of the solution (see that).
Someone know a better solution?
Code:
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -118,16 +118,17 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     # Override cleanup() to improve log messages and debug functions
     #
   function cleanup(){
+    rm -f ${TMPDIR}/waiting
     if [ "$CMD" == "update" ];then
       if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
         touch $WORKDIR/pkglist
       fi
     fi
+    [ "$TTYREDIRECTION" ] && exec 1>&3 2>&4
     [ "$SPINNING" = "off" ] || tput cnorm
     if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
       rm $CACHEPATH/$NAMEPKG &>/dev/null
     fi
-    wait
     if [ $VERBOSE -gt 2 ];then
       echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
       echo
@@ -877,6 +878,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
 
     touch ${TMPDIR}/waiting
+    echo -n "Looking for $PATTERN in package list. Please wait... "
+    [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
 
     [ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
 
@@ -945,11 +948,11 @@ if [ "$SLACKPKGPLUS" = "on" ];then
 
       done < $PKGINFOS
     done
+    rm ${TMPDIR}/waiting
     rm -f $PKGLIST $PKGINFOS
 
     LIST=$(echo -e $LIST | tr \  "\n" | uniq )
 
-    rm ${TMPDIR}/waiting
 
     echo -e "DONE\n"
   } # END function searchPackages()
@@ -1617,10 +1620,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     echo -n "" > ~/.slackpkg/updated-repos.txt
 
     UPDATES=false
+    
+    touch ${TMPDIR}/waiting
+    if [[ ! ${SPINNING} = "off" ]]; then
+      echo -n "Searching for updates... "
+      spinning ${TMPDIR}/waiting &
+    fi
+
     if [ $VERBOSE -eq 3 ];then
       checkchangelog
     else
+      exec 3>&1 4>&2
+      TTYREDIRECTION=1
       checkchangelog >/dev/null 2>&1
+      TTYREDIRECTION=""
+      exec 1>&3 2>&4
     fi
     if [ $? -ne 0 ]; then
     
@@ -1666,6 +1680,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
               
       [ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
     fi
+    rm -f ${TMPDIR}/waiting
     
     if $UPDATES ; then
       echo "News on ChangeLog.txt"

Last edited by zerouno; 01-25-2016 at 03:13 PM.
 
Old 01-25-2016, 03:27 PM   #462
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
That is a variant to keep the spinning until the output in slackpkg search where there are many many packages. But I'm not sure to keep it.

When I run slackpkg search slackware there are many results. At the end of search the spinning is stopped, but searchlistEX does a lot of think, piped to a 'sort' command.
This may take a lot, and during this time the user does not have the spinning.

This patch add it.
However there are not many case on which search give long output.
Most useful may be in slackpkg upgrade-all that sometime can take a lot (and that is another process that I want try do speedup).

Code:
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -118,16 +118,17 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     # Override cleanup() to improve log messages and debug functions
     #
   function cleanup(){
+    rm -f ${TMPDIR}/waiting
     if [ "$CMD" == "update" ];then
       if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
         touch $WORKDIR/pkglist
       fi
     fi
+    [ "$TTYREDIRECTION" ] && exec 1>&3 2>&4
     [ "$SPINNING" = "off" ] || tput cnorm
     if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
       rm $CACHEPATH/$NAMEPKG &>/dev/null
     fi
-    wait
     if [ $VERBOSE -gt 2 ];then
       echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
       echo
@@ -877,6 +878,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
 
     touch ${TMPDIR}/waiting
+    echo -n "Looking for $PATTERN in package list. Please wait... "
+    [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
 
     [ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
 
@@ -945,13 +948,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
 
       done < $PKGINFOS
     done
+    #rm ${TMPDIR}/waiting
     rm -f $PKGLIST $PKGINFOS
 
     LIST=$(echo -e $LIST | tr \  "\n" | uniq )
 
-    rm ${TMPDIR}/waiting
 
-    echo -e "DONE\n"
+    #echo -e "DONE\n"
   } # END function searchPackages()
 
   #### ===== PRIORITY AND SEARCH FUNCTIONS ===== #####
@@ -1586,6 +1589,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     PATTERN=$(echo $ARG | sed -e 's/\+/\\\+/g' -e 's/\./\\\./g' -e 's/ /\|/g')
     searchPackages $PATTERN
 
+    OUTPUT="$(
     case $CMD in
       search)
         if [ "$LIST" = "" ]; then
@@ -1607,6 +1611,10 @@ if [ "$SLACKPKGPLUS" = "on" ];then
         fi
       ;;
     esac
+    )"
+    rm $TMPDIR/waiting
+    echo "DONE"
+    echo "$OUTPUT"
 
     cleanup
   fi # "$CMD" == "search" / "file-search"
@@ -1617,10 +1625,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
     echo -n "" > ~/.slackpkg/updated-repos.txt
 
     UPDATES=false
+    
+    touch ${TMPDIR}/waiting
+    if [[ ! ${SPINNING} = "off" ]]; then
+      echo -n "Searching for updates... "
+      spinning ${TMPDIR}/waiting &
+    fi
+
     if [ $VERBOSE -eq 3 ];then
       checkchangelog
     else
+      exec 3>&1 4>&2
+      TTYREDIRECTION=1
       checkchangelog >/dev/null 2>&1
+      TTYREDIRECTION=""
+      exec 1>&3 2>&4
     fi
     if [ $? -ne 0 ]; then
     
@@ -1666,6 +1685,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
               
       [ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
     fi
+    rm -f ${TMPDIR}/waiting
     
     if $UPDATES ; then
       echo "News on ChangeLog.txt"
 
Old 01-25-2016, 04:20 PM   #463
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
I found that if I'm doing an upgrade with upgradepkg manually and during this time I run slackpkg upgrade-all (to have a preview of future updates), slackpkg may damage the /var/log/packages
This becouse the sanity_check() not only CHECK the integrity, but try to recover it automatically.
Code:
  for i in $(ls -1 $ROOT/var/log/packages | \
    egrep -- "^.*-(${ARCH}|fw|noarch)-[^-]+-upgraded"); do
    REVNAME=$(echo ${i} | awk -F'-upgraded' '{ print $1 }')
    mv $ROOT/var/log/packages/${i} $ROOT/var/log/packages/${REVNAME}
    mv $ROOT/var/log/scripts/${i} $ROOT/var/log/scripts/${REVNAME}
  done
To avoid it I want to add a check to see if there are pkgtools running.
Code:
  if ps -ef|grep -q -w -e upgradepkg -e installpkg -e removepkg;then
    echo "FATAL! You may have an upgrade in progress"
    echo "Please try later"
    cleanup
  fi
But this is not sufficient. It also match a "vi upgradepkg.sh" for example, or the user had run ROOT=/chroot upgradepkg ..., that does not conflict with slackpkg. I tried to check the content of /var/log/setup/tmp (this should be always empty). But it may be not-empty becouse a previous failed upgrade, or it may be empty becouse upgradepkg did start to write into it. Another way is to check for *:* in /var/log/packages, but upgradepkg may take a lot before create it.

Some suggests?
 
Old 01-25-2016, 07:13 PM   #464
bamunds
Member
 
Registered: Sep 2013
Location: Mounds View MN
Distribution: Slackware64-14.2-Multilib XDM/FVWM3
Posts: 780

Rep: Reputation: 260Reputation: 260Reputation: 260
I'm wondering if I screwed up something in my config or if an older version of slackpkg+ config. Then again it is more likely my lack of understanding patches in relation to standard installed packages.

I was looking for an upgrade/patch to apr and found that the official repository of packages/patches has apr-1.5.0. However, if I run slackpkg search apr then apr-1.5.0 shows uninstalled. slackpkg info apr shows information for both 1.5.0 and 1.4.6 (the original 14.1 package.) This seemed weird so I thought check /var/log/packages and it shows in /var/log/removed_packages/apr-1.4.6 upgraded on 2015-03-09 (the date I installed 14.1-64 and did an update for patches per the install instructions). If I look in /var/log/packages there is no apr package or apr-util package. Then I thought what else isn't updating. Next on the patches list is bash to version 4.2.053. If I run slackpkg info bash, I see both 4.2.053 and 4.2.045,slackpkg search only show 4.2.053 as uninstalled, while /var/log/removed_packages/bash-4.2.045-x86_64-upgraded 2015-03-09.19:40:01. Running "bash --version" shows 4.2.53(2)-release. So the bash 4.2.53 version is installed due to a upgrade on March 9 of 2015. Now I'm totally confused, why does slackpkg search show it uninstalled?

I did some investigation into where does slackpkg.conf store it's files. It seems that slackpkg uses /var/lib/slackpkg and if I look there I see archives for all my slackpkgplus repositories, along with patches, pasture, extra, and testing. But I notice LASTUPDATE file not changed since 2015-03-09. How would I know if that is correct?

I have been using slackpkg+ since shortly after install. So,at this point it appears I have no apr or apr-util installed on my system. Yes I simply can install them again, no big deal. But I want to know why they were uninstalled, should they be installed and updated to patches level, and if there is a way to get slackpkg search to properly show the packages installed. BTW, I have seen security patches installed with a slackpkg upgrade-all in the last year, but it seems inconsistent and I have sometimes had to type the specific file name as in the security mailing list notice. Yes there is a lot I do not understanding about the patches and how and when they are suppose to be installed, a reference to how to learn that would be appreciated since I'm still learning in this first year of using Slackware 64 14.1 on a desktop.

My questions:
1) should I find all patches installed on my system, or only those that are actively being used?
2) should /var/lib/slackpkg/LASTUPDATE show the date of the last slackpkg(+) update?
3) is there a command to update the slackpkgplus search db (is it looking in /var/log/packages vs the online repository) so it properly shows the installed packages?
4) if all should be installed, then what part of slackpkg.conf or slackpkgplus.conf should be configured to assure their installation?
5) I did try the command slackpkg install slackware which responded with "No packages match the pattern for install." Which is what slackpkg upgrade-all also responds. This command is suppose to install every package of slackware available in the official repositories. Any clue what I should check for why the patches are showing as uninstalled for installed packages?
If either my currect slackpkg.conf or slackpkgplus.conf files are needed please let me know.

UPDATE: If I run "slackpkg install patches" it will find all the patches available and offer to install them for me. So getting all the patches installed was simple once I realized that I could do a search on a repository. But what I'm not sure about is if this is how it should work?

Last edited by bamunds; 01-25-2016 at 10:36 PM.
 
Old 01-26-2016, 01:33 AM   #465
zerouno
Member
 
Registered: Oct 2009
Location: Italy
Distribution: Slackware
Posts: 983

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
I cannot investigate now, but you can see slackpkg+ activities in /var/lib/slackpkg/install.log
 
  


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 03:46 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