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 07-18-2016 08:17 AM

Ok, I've tried.

There is a problem in the repository.

The CHECKSUMS.md5 does not contain the md5 for the .asc files

For now you must to use slackpkg -checkgpg=off install ...


[edit] may work slackpkg -checkmd5=off install ...

jphor 07-18-2016 08:28 AM

Brilliant thanks, at least I know it is not me...

lopid 07-20-2016 03:52 AM

Quote:

Originally Posted by zerouno (Post 5577771)
There is a problem in the repository.

The CHECKSUMS.md5 does not contain the md5 for the .asc files

This would tally with the output I see:

Code:

==============================================================================
  WARNING! One or more errors occurred while slackpkg was running
------------------------------------------------------------------------------
xfce4-diskperf-plugin-2.5.4-x86_64-1_rlw.txz.asc:        md5sum
xfce4-netload-plugin-1.2.4-x86_64-1_rlw.txz.asc:        md5sum
xfce4-diskperf-plugin-2.5.4-x86_64-1_rlw.txz.asc:        md5sum
xfce4-netload-plugin-1.2.4-x86_64-1_rlw.txz.asc:        md5sum
xfce4-diskperf-plugin-2.5.4-x86_64-1_rlw.txz.asc:        md5sum
xfce4-netload-plugin-1.2.4-x86_64-1_rlw.txz.asc:        md5sum


zerouno 07-20-2016 03:56 AM

yes, the asc file is not in CHECKSUMS.MD5

grep xfce4-netload-plugin-1.2.4-x86_64-1_rlw.txz.asc /var/lib/slackpkg/CHECKSUMS.md5

give no output

lopid 07-22-2016 04:40 AM

Looks like it's fixed now.

t1nm@n 08-20-2016 08:51 PM

Phew, I thought I was the only one getting errors. Like lopid said, it's fixed now :)

Slax-Dude 09-20-2016 08:42 AM

I had a problem (bug?) using slackpkg+ 1.7.0 and also I have a feature request :)

The problem/bug:
In my conf file I have "REPOPLUS=( repo1 repo2 slackpkgplus repo3 repo4 )" and "PKG_PRIORITY=( slackpkgplus repo1 repo2 repo3 repo4 )".
When I search for slackpkg, it tells me that slackpkg+-1.7.0-noarch-4mt should be upgraded to slackpkg+-1.7.0-noarch-repo1... so it is ignoring PKG_PRIORITY entirely.

The feature request:
Is it possible to extend the repository:package format to templates?
Having something like
repo1:package1
repo1:package2
repo2:package3
repo1:package4
...would be very useful for having templates that include package from different repositories that may have the same packages.
For example: repo1 and repo2 both have package1 + package2 + package3 + package4, but in repo2 package3 was compiled with some optional dependencies that I would like to use. But only package3... all other packages should come from repo1.

What do you think?

phenixia2003 09-20-2016 09:35 AM

Hello,

Quote:

Originally Posted by Slax-Dude (Post 5607730)
I had a problem (bug?) using slackpkg+ 1.7.0 and also I have a feature request :)

The problem/bug:
In my conf file I have "REPOPLUS=( repo1 repo2 slackpkgplus repo3 repo4 )" and "PKG_PRIORITY=( slackpkgplus repo1 repo2 repo3 repo4 )".
When I search for slackpkg, it tells me that slackpkg+-1.7.0-noarch-4mt should be upgraded to slackpkg+-1.7.0-noarch-repo1... so it is ignoring PKG_PRIORITY entirely.

EDIT:
Just noticed that your slackpkgplus.conf seems to contain PKG_PRIORITY instead of PKGS_PRIORITY.


So, unless I'm wrong you can ignore the following.

You should post you slackpkgplus.conf and the exact output of command :
Code:

$ slackpkg search slackpkg
On my side, with the configuration below :
Code:

$ grep -E "^PKGS_PRIORITY=|^REPOPLUS=" /etc/slackpkg/slackpkgplus.conf
PKGS_PRIORITY=( slackpkgplus mleddesktop )
REPOPLUS=( mleddesktop slackpkgplus  )

$ grep "slackpkg+" /var/lib/slackpkg/pkglist
SLACKPKGPLUS_slackpkgplus slackpkg+ 1.7.0 noarch 4mt slackpkg+-1.7.0-noarch-4mt ./SLACKPKGPLUS_slackpkgplus/pkg txz
SLACKPKGPLUS_mleddesktop slackpkg+ 1.7.0 noarch 1_microlinux slackpkg+-1.7.0-noarch-1_microlinux ./SLACKPKGPLUS_mleddesktop/slackware64/ap txz

