Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread Tim Mooney

In regard to: Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh,...:


Certainly lots of the scripts could use an overhaul.

Most shells SHOULD be POSIX compliant: but I will defer to Tim's opinion
on portability, there may still be some ancient shells in use somewhere.


I no longer have access to many of the UNIX variants we used to use, but
even Solaris 10 had a /bin/sh that was more traditional Bourne than POSIX.

And for Pinto's benefit, specifically related to the vpkg-provides script:
that script is really targeted at *non*-Linux, so portability to older
variants of /bin/sh is important.  No one needs vpkg-provides on an
RPM-based system, but it might save the day on an AIX or Solaris system
where you're trying to bootstrap RPM.  Keep in mind that even older
versions of the UNIX variants often had a POSIX shell stashed somewhere
(like /usr/xpg4/bin/sh on Solaris 8 or 9), but it wasn't the default shell
and a lot of newer admins wouldn't know of its existence.

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing  Infrastructure  701-231-1076 (Voice)
Room 242-J6, Quentin Burdick Building  701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread Jeffrey Johnson

On Apr 2, 2015, at 5:29 PM, devzero2000 wrote:

 
 Il 02/Apr/2015 18:43 Jeffrey Johnson n3...@me.com ha scritto:
 
 
  On Apr 2, 2015, at 12:11 PM, devzero2000 wrote:
 
 
  Il 02/Apr/2015 17:39 Jeffrey Johnson n3...@me.com ha scritto:
  
   Um ... was there actually a problem being solved here?
  
   Some of these scripts (like rpm2cpio.sh) are vitally
   important and have been posted publicly like here
   
   http://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm/25986787#25986787
   and integrated into other projects. The syntax change is
   highly intrusive to using diff to see what has changed.
  
   *shrug* Many of these scripts haven't been used in years.
 
  Ciao jbj
 
  The aim is to modernize a little these shells. The comment should be 
  clear. The change  is trivial, but a further check is certainly necessary 
  ( some incompatibility is possible ) .
 
 
  Please describe modernize a bit.
 
 Here a possible interpretation
 
 http://mywiki.wooledge.org/BashFAQ/082
 
 

OK, got it, though I doubt many of the rpm scripts had deep escaping as in the 
examples.

Meanwhile, a consistent usage everywhere is preferred (except perhaps for 
rpm2cpio.sh,
where consistency with what is released in the wild is perhaps more important: 
using od(1)
and set to swab ints (and pad signature headers)  is arcane no matter what 
shell syntax is used).

Certainly lots of the scripts could use an overhaul.

Most shells SHOULD be POSIX compliant: but I will defer to Tim's opinion on 
portability,
there may still be some ancient shells in use somewhere.
  I certainly know several useful (but thankless) changes needed with the 
  scriptie in rpm:
 
  1) standardize/regularize on foodeps -P|-R instead of ancient/hoary 
  foo-prov/foo-req
 
  2) resurrect v_pkg to fully automate and simplify the provides/verify of a 
  non-rpm vendor OS
 
  3) write shell/perl to verify the MD5 sum of header+payload without rpm 
  installed (like rpm2cpio.sh)
 
 Ok. Todo. It was just a way to start again , maybe not so useful .
 
 Free to Revert. No.problem.
 
 

I'll leave the decision to you. Yes its easy enough to revert if necessary.

73 de Jeff
 Best regards
 
  hth
 
  73 de Jeff
 



Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread devzero2000
Il 02/Apr/2015 18:43 Jeffrey Johnson n3...@me.com ha scritto:


 On Apr 2, 2015, at 12:11 PM, devzero2000 wrote:


 Il 02/Apr/2015 17:39 Jeffrey Johnson n3...@me.com ha scritto:
 
  Um ... was there actually a problem being solved here?
 
  Some of these scripts (like rpm2cpio.sh) are vitally
  important and have been posted publicly like here
 
http://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm/25986787#25986787
  and integrated into other projects. The syntax change is
  highly intrusive to using diff to see what has changed.
 
  *shrug* Many of these scripts haven't been used in years.

 Ciao jbj

 The aim is to modernize a little these shells. The comment should be
clear. The change  is trivial, but a further check is certainly necessary (
some incompatibility is possible ) .


 Please describe modernize a bit.

Here a possible interpretation

http://mywiki.wooledge.org/BashFAQ/082

 I certainly know several useful (but thankless) changes needed with the
scriptie in rpm:

 1) standardize/regularize on foodeps -P|-R instead of ancient/hoary
foo-prov/foo-req

 2) resurrect v_pkg to fully automate and simplify the provides/verify of
a non-rpm vendor OS

 3) write shell/perl to verify the MD5 sum of header+payload without rpm
installed (like rpm2cpio.sh)

Ok. Todo. It was just a way to start again , maybe not so useful .

Free to Revert. No.problem.

Best regards

 hth

 73 de Jeff



Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread Jeffrey Johnson
Um ... was there actually a problem being solved here?

Some of these scripts (like rpm2cpio.sh) are vitally
important and have been posted publicly like here

http://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm/25986787#25986787
and integrated into other projects. The syntax change is
highly intrusive to using diff to see what has changed.

*shrug* Many of these scripts haven't been used in years.

But please state your intent before aesthetically driven changes like this.

73 de Jeff

