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/)

gegechris99 11-22-2015 01:27 PM

Thanks zerouno for the quick fix.

"slackpkg upgrade-all" works again for me.

bam80 11-28-2015 12:02 PM

Hi zerouno, others, thank you for the slackpkg+ tool.

I have some questions/suggestions:
1. Wouldn't it be good idea to support some basic error codes returning in slackpkg+ (may be slackpkg restriction though)? They are really missing in batch processing..
2. The repo priority seems has no affect to "slackpkg upgrade-all" invocation. It shows all updates regardless priority of repos they are from. So I can't do automatic batch updates, which is frustrating. Could we make priority feature wider to support not only single package updates, but "slackpkg upgrade-all" and "slackpkg upgrade <repo>" also? Maybe as an option?

Thank you

zerouno 11-28-2015 12:27 PM

Quote:

Originally Posted by bam80 (Post 5456494)
1. Wouldn't it be good idea to support some basic error codes returning in slackpkg+ (may be slackpkg restriction though)? They are really missing in batch processing..

for example? which type of error code do you expect?
Quote:

2. The repo priority seems has no affect to "slackpkg upgrade-all" invocation. It shows all updates regardless priority of repos they are from. So I can't do automatic batch updates, which is frustrating. Could we make priority feature wider to support not only single package updates, but "slackpkg upgrade-all" and "slackpkg upgrade <repo>" also? Maybe as an option?
slackpkg upgrade-all should use the same priority as if you do a single slackpkg upgrade.

if no there is a bug.
Please give me some example (and post your configuration file).

bam80 11-28-2015 02:23 PM

Quote:

Originally Posted by zerouno (Post 5456503)
for example? which type of error code do you expect?

As most programs do, I expect '0' on success and not '0' on errors.
For example, if network is down,
"slackpkg -batch=on update"
should NOT return '0'

Quote:

Originally Posted by zerouno (Post 5456503)
slackpkg upgrade-all should use the same priority as if you do a single slackpkg upgrade.

if no there is a bug.
Please give me some example (and post your configuration file).

Oops, it was my fault, sorry. I was using wrong 'ktown' repo (current vs 14.1), which eventually became almost empty, so it cause that effect with "slackpkg upgrade-all". Thank you

What else missing for me, is the ability to auto-choose the most recent package among all repositories. I.e., repos can't have equal priority.
It's how slapt-get works, and I find it useful.
Could it be implemented in addition to current functionality?

zerouno 11-28-2015 04:43 PM

Quote:

Originally Posted by bam80 (Post 5456542)
For example, if network is down,
"slackpkg -batch=on update"
should NOT return '0'

I never used the batch option, so I don't know it.
slackpkg+ does not return error codes because slackpkg does not do that (I remember that slackpkg+ is only an extension, not the tool). But in case of failures it writes details of the error in stdout, so you can grep it.
However if may be good upgrade slackware in batch mode I do not encourage to do that with third-party repositories.

Quote:

What else missing for me, is the ability to auto-choose the most recent package among all repositories. I.e., repos can't have equal priority.
It's how slapt-get works, and I find it useful.
Could it be implemented in addition to current functionality?
slackpkg+ CAN NOT do that because it MUST NOT do that. There was in a testing version a similar function to detect if a package is newer than another, but it was removed because it has no sense and is dangerous.

1) is not possible know which package is newer because every packages uses a different standard (numeric, alfanumeric, have version.subversion.subsubversion, etc..)
2) more than a time Pat done some package DOWNGRADE due problems with new version
3) if you install a package from a specific repository you SHOULD install the update from the same repository and if you want install a newer version from another repository you must to verify some (in)compatibility. For example if you install today vlc 2.2.1 from alienbob repository. Tomorrow you will found vlc 2.2.2 in slacky repository; if you install automatically it, it will not works because the slacky version require that you install the codecs that Eric include builtin in vlc.

slackpkg was bird as a non-slackware package (the official package is on sourceforge), then it was adopted from Pat because it respects the original slackware philosofy, i.e. you must know what do you want to do before do that.
slackpkg+ was bird to not broke that. It does not substitute the human's brain. You need to known what package you want to install and you should choose your prefered repository.
I've in mind many features and options for slackpkg+, but 99% of these broke this philosofy, that is what makes slackware unique.

gegechris99 11-28-2015 04:44 PM

Quote:

Originally Posted by bam80 (Post 5456542)
What else missing for me, is the ability to auto-choose the most recent package among all repositories. I.e., repos can't have equal priority.
It's how slapt-get works, and I find it useful.
Could it be implemented in addition to current functionality?

How would you define the most recent package when a package version is not self-evident?

For example:
dhcp: 4.2.5_P1
iputils: s20121221
xf86-video-xgi: git_be3abf8570a

EDIT: zerouno was quickier :)