I have no trouble :
Code:

$ slackpkg search slackpkg
Looking for slackpkg in package list. Please wait... DONE

The list below shows all packages with name matching "slackpkg".

[ Status          ] [ Repository              ] [ Package                                  ]
  installed              slackpkgplus                slackpkg+-1.7.0-noarch-4mt
  installed              slackware64                  slackpkg-2.82.1-noarch-3
  uninstalled(masked)      mleddesktop                  slackpkg+-1.7.0-noarch-1_microlinux

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


Quote:

Originally Posted by Slax-Dude (Post 5607730)
The feature request:
Is it possible to extend the repository:package format to templates?
Having something like
repo1:package1
repo1:package2
repo2:package3
repo1:package4
...would be very useful for having templates that include package from different repositories that may have the same packages.
For example: repo1 and repo2 both have package1 + package2 + package3 + package4, but in repo2 package3 was compiled with some optional dependencies that I would like to use. But only package3... all other packages should come from repo1.

What do you think?

I never tried, but I think that slackpkg+ supports this without the need to have packages prefixed with their source repository. You only need to ensure that the same slackpkgplus.conf is installed on systems for which the template will be used. If you have trouble with some packages, you can try to set TAG_PRIORITY=on in slackpkgplus.conf.


--
SeB

Slax-Dude 09-20-2016 11:05 AM

Quote:

Originally Posted by phenixia2003 (Post 5607752)
Hello,



EDIT:
Just noticed that your slackpkgplus.conf seems to contain PKG_PRIORITY instead of PKGS_PRIORITY.

That fixed it!
Must use copy/paste more when editing config files so I don't make these mistakes :(

Quote:

Originally Posted by phenixia2003 (Post 5607752)
I never tried, but I think that slackpkg+ supports this without the need to have packages prefixed with their source repository. You only need to ensure that the same slackpkgplus.conf is installed on systems for which the template will be used. If you have trouble with some packages, you can try to set TAG_PRIORITY=on in slackpkgplus.conf.

TAG_PRIORITY=on would not help, I think, since the packages are not installed yet... so how will slackpkg guess what the right tag for each package?

phenixia2003 09-20-2016 11:49 AM

Quote:

Originally Posted by Slax-Dude (Post 5607803)
TAG_PRIORITY=on would not help, I think, since the packages are not installed yet... so how will slackpkg guess what the right tag for each package?

Well, you're right, TAG_PRIORITY is useless in this case.

when you run slackpkg install X, slackpkg always installs the first package that matches X according to the order defined :
  • in PKGS_PRIORITY, then in PRIORITY (declared in /etc/slackpkg/slackpkg.conf), and finally in REPOPLUS.
  • when PKGS_PRIORITY is undefined: in PRIORITY (declared in /etc/slackpkg/slackpkg.conf) then in REPOPLUS.

The same applies to install-template.

Considering the (pseudo) template below :
Code:

slackpkg+
if your slackpkgplus.conf includes the definitions below :
Code:

PKGS_PRIORITY=( slackpkgplus mleddesktop )
REPOPLUS=( mleddesktop slackpkgplus  )

Using the template above implies installation of slackpkg+ from repository slackpkgplus :
Code:

$ slackpkg -dialog=off -default_answer=no -batch=on install-template test

Looking for packages in "test-template" template to install. Please wait...DONE

[ Repository              ] [ Package                                  ]
  slackpkgplus                slackpkg+-1.7.0-noarch-4mt.txz           

Total package(s): 1

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

On the other hand, if PKGS_PRIORITY is undefined or defined as below :
Code:

PKGS_PRIORITY=( mleddesktop slackpkgplus )
Using the template above implies installation of slackpkg+ from repository mleddesktop :
Code:

$ slackpkg -dialog=off -default_answer=no -batch=on install-template test

Looking for packages in "test-template" template to install. Please wait...DONE

[ Repository              ] [ Package                                  ]
  mleddesktop                  slackpkg+-1.7.0-noarch-1_microlinux.txz 

Total package(s): 1

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

Edit:

The drawback here, is that each generated template is implicitly linked to the slackpkgplus.conf in use. Therefore, if you loose this configuration, the template could not work as it should, unless the slackpkgplus.conf is rebuilt.

Even if it would be easier to rebuild the slackpkgplus.conf file, this drawback also applies in case the format "R:P" was extended to templates.


--
SeB