On Apr 2, 2015, at 8:57 AM, Pinto Elia wrote:

  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  
 
  Server: rpm5.org Name:   Pinto Elia
  Root:   /v/rpm/cvs   Email:  devzero2...@rpm5.org
  Module: rpm  Date:   02-Apr-2015 14:57:58
  Branch: rpm-5_4  Handle: 2015040212575800
 
  Modified files:   (Branch: rpm-5_4)
rpm/scripts vpkg-provides2.sh
 
  Log:
vpkg-provides2.sh: use the $( ... \) construct for command substitution
 
Prefer the $( ... ) construct for command
substitution instead of using the back-quotes, or grave accents (`..`).
 
The backquoted form is the historical method for command substitution,
and is supported by POSIX. However, all but the simplest uses become
complicated quickly. In particular, embedded command substitutions
and/or the use of double quotes require careful escaping with the backslash
character. Because of this the POSIX shell adopted the $(…) feature from
the Korn shell.
 
The patch was generated by the simple script
 
for _f in $(find . -type f -exec file {} \; | grep -i shell | awk -F: '{ 
 print $1 }')
do
  perl -i -pe 'BEGIN{undef $/;} s@`(.*)`@\$($1)@smg' ${_f}
done
 
  Summary:
RevisionChanges Path
1.3.22.1+8  -8  rpm/scripts/vpkg-provides2.sh
  
 
  patch -p0 '@@ .'
  Index: rpm/scripts/vpkg-provides2.sh
  
  $ cvs diff -u -r1.3 -r1.3.22.1 vpkg-provides2.sh
  --- rpm/scripts/vpkg-provides2.sh15 Mar 2001 13:58:16 -  1.3
  +++ rpm/scripts/vpkg-provides2.sh2 Apr 2015 12:57:58 -   1.3.22.1
  @@ -11,9 +11,9 @@
 
   IGNORE_DIRS='@'
 
  -date=`date`
  -hostname=`uname -n`
  -osname=`uname -s`
  +date=$(date)
  +hostname=$(uname -n)
  +osname=$(uname -s)
 
   # programs we run
 
  @@ -29,16 +29,16 @@
   requires_tmp=/tmp/requires.$$
 
 
  -for pkg in `$u_pkg list_all_packages`
  +for pkg in $($u_pkg list_all_packages)
   do
 
   # find OS pkg information
 
   spec_filename=$spec_filedir/$pkg
 
  -veryify_cmd=`$u_pkg print_cmd package_version $pkg | sed -e s/\\$1/$pkg/ `
  +veryify_cmd=$($u_pkg print_cmd package_version $pkg | sed -e s/\\$1/$pkg/ 
 )
 
  -pkg_version=`$u_pkg package_version $pkg `
  +pkg_version=$($u_pkg package_version $pkg )
 
 
   # find all the dependencies
  @@ -74,7 +74,7 @@
 
   %description
   This is a virtual RPM package.  It contains no actual files.  It uses the
  -\`Provides' token from RPM 3.x and later to list many of the shared 
 libraries
  +\$(Provides' token from RPM 3.x and later to list many of the shared 
 libraries
   and interpreters that are part of the base operating system and associated
   subsets for $osname.
 
  @@ -103,7 +103,7 @@
   export PATH
 
   expected_version='$pkg_version'
  -current_version=\`$veryify_cmd\`
  +current_version=\)$veryify_cmd\`
 
   if [ \$expected_version -ne \$current_version ]; then
   echo RPM virtual package does not match OS pkg: $pkg 2
  @@ .
 __
 RPM Package Managerhttp://rpm5.org
 CVS Sources Repositoryrpm-...@rpm5.org

__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org


Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread Jeffrey Johnson

On Apr 2, 2015, at 12:11 PM, devzero2000 wrote:

 
 Il 02/Apr/2015 17:39 Jeffrey Johnson n3...@me.com ha scritto:
 
  Um ... was there actually a problem being solved here?
 
  Some of these scripts (like rpm2cpio.sh) are vitally
  important and have been posted publicly like here
  
  http://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm/25986787#25986787
  and integrated into other projects. The syntax change is
  highly intrusive to using diff to see what has changed.
 
  *shrug* Many of these scripts haven't been used in years.
 
 Ciao jbj
 
 The aim is to modernize a little these shells. The comment should be clear. 
 The change  is trivial, but a further check is certainly necessary ( some 
 incompatibility is possible ) .
 

Please describe modernize a bit.

I certainly know several useful (but thankless) changes needed with the 
scriptie in rpm:

1) standardize/regularize on foodeps -P|-R instead of ancient/hoary 
foo-prov/foo-req

2) resurrect v_pkg to fully automate and simplify the provides/verify 
of a non-rpm vendor OS

3) write shell/perl to verify the MD5 sum of header+payload without rpm 
installed (like rpm2cpio.sh)

hth

73 de Jeff



Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh

2015-04-02 Thread Tim Mooney

In regard to: Re: [CVS] RPM: rpm-5_4: rpm/scripts/ vpkg-provides2.sh,...:


The aim is to modernize a little these shells. The comment should be clear.


Why?  Was there something broken that you've fixed?

Because the change you've made actually makes them less portable.

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing  Infrastructure  701-231-1076 (Voice)
Room 242-J6, Quentin Burdick Building  701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
__
RPM Package Managerhttp://rpm5.org
Developer Communication Listrpm-devel@rpm5.org