LinuxQuestions.org
Visit Jeremy's Blog.
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 06-07-2018, 05:36 PM   #1
Xsane
Member
 
Registered: Jan 2014
Posts: 186

Rep: Reputation: 134Reputation: 134
[PATCH 1-5/5] pkgtools


Pat, thank you for implementing --terse for pkgtools.

While reviewing your changes, I saw these patch suggestions:

Code:
From: xsane <@linuxquestions.org>
Date: Wed, 30 May 2018 22:58:43 -0400
Subject: [PATCH 1/5] upgradepkg: update usage()

* Add options list
* Update usage examples
* Leave the operational details to the man page.

Patched:
upgradepkg --help

Usage: upgradepkg [options] <newpackage> ...
       upgradepkg [options] <oldpackage%newpackage> ...

Upgrade, install, or reinstall Slackware packages (.tgz, .tbz, .tlz, .txz).

To operate on an alternate directory, such as /mnt:
  ROOT=/mnt upgradepkg package.tgz

Options:
 --dry-run              only display what would be done
 --install-new          install new packages also
 --reinstall            upgrade packages of the same version
 --terse                display a single line for each package operation
 --terselength <length> maximum line length of terse output
 --verbose              display all the gory details of the upgrade
 --help                 display this help

For more details see upgradepkg(8).

---
 upgradepkg | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/upgradepkg b/upgradepkg