Slax-Dude 09-21-2016 06:10 AM

I think having the same conf file will not help, unless I implicitly state all the packages from repo2 that should have priority over the ones from repo1.
If there is only 1 or 2 packages, this is a doable workaround... but if I have a template with hundreds of packages and half of them should come from repo1 and half from repo2... it's a nightmare.

Here is an example :)
Let's say I have a template with 100 packages.
Most of them will be from slackonly, but some like ffmpeg and libreoffice are from alienbob, and others like virt-manager from mleddesktop and others still from some other repos.
How should I manage repo priorities? Please note that some packages are present in more than one repo, but not all of them.
Code:

PKGS_PRIORITY=( restricted:vlc restricted:ffmpeg alienbob:libreoffice repo1:package1 repo1:package2 repo1:package3 repo2:package4 repo1:package5 repo6:package6 repo1:package7 etc... slackonly restricted alienbob repo1 repo2 repo3 repo4 repo5 repo6 )
the PKGS_PRIORITY variable would be looooooooong if I would do it like this :(
I also don't know if ( repo2:package3 repo1 repo2 ) would work.

If templates supported the R:P format, this would be much easier to config.
Something like this:
package1
package2
repo2:package3
repo1:package4
package5
package6

All lines in template that have R:P format would respect it, those that don't have a R:P format should respect PKGS_PRIORITY as usual. This would keep backwards compatibility with all those template files out there.
We can already "slackpkg install restricted:vlc" regardless of PKG_PRIORITY, right, so it is already possible to bypass it?

phenixia2003 09-21-2016 07:53 AM

Hello,

Quote:

Originally Posted by Slax-Dude (Post 5608163)
I think having the same conf file will not help, unless I implicitly state all the packages from repo2 that should have priority over the ones from repo1.
If there is only 1 or 2 packages, this is a doable workaround... but if I have a template with hundreds of packages and half of them should come from repo1 and half from repo2... it's a nightmare.

Here is an example :)
Let's say I have a template with 100 packages.
Most of them will be from slackonly, but some like ffmpeg and libreoffice are from alienbob, and others like virt-manager from mleddesktop and others still from some other repos.
How should I manage repo priorities? Please note that some packages are present in more than one repo, but not all of them.
Code:

PKGS_PRIORITY=( restricted:vlc restricted:ffmpeg alienbob:libreoffice repo1:package1 repo1:package2 repo1:package3 repo2:package4 repo1:package5 repo6:package6
repo1:package7 etc... slackonly restricted alienbob repo1 repo2 repo3 repo4 repo5 repo6 )



That's right. But, anyway, in this context, even if syntax R:P was supported by templates, you will have to declare the same huge PKGS_PRIORITY or set TAG_PRIORITY=on (*) to ensure that upgrades are properly selected once the packages declared in the template are installed.

(*) which can fail in case of packages with same version and same build.

I'll check if there's an easy way to have syntax R:P supported by templates.

--
SeB

Slax-Dude 09-21-2016 08:37 AM

Yeah, I was counting on TAG_PRIORITY=on for upgrades, since there is no upgrade-template option :)

phenixia2003 09-21-2016 11:33 AM

2 Attachment(s)
Hello,

Quote:

Originally Posted by Slax-Dude (Post 5608217)
Yeah, I was counting on TAG_PRIORITY=on for upgrades, since there is no upgrade-template option :)

The patch Attachment 23075 adds support for the enhanced syntax in templates :
Code:

--- slackpkgplus.sh.org        2016-09-21 18:24:55.429874341 +0200
+++ slackpkgplus.sh        2016-09-21 19:45:56.205848837 +0200
@@ -10,7 +10,7 @@
 
  # regular expression used to distinguish the 3rd party repositories from the standard slackware directories.
  #
-SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"
+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
@@ -84,6 +84,7 @@
  # function showChangeLogInfo()
  # function showlist() // dialog=on
  # function showlist() // dialog=off
+  # function generate_template()
 
 
  ##### ===== BLACKLIST FUNCTIONS === #####
@@ -899,7 +900,37 @@
      fi
    fi
 
-    for CPRIORITY in ${PRIORITY[@]} ; do
+        # This is to support installation of packages declared in
+        # template with extendedsyntax support (ie. R:).
+        #
+        # when install-template is passed to slackpkg, a list of packages
+        # is generated from the specified template, then passed to makelist()
+        # which call givepriority for each declared packages in the template.
+        #
+        # in case of template with extended syntax, this means that ARGUMENT
+        # passed to givepriority can be expressed as "repository:name". Therefore,
+        # this "priority" must be prepended to PRIORITY and ARGUMENT set to "name"
+        # otherwise the package will not be installed.
+        #
+        # Prepending PRIORITY with all priority specified in a template could
+        # lead to slowdown. Therefore, only the current priority is prepended
+        # to WORKING_PRIORITY which is first initialized with priorities
+        # declared in variable PRIORITY.
+
+    WORKING_PRIORITY=( echo ${PRIORITY[@]} )
+
+    if [[ "$CMD" == "install-template" ]] && [[ "$ARGUMENT" =~ .*:.* ]] ; then
+
+        if echo "$ARGUMENT" | grep -qwE "(^$SLACKDIR_REGEXP)|(^SLACKPKGPLUS_)" ; then
+                WORKING_PRIORITY=( "${ARGUMENT}" ${PRIORITY[@]} )
+        else
+                WORKING_PRIORITY=( "SLACKPKGPLUS_$ARGUMENT" ${PRIORITY[@]} )
+        fi
+        ARGUMENT=$(echo $ARGUMENT | cut -f2 -d":")
+    fi
+
+
+    for CPRIORITY in ${WORKING_PRIORITY[@]} ; do
      [ "$PKGDATA" ] && break
 
      DIR=${CPRIORITY/:*/}
@@ -1515,6 +1546,97 @@
 
  #### ===== END SHOWLIST FUNCTIONS ====== ######
 
+  #### ===== BEGIN TEMPLATE FUNCTIONS ==== ####
+
+# override generate_template() from core-functions.sh
+#
+# This version generates template with packages prefixed
+# by their respective repositories (ie. R:P)
+#
+generate_template() {
+
+        if [ "$USE_INCLUDES" = "on" ]; then
+                (
+                        cd $TEMPLATEDIR
+                        if [ "$(ls *.template 2>/dev/null)" != "" ]; then
+                                echo -e "\tParsing actual template files:"
+                                for i in *.template ; do
+                                        echo -e "\t\t$i"
+                                        parse_template $i
+                                done
+                        fi
+                )
+        fi
+
+        touch $TMPDIR/allheaders
+
+        touch $TMPDIR/waiting
+        echo -e "\tGenerating slackware installed package list (this may take a while) \c"
+        [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
+
+                # This is needed to ensure that givepriority() will work and return
+                # the good package when there are different versions of the same package
+                # in different repositories...
+
+        cat ${WORKDIR}/pkglist > ${TMPDIR}/pkglist
+
+        for i in $ROOT/var/log/packages/* ; do
+                PKGNAME=$( echo $i | sed 's?.*/??;s/\.t[bglx]z$//' )
+                BASENAME="${PKGNAME%-*-*-*}"
+                givepriority "$BASENAME"
+
+                PKGINFO=$( grep "$PKGNAME" ${TMPDIR}/pkglist | cut -f1,2 -d" " --output-delimiter=":" | sed "s/^SLACKPKGPLUS_//")
+
+                if  [ -z "$PKGINFO" ] ; then
+                        # there's no package in database that match the installed version. In this
+                        # case, select 1st package in database whose basename=$BASENAME, if any.
+
+                        if grep -q " $BASENAME " ${TMPDIR}/pkglist ; then
+                                echo $BASENAME>> $TMPDIR/$TEMPLATE.work
+                        fi
+                else
+                        echo $PKGINFO>> $TMPDIR/$TEMPLATE.work
+                fi
+
+
+        done 
+        rm $TMPDIR/waiting
+        echo " "
+
+        echo -e "\tGenerating $TEMPLATE "
+        for TMPLATE in $( wc -l $TMPDIR/* | sort -r | \
+                          awk -F/ '/template.tmp/ { print $NF }'); do
+                if ! $( grep -q "^#include.*${TMPLATE/.tmp/}" \
+                        $TMPDIR/allheaders) ; then
+                        diff -y $TMPDIR/$TEMPLATE.work $TMPDIR/$TMPLATE | \
+                                awk -vTMPDIR=$TMPDIR \
+                                        '!/</ { print $1 > TMPDIR"/same" }
+                                        /</ { print $1 > TMPDIR"/notsame" }'
+                        if $( diff -q        $TMPDIR/$TMPLATE \
+                                        $TMPDIR/same &>/dev/null ); then
+                                echo "#include ${TMPLATE/.tmp/}" \
+                                        >> $TMPDIR/$TEMPLATE.header
+                                cat $TMPDIR/${TMPLATE/.tmp/}.header \
+                                        >> $TMPDIR/allheaders 2>/dev/null
+                                cat $TMPDIR/same >> $TMPDIR/allfiles
+                        fi
+                fi
+        done
+
+        if [ -e $TMPDIR/allfiles ]; then
+                sort -u $TMPDIR/allfiles > $TMPDIR/alluniqfiles
+        else
+                touch $TMPDIR/alluniqfiles
+        fi
+        if [ -e $TMPDIR/$TEMPLATE.header ]; then
+                cat $TMPDIR/$TEMPLATE.header > $TEMPLATEDIR/$TEMPLATE
+        fi
+        diff $TMPDIR/alluniqfiles $TMPDIR/$TEMPLATE.work |\
+                awk '/>/ { print $2 }' >> $TEMPLATEDIR/$TEMPLATE
+}
+
+  #### ===== END TEMPLATE FUNCTIONS ==== ####
+
 
  function debug(){
    echo "DEBUG $(date +%H:%M:%S.%N) (${BASH_LINENO[*]}): $@" >&2
@@ -1599,7 +1721,7 @@
      PKGS_PRIORITY[$INDEX]="$repository:.*"
    fi
 
-    if ! echo "$repository" | grep -qwE "$SLACKDIR_REGEXP" ; then
+    if ! echo "$repository" | grep -qwE "${SLACKDIR_REGEXP}$" ; then
      PURE_PKGSPRIORITY=( ${PURE_PKGSPRIORITY[*]} $pp )
    fi
    ((INDEX++))
@@ -1649,7 +1771,7 @@
 
      if [ ! -z "$repository" ] && [ ! -z "$package" ] ; then
 
-        if ! echo "$repository" | grep -qwE "$SLACKDIR_REGEXP" ; then
+        if ! echo "$repository" | grep -qwE "${SLACKDIR_REGEXP}$" ; then
          repository="SLACKPKGPLUS_${repository}"
        fi
 
@@ -1837,7 +1959,7 @@
            # require to add rule "${repository} ${package}" in the priority filter
          PRIORITY_FILTER_RULE="${repository} ${package}"
 
-          if ! echo "$repository" | grep -qwE "$SLACKDIR_REGEXP" ; then
+          if ! echo "$repository" | grep -qwE "${SLACKDIR_REGEXP}$" ; then
            repository="SLACKPKGPLUS_${repository}"
          fi

Consider this as being in alpha state. It would be useful to test it with different scenarios.

Here is an example :

Code:

$ cat /etc/slackpkg/template/test.template

slackware64:MPlayer
slackware64:alsa-lib
slackware64:clisp
slackware64:esound
mleddesktop:slackpkg+
restricted:ffmpeg

$ grep -E "^(PKGS_PRIORITY=|REPOPLUS=)" /etc/slackpkg/slackpkgplus.conf
PKGS_PRIORITY=( restricted:ffmpeg )
REPOPLUS=( slackpkgplus mleddesktop alienbob restricted )

$ slackpkg -dialog=off -default_answer=no -batch=on install-template test


Looking for packages in "test" template to install. Please wait...DONE

[ Repository              ] [ Package                                  ]
  mleddesktop                  slackpkg+-1.7.0-noarch-1_microlinux.txz
  restricted                  ffmpeg-3.1.1-x86_64-1alien.txz
  slackware64                  MPlayer-1.2_20160125-x86_64-3.txz
  slackware64                  alsa-lib-1.1.1-x86_64-2.txz
  slackware64                  clisp-2.49-x86_64-3.txz
  slackware64                  esound-0.2.41-x86_64-2.txz

Total package(s): 6

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

Note: I have intentionally given priority to slackpkg+ from "mleddesktop" over "slackpkgplus" to show that priorities defined in templates take precedence over the others priorities.

Furthermore, with this patch, slackpkg generate templates with the enhanced syntax :
Code:

$ slackpkg generate-template template-with-enhanced-syntax

new generate_template() called ...
        Generating slackware installed package list (this may take a while)
        Generating template-with-enhanced-syntax.template

cat /etc/slackpkg/template/template-with-enhanced-syntax.template

slackware64:MPlayer
slackware64:alsa-lib
slackware64:clisp
slackware64:esound
restricted:ffmpeg
mleddesktop:slackpkg+
....

--
SeB

Slax-Dude 09-21-2016 12:14 PM

Thanks for considering implementing this option!

I'll test it tomorrow as I don't have access to a Slackware box right now.


All times are GMT -5. The time now is 05:21 PM.