bam80 11-28-2015 05:46 PM

@zerouno
Thank you for the explanations.

But maybe it worth leave an OPTION to not trying downgrade my already manually (or slapt-get) installed packages which I already have checked and verified for (in)compatibility?
As you said - it should not substitute my brain ;)

@gegechris99
for example,
I would see if considered installed package is present in non-prefered repo, then assume it was installed manually and should not be auto-selected in 'upgrade-all' list (but include it unselected is OK)

bassmadrigal 11-28-2015 05:50 PM

Quote:

Originally Posted by bam80 (Post 5456607)
But maybe it worth leave an OPTION to not trying downgrade my already manually (or slapt-get) installed packages which I already have checked and verified for (in)compatibility?
As you said - it should not substitute the my brain ;)

If you are upgrading packages outside of repos then you should blacklist those packages. I have 455 packages blacklisted on my system, mainly due to recompiling X and KDE.

zerouno 11-28-2015 05:52 PM

See the greylist function.

bam80 11-28-2015 06:14 PM

@bassmadrigal,
not outside - all the repos are known to slackpkg+, I just installed from "not prefered" ones..

@zerouno,
I wouldn't say that greylist function is good option for this, because it static one. But what I suggest is some kind of dynamic greylist, based on if there is another repo the installed package version belongs to.
It's too much work to maintain the list manually while in most simple cases it could be done automatically.

Well, if nobody wants it, I will not insist..

gegechris99 11-29-2015 03:21 AM

Quote:

Originally Posted by bam80 (Post 5456619)
@bassmadrigal,
not outside - all the repos are known to slackpkg+, I just installed from "not prefered" ones..

@bam80
If I understand correctly, you have repo#1 with more priority than repo#2 but you have installed package pkgA from repo#2 and you don't want pkgA from repo#1 to replace this package.

This can already be managed with option PKGS_PRIORITY.

For example, I have two external repositories: "alienbob" and "mled" and I want "mled" to be my preferred one (i.e. packages from this repository should be installed instead of those from alienbob). However there are exceptions, I want these two packages from "alienbob" repository : flashplayer-plugin and libreoffice.

PKGS_PRIORITY would be set like this:

Code:

PKGS_PRIORITY=( alienbob:flashplayer-plugin alienbob:libreoffice mled:.* )

phenixia2003 11-29-2015 04:15 AM

Hello,

Quote:

Originally Posted by gegechris99 (Post 5456759)
@bam80
If I understand correctly, you have repo#1 with more priority than repo#2 but you have installed package pkgA from repo#2 and you don't want pkgA from repo#1 to replace this package.

This can already be managed with option PKGS_PRIORITY.

For example, I have two external repositories: "alienbob" and "mled" and I want "mled" to be my preferred one (i.e. packages from this repository should be installed instead of those from alienbob). However there are exceptions, I want these two packages from "alienbob" repository : flashplayer-plugin and libreoffice.

PKGS_PRIORITY would be set like this:

Code:

PKGS_PRIORITY=( alienbob:flashplayer-plugin alienbob:libreoffice mled:.* )

You can also use the option TAG_PRIORITY (which is off by default) to automatically give priority to updates according the repositories from which the installed versions come from.

--
SeB

zerouno 11-29-2015 04:31 AM

For you own compiled packages consider the 'dir:' format repositories (see README)

You can put all compiled package in a directory on your filesystem /path/to/my/packages/

then set
MIRRORPLUS['personal']=dir:/path/to/my/packages/
and
PKGS_PRIORITY=( personal )

after compiling a package put it in that directory.
everytime you run slackpkg upgrade/upgrade-all, if a package is in that directory slackpkg+ will not search in other repositories. If you have no the package becouse already installed, simply create an empty file:
touch /path/to/my/package/mypackage-1.0-x86_64-1personal.txz

You do not need slackpkg update everytime you put a file in that directory.

Use this way for a dynamic blacklist.

zerouno 12-15-2015 01:18 PM

Quote:

Originally Posted by phenixia2003 (Post 5453220)
Hello,



This is a slackpkg+ bug, caused by the second grep statement at line #415. This (troublesome) statement has been added earlier to support version number in priority rules (ie. <repository-name>:<package-name>-<version>), which is, correct me if I'm wrong, useless, since a repository should not include more than one version of a package.

The patch Attachment 20106 fixes this issue:
Code:

-        if echo "$ARGUMENT" | grep -q "$PAT" || echo "$PAT" | grep "^$ARGUMENT" ; then
+        if echo "$ARGUMENT" | grep -q "$PAT" ; then


Finally I found a lot of time to review that.
I cannot apply this patch, otherwise return the problem descripted at page4.

Well, there is not sense that a repository contains two version of the same package, but it's common that a user can type
slackpkg install alienbob:vlc-2.2.1-i486-4alien
by copy and pasting the full package name, even if the repository contains only a version of vlc.

In this case, removing the 'echo "$PAT" | grep "^$ARGUMENT"' slackpkg fails and install vlc from 'restricted' repository that have a package with the same name, version and build.


Also it fails to select the repository even if you type
slackpkg install alienbob:vlc-2
i.e. a subversion.


However, yes, the 'echo "$PAT" | grep "^$ARGUMENT"' statement should be removed, but must to be replaced with some other thing.

phenixia2003 12-16-2015 11:34 AM

1 Attachment(s)
Hello,

Quote:

Originally Posted by zerouno (Post 5464631)
Finally I found a lot of time to review that.
I cannot apply this patch, otherwise return the problem descripted at page4.

Well, there is not sense that a repository contains two version of the same package, but it's common that a user can type
slackpkg install alienbob:vlc-2.2.1-i486-4alien
by copy and pasting the full package name, even if the repository contains only a version of vlc.

In this case, removing the 'echo "$PAT" | grep "^$ARGUMENT"' slackpkg fails and install vlc from 'restricted' repository that have a package with the same name, version and build.


Also it fails to select the repository even if you type
slackpkg install alienbob:vlc-2
i.e. a subversion.


However, yes, the 'echo "$PAT" | grep "^$ARGUMENT"' statement should be removed, but must to be replaced with some other thing.

givepriority() does not work as it should, and furthermore the command slackpkg install|upgrade reponame:packagename is a bit bugged.

1. About slackpkg install|upgrade reponame:packagename bug

If you configure slackpkg+ to use repositories alienbob and restricted, the command slackpkg install restricted:ms-sys returns :

Code:

$ slackpkg -dialog=off install restricted:ms-sys returns :
Looking for ms-sys in package list. Please wait...
DONE

ms-sys-2.2.1-x86_64-1alien.tgz

Total package(s): 1

Do you wish to install selected packages (Y/n)? n

But, this result is wrong and mislead the user. The proposed package is from alienbob repository not from restricted repository which has no package ms-sys !

To prevent this, I slightly modified how slackpkg+ acts in case of command slackpkg install|upgrade reponame:packagename :
Code:

slackpkg -dialog=off install restricted:ms-sys
Looking for restricted:ms-sys in package list. Please wait...
DONE

No packages match the pattern for install. Try:

        /usr/sbin/slackpkg reinstall|upgrade

2. the new givepriority()[indent]
I reviewed the function givepriority() to get rid of the faulty statement (ie. echo $PAT | grep ^$ARGUMENT) and to ensure that commands like slackpkg install restricted:vlc-2 work as expected. For instance, with PKGS_PRIORITY=(multilib alienbob restricted) :

Code:

slackpkg -dialog=off install restricted:vlc-2 restricted:npapi-vlc-20150301-x86_64-1alien

Looking for vlc-2 npapi-vlc-20150301-x86_64-1alien in package list. Please wait...
DONE

[ Repository              ] [ Package                                  ]
  restricted                  vlc-2.2.1-x86_64-1alien.txz             
  restricted                  npapi-vlc-20150301-x86_64-1alien.txz     

Total package(s): 2

Do you wish to install selected packages (Y/n)?

Important:

when the command slackpkg install|upgrade <param> is executed, slackpkg use the grep option -w to identify packages that match param and pass their basenames to givepriority(). But, because of option -w, param must be a whole word (ex: ffmpeg, 2.2.1), otherwise, the search will fail.

For instance, slackpkg -dialog=off install restricted:vl fails, while slackpkg -dialog=off install restricted:vlc-2.2.1 works :

Code:

$ slackpkg -dialog=off install restricted:vl

Looking for restricted:vl in package list. Please wait...
install|upgrade|reinstall: ARGUMENT is restricted:vlc-2.
DONE

No packages match the pattern for install. Try:

        /usr/sbin/slackpkg reinstall|upgrade

3. the function showlist()

As you can see in examples above, when the option -dialog=off is passed, slackpkg prints the repository to which the packages belong. To achieve this, I copied, from core-functions.sh, the function showlist(), and, I modified it accordingly.
4. The patch (for slackpkg+ 1.5.1 build 2mt) :Attachment 20302
Code:

--- slackpkgplus.sh.orig        2015-12-16 18:16:19.166699694 +0100
+++ slackpkgplus.sh        2015-12-16 18:16:19.166699694 +0100
@@ -405,18 +405,13 @@
        DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
        PAT=$(echo "$CPRIORITY" | cut -f2- -d":")
 
-        # ARGUMENT is always a basename. But PAT can be:
-        #  1. a regular expression (ie .*)
-        #  2. a basename (openjdk)
-        #  3. a partial (or complete) package name (vlc-2.0.6, ).
-        #
-        # The current "enhanced priority rule" is applied :
-        #  + In case (1) and (2) when ARGUMENT contains the pattern PAT
-        #  + In the case (3) when ARGUMENT starts the pattern PAT.
-        #
-        if echo "$ARGUMENT" | grep -q "$PAT" || echo "$PAT" | grep "^$ARGUMENT" ; then
-          PKGDATA=""
-          PKGINFOS=$(grep -n -m 1 "^${DIR} ${ARGUMENT} " ${TMPDIR}/pkglist)
+        # [Reminder] ARGUMENT is always a basename, but PAT can be :
+        #    1. a basename (ie. gcc, glibc-solibs)
+        #    2. a regular expression (ie. .*)
+        #    3. a (in)complete package name (ie. vlc-2, vlc-2.0.6, 1.0.3)
+        #
+        PKGDATA=""
+        PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT}")
 
          if [ ! -z "$PKGINFOS" ] ; then
            LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
@@ -428,7 +423,6 @@
              sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
              (( PRIORITYIDX++ ))
          fi
-        fi
      else
        PKGDATA=( $(grep "^${CPRIORITY} ${ARGUMENT} " ${TMPDIR}/pkglist) )
      fi
@@ -583,6 +577,44 @@
    done
  } # END searchlistEX()
 
+  # Supersede original showlist() from core-functions.sh
+  #
+  # Show the lists and asks if the user want to proceed with that action
+  # Return accepted list in $SHOWLIST
+  #
+  # This version show the repository to which each package belongs.
+  #
+function showlist() {
+  local ANSWER
+  local i
+  local SHOWREPO=false
+  local REPONAME
+
+  if echo "$CMD" | grep -qE "install|reinstall|upgrade|upgrade-all" ; then
+        printf "[ %-24s ] [ %-40s ]\n" "Repository" "Package"
+        SHOWREPO=true
+  fi
+
+  for i in $1; do
+          if $SHOWREPO ; then
+                REPONAME=$(grep -m 1 "${i%.*}" $TMPDIR/pkglist | cut -f1 -d" " | sed "s/SLACKPKGPLUS_//")
+                printf "  %-24s    %-40s  \n" "$REPONAME" "$i"
+        else
+                echo $i;
+        fi
+  done | $MORECMD
+  echo
+  countpkg "$1"
+  echo -e "Do you wish to $2 selected packages (Y/n)? \c"
+  answer
+  if [ "$ANSWER" = "N" -o "$ANSWER" = "n" ]; then
+        cleanup
+  else
+        SHOWLIST="$1"
+        continue
+  fi
+}
+
    # Ensure each repository url has a trailing slash...
    #
  for PREPO in "${!MIRRORPLUS[@]}" ; do
@@ -982,18 +1014,38 @@
        REPOPLUS=( ${repository} ${REPOPLUS[*]} )
        package=SLACKPKGPLUS_$repository
 
-      # You can specify 'slackpkg install reponame:packagename'
+      # You can specify 'slackpkg install reponame:pattern'
      elif echo "$pref" | grep -q "[a-zA-Z0-9]\+[:][a-zA-Z0-9]\+" ; then
 
        if [ "$CMD" == "install" ] || [ "$CMD" == "upgrade" ] ; then
          repository=$(echo "$pref" | cut -f1 -d":")
-          package=$(echo "$pref" | cut -f2- -d":")
+          pattern=$(echo "$pref" | cut -f2- -d":")
 
          if ! echo "$repository" | grep -qwE "$SLACKDIR_REGEXP" ; then
            repository="SLACKPKGPLUS_${repository}"
          fi
 
-          PRIORITYLIST=( ${PRIORITYLIST[*]} ${repository}:$package )
+                # Ensure there is (at least) one package matching the request in
+                # the given repository, otherwise, slackpkg could select package(s)
+                # outside the given repository.
+                #
+                # For instance, without this test, in case of two repository A and B
+                # where A includes a package named X, while B has no packages X, the
+                # command 'slackpkg install B:X' will select A:X instead, which can
+                # mislead users.
+                #
+                # reminder: cut -f6 -d" " is used to extract the column "name of packages"
+
+          if grep "^${repository} " ${WORKDIR}/pkglist | cut -f6 -d" " | grep -qw "${pattern}" ; then
+                package="${pattern}"
+                PRIORITYLIST=( ${PRIORITYLIST[*]} ${repository}:$package )
+          else
+                #There is no package matching the given pattern, therefore,
+                # package is set to pref (ie repository:pattern), so that,
+                # slackpkg must return no candidat in this case. To achieve this
+                # package is set to reponame:repository.
+                package="${pref}"
+          fi
        fi
 
      # You can specify 'slackpkg install reponame' where reponame is a thirdy part repository

Feel free to test it and report any issue you encounter.

--
SeB


All times are GMT -5. The time now is 08:24 AM.