index 1acae7d..239bed1 100755
--- a/upgradepkg
+++ b/upgradepkg
@@ -62,27 +62,24 @@ pkgbase() {
 usage() {
  cat << EOF
 
-Usage: upgradepkg newpackage [newpackage2 ... ]
-       upgradepkg oldpackage%newpackage [oldpackage2%newpackage2 ... ]
+Usage: upgradepkg [options] <newpackage> ...
+       upgradepkg [options] <oldpackage%newpackage> ...
 
-Upgradepkg upgrades a Slackware package (.tgz, .tbz, .tlz, .txz) from an
-older version to a newer one. It does this by INSTALLING the new package
-onto the system, and then REMOVING any files from the old package that
-aren't in the new package. If the old and new packages have the same
-name, a single argument is all that is required. If the packages have
-different names, supply the name of the old package followed by a percent
-symbol (%), then the name of the new package. Do not add any extra
-whitespace between pairs of old/new package names.
+Upgrade, install, or reinstall Slackware packages (.tgz, .tbz, .tlz, .txz).
 
-Before upgrading a package, save any configuration files (such as in /etc)
-that you wish to keep. Sometimes these will be preserved, but it depends
-on the package. If you want to force new versions of the config files
-to be installed, remove the old ones manually prior to running upgradepkg.
+To operate on an alternate directory, such as /mnt:
+  ROOT=/mnt upgradepkg package.tgz
 
-To upgrade in a directory other than / (such as /mnt):
-
-   ROOT=/mnt upgradepkg package.tgz (or .tbz, .tlz, .txz)
+Options:
+ --dry-run		only display what would be done
+ --install-new		install new packages also
+ --reinstall		upgrade packages of the same version
+ --terse		display a single line for each package operation
+ --terselength <length> maximum line length of terse output
+ --verbose		display all the gory details of the upgrade
+ --help			display this help
 
+For more details see upgradepkg(8).
 EOF
 }
Code:
From: xsane <@linuxquestions.org>
Date: Wed, 30 May 2018 22:45:19 -0400
Subject: [PATCH 2/5] upgradepkg.8: package design is not a bug

If a package does not protect its configuration files that
is not an upgradepkg bug.

Move the information from the BUGS section to the DESCRIPTION
section where it is more visible, because it has been removed
from the usage() output.

---
 upgradepkg.8 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/upgradepkg.8 b/upgradepkg.8
index af52664..757d600 100644
--- a/upgradepkg.8
+++ b/upgradepkg.8
@@ -66,7 +66,12 @@ If the old and new packages have the same name, a single argument is all that
 is required.  If the packages have different names, supply the name of the
 old package followed by a percent symbol (%), then the name of the new package.
 Do not add any extra whitespace between pairs of old/new package names.
-
+.P
+Before upgrading a package, save any configuration files (such as in /etc)
+that you wish to keep.  Sometimes these will be preserved, but it depends on
+the package structure.  If you want to force new versions of the config files
+to be installed, remove the old ones manually prior to running upgradepkg.
+.P
 If upgradepkg finds more than one installed package matching the old package's
 name, it will remove them all.
 .TP
@@ -101,11 +106,6 @@ Maximum line length of --terse mode output. Default is the number of terminal co
 .TP
 .B \--verbose
 Show all the gory details of the upgrade.
-.SH BUGS
-Before upgrading a package, save any configuration files (such as in /etc)
-that you wish to keep.  Sometimes these will be preserved, but it depends on
-the package structure.  If you want to force new versions of the config files
-to be installed, remove the old ones manually prior to running upgradepkg.
 .SH AUTHOR
 Patrick J. Volkerding <volkerdi@slackware.com>
 .SH "SEE ALSO"
Code:
From: xsane <@linuxquestions.org>
Date: Wed, 30 May 2018 23:11:02 -0400
Subject: [PATCH 3/5] upgradepkg: help was missed when adding -options

---
 upgradepkg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/upgradepkg b/upgradepkg
index a9ca423..b267461 100755
--- a/upgradepkg
+++ b/upgradepkg
@@ -103,7 +103,7 @@ else
 fi
 
 # --help or no args?
-if [ "$1" = "" -o "$1" = "--help" -o "$1" = "-?" ]; then
+if [ "$1" = "" -o "$1" = "-help" -o "$1" = "--help" -o "$1" = "-?" ]; then
   usage;
   exit 1;
 fi
Code:
From: xsane <@linuxquestions.org>
Date: Sun, 3 Jun 2018 20:38:33 -0400
Subject: [PATCH 4/5] upgradepkg: terse output one line for failures too

If the concept of terse is to output a single line for each
package that is operated upon, then failures need a single
output line as well.

My use case for --terse is to have a concise list to review
when operating over many packages, or series of packages. I
kinda want know about failures too.

For example current:
upgradepkg foo.txz%package.tgz

Error: there is no installed package named foo.
       (looking for /var/log/packages/foo)

upgradepkg --terse foo.txz%package.tgz
<crickets>

Patched:
upgradepkg --terse foo.txz%package.tgz
Error: there is no installed package named foo.
---
 upgradepkg | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/upgradepkg b/upgradepkg
index b267461..adfb6b8 100755
--- a/upgradepkg
+++ b/upgradepkg
@@ -205,7 +205,7 @@ for ARG; do
   # Simple package integrity check:
   if ! [ -f "$NEW" ]; then
     ERRCODE=4
-    ! [ $TERSE ] && echo "Cannot install $ARG:  file not found"
+    echo "Cannot install $ARG:  file not found"
     continue;
   fi
 
@@ -221,7 +221,7 @@ for ARG; do
   # Make sure the extension is valid:
   if [ "$NNAME" = "$NEW" ]; then
     # We won't throw an ERRCODE for this, but the package is skipped:
-    ! [ $TERSE ] && echo "Cannot install $OLD: invalid package extension"
+    echo "Cannot install $OLD: invalid package extension"
     continue;
   fi
 
@@ -247,7 +247,7 @@ for ARG; do
         echo "$OLD would not be upgraded (no installed package named $SHORT)."
       else
         ! [ $TERSE ] && echo
-        ! [ $TERSE ] && echo "Error: there is no installed package named $OLD."
+        echo "Error: there is no installed package named $OLD."
         ! [ $TERSE ] && echo "       (looking for $ROOT/var/log/packages/$OLD)"
         ! [ $TERSE ] && echo
       fi
@@ -283,7 +283,7 @@ EOF
       echo "$NEW incoming package not found (command line)."
     else
       ! [ $TERSE ] && echo
-      ! [ $TERSE ] && echo "Error: incoming package $INCOMINGDIR/$NNAME not found."
+      echo "Error: incoming package $INCOMINGDIR/$NNAME not found."
       ! [ $TERSE ] && echo
     fi
     ERRCODE=1
Code:
From: xsane <@linuxquestions.org>
Date: Sun, 3 Jun 2018 21:03:18 -0400
Subject: [PATCH 5/5] upgradepkg: print new package only when not found

Current:
upgradepkg foo.txz%bar.txz
Cannot install foo.txz%bar.txz:  file not found

Patched:
upgradepkg foo.txz%bar.txz
Cannot install bar.txz:  file not found
---
 upgradepkg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/upgradepkg b/upgradepkg
index adfb6b8..3c8b103 100755
--- a/upgradepkg
+++ b/upgradepkg
@@ -205,7 +205,7 @@ for ARG; do
   # Simple package integrity check:
   if ! [ -f "$NEW" ]; then
     ERRCODE=4
-    echo "Cannot install $ARG:  file not found"
+    echo "Cannot install $NEW:  file not found"
     continue;
   fi
 
Old 06-09-2018, 10:49 AM   #2
ziprun
Member
 
Registered: Apr 2018
Posts: 105

Rep: Reputation: Disabled
When will slackpkg natively offer the ability to install from third party repos?
 
Old 06-09-2018, 08:45 PM   #3
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
Quote:
Originally Posted by ziprun View Post
When will slackpkg natively offer the ability to install from third party repos?
Wouldn't that break the KISS principle of Slackware and pollute the small but stable ecosystem of vanilla Slackware? Give users the ability to pull third party packages with slackpkg and expect waves of complaints after they break their systems because of that.

Not trying to play devil's advocate, just trying to understand the consequences of such a feature, because if slackpkg gets it, I'll just instinctively avoid using it for the above reasons. Sure one can invoke the argument that for example Alien's third party repo is authored by a respected skilled Slackware contributor and is unlikely to contain unstable stuff, but that's rather an exception that would confirm the rule.
 
Old 06-10-2018, 04:49 AM   #4
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
I would say never. Slackpkg for Slackware packages only. That said, slackpkg+ does this, using slackpkg.
 
  


Reply



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
Why pkgtools still using tar-1.13 tank728 Slackware 68 09-14-2016 12:36 PM
Slack 10.2 pkgtools in 10.0 linuxhippy Slackware 3 01-17-2006 09:54 AM
pkgtools Nightmare HELP!!!!!!!!!! waterox Slackware 4 09-12-2005 12:46 PM
missing pkgtools chopp Slackware 7 02-05-2005 12:41 AM
pkgtools problem??? brbrow Slackware 2 09-10-2003 01:58 PM

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

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

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