OpenCSW Bug Tracker


Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000673 [pkg_get] other feature always 2004-10-19 09:18 2009-03-01 03:12
Reporter duncs View Status public  
Assigned To phil
Priority normal Resolution fixed  
Status resolved  
Summary 0000673: pkg-get doesnt cope with pkgask files yet
Description pkg-get doesnt know how to use pkgask files. (i.e. pkgadd -r <pkgask> <pkg>). Patch provided in \"additional information\". Note: the patch requires the catalog file to include $6 as \"pkgask\" and will be used for a package name call <pkg>.pkgask[.gz] (whereas package is <pkg>.pkg[.gz]). Patch is against pkg-get version \"pkg-get SCCS rev 2.45\". Why do i need this? I use pkg-get against my own internal repository for distributing packages around a few hundred machines. A few of those packages need pkgask files to install correctly. Note also in my own package i drop in a verion of wget into /var/pkg-get/ to ensure there is always one available if it hasnt otherwise been installed on the machine.
Additional Information *** pkg-get.dist Mon Oct 18 17:27:19 2004
--- package/usr/local/bin/pkg-get Tue Oct 19 13:16:53 2004
***************
*** 128,134 ****
--- 128,140 ----
   
        #-nv means NO progress meter at all. You dont get the dots.
        # wget -nv --dot-style=mega --passive-ftp
+ # get pkgask file first - ignore any failures. Only want failures
+ # from getting the pkg file itself
+ if [[ -n \"$pkgask\" ]]; then
+ $WGET $PROXYFLAGS $WGETFLAGS ${graburl%.gz}ask.gz
+ fi
        $WGET $PROXYFLAGS $WGETFLAGS $graburl
+
  }
   
   
***************
*** 153,159 ****
        print \" \'-d|download\' just download the package, not install\"
        print \" \'-D|describe\' describe available packages, or search for one\"
        print \" \'-U|updatecatalog\' updates download site inventory\"
!
        print \" \'-f\' dont ask any questions: force default behaviour\"
        print \" Normally used with an override admin file\"
        print \" See /var/pkg-get/admin-fullauto\"
--- 159,165 ----
        print \" \'-d|download\' just download the package, not install\"
        print \" \'-D|describe\' describe available packages, or search for one\"
        print \" \'-U|updatecatalog\' updates download site inventory\"
! print \" \'-p|pkgask\' use a pkgask file if one is available\"
        print \" \'-f\' dont ask any questions: force default behaviour\"
        print \" Normally used with an override admin file\"
        print \" See /var/pkg-get/admin-fullauto\"
***************
*** 821,827 ****
                        if [[ \"$DIRECTORY\" != \"\" ]] ; then
                                # no point in using upgrade:
                                # can only be one pkgname in a dir.
! $progname install $DIRECTORY $dependpkg
                                continue
                        fi
   
--- 827,837 ----
                        if [[ \"$DIRECTORY\" != \"\" ]] ; then
                                # no point in using upgrade:
                                # can only be one pkgname in a dir.
! PKGASK=
! if [[ -n \"$pkgask\" ]]; then
! PKGASK=\"pkgask\"
! fi
! $0 install $PKGASK $DIRECTORY $dependpkg
                                continue
                        fi
   
***************
*** 916,921 ****
--- 926,940 ----
                mv -f $filename.tmp $filename
        fi
   
+ pkgaskname=`echo $filename | sed \'s/.pkg/.pkgask/\'`
+ if [[ -f ${pkgaskname} ]]; then
+ env LANG=C file ${pkgaskname} | grep \'compressed \' >/dev/null
+ if [[ $? -eq 0 ]] ; then
+ gzip -d -c ${pkgaskname} >${pkgaskname}.tmp
+ mv -f $pkgaskname.tmp ${pkgaskname}
+ fi
+ fi
+
        pkgname=`nawk \'NR==2 {print $1;exit}\' $filename`
        if [[ $do_upgrade -eq 1 ]] ; then
                remove_sysv_pkg $pkgname
***************
*** 937,943 ****
                fi
        fi
   
! pkgadd -d $filename $ADMINFLAG $pkgname
        status=$?
        if [[ $status -ne 0 ]] ; then
                print ERROR: could not add $pkgname.
--- 956,974 ----
                fi
        fi
   
! PKGASK=
! if [[ -n \"$pkgask\" ]]; then
! #ls -la ${pkgaskname}*
! if [[ -f ${pkgaskname} ]]; then
! PKGASK=\"-n -r ${pkgaskname}\"
! fi
! fi
!
! #echo mode=$mode
! #echo PKGASK=$PKGASK
!
! #echo test 1 pkgadd -d $filename $PKGASK $ADMINFLAG $pkgname
! pkgadd -d $filename $PKGASK $ADMINFLAG $pkgname
        status=$?
        if [[ $status -ne 0 ]] ; then
                print ERROR: could not add $pkgname.
***************
*** 1184,1189 ****
--- 1215,1223 ----
        software=\"$1\"
        rem_rev=\"$2\"
        pkgname=\"$3\"
+ whocares=\"$4\"
+ whocares=\"$5\"
+ sftask=\"$6\"
   
  # gzip triggers this.
        if [[ \"$pkgname\" == \"\" ]] ; then
***************
*** 1201,1208 ****
        if [[ \"$localrev\" == \"$rem_rev\" ]] ; then
                rem_rev=\"SAME\"
        fi
        # match with headers in show_installed
! printf \"%15s %25s %25s\\n\" \"$software\" \"$localrev\" \"$rem_rev\"
   
  }
  # This cross-references all known install packages that match
--- 1235,1247 ----
        if [[ \"$localrev\" == \"$rem_rev\" ]] ; then
                rem_rev=\"SAME\"
        fi
+
+ if [[ -n \"$sftask\" ]]; then
+ sftask=\"yes\"
+ fi
+
        # match with headers in show_installed
! printf \"%15s %22s %22s %8s\\n\" \"$software\" \"$localrev\" \"$rem_rev\" \"$sftask\"
   
  }
  # This cross-references all known install packages that match
***************
*** 1211,1217 ****
        print \"# (From site $url )\"
   
        # match with output of compare_pkg
! printf \"%15s %25s %25s\\n\" \"software\" \"localrev\" \"remoterev\"
   
        if [[ \"$1\" = \"\" ]] ; then
                egrep -v \'^#\' $CATALOGFILE | while read line ; do
--- 1250,1256 ----
        print \"# (From site $url )\"
   
        # match with output of compare_pkg
! printf \"%15s %22s %22s %8s\\n\" \"software\" \"localrev\" \"remoterev\" \"pkgask\"
   
        if [[ \"$1\" = \"\" ]] ; then
                egrep -v \'^#\' $CATALOGFILE | while read line ; do
***************
*** 1516,1525 ****
                return 0;
        fi
   
         
        if [[ do_upgrade -eq 0 ]] ; then
                # Dont bother to upgrade, just install and get out of here.
! pkgadd $ADMINFLAG -d $tmpdir $tmppkg
                return $?;
        fi
   
--- 1555,1576 ----
                return 0;
        fi
   
+ PKGASK=
+ if [[ -n \"$pkgask\" ]]; then
+ #ls -la ${pkgname}*
+ if [[ -f ${tmppkg}.pkgask ]];then
+ PKGASK=\"-r ${tmppkg}.pkgask\"
+ fi
+ fi
         
        if [[ do_upgrade -eq 0 ]] ; then
                # Dont bother to upgrade, just install and get out of here.
!
! # echo mode=$mode
! # echo PKGASK=$PKGASK
!
! # echo test 2 pkgadd $PKGASK $ADMINFLAG -d $tmpdir $tmppkg
! pkgadd $PKGASK $ADMINFLAG -d $tmpdir $tmppkg
                return $?;
        fi
   
***************
*** 1535,1541 ****
                        pkgrm $ADMINFLAG $f
                fi
        done
! pkgadd $ADMINFLAG -d $tmpdir $tmppkg
  }
   
  ###############################################################################
--- 1586,1597 ----
                        pkgrm $ADMINFLAG $f
                fi
        done
!
! echo mode=$mode
! echo PKGASK=$PKGASK
!
! echo test 3 pkgadd $PKGASK $ADMINFLAG -d $tmpdir $tmppkg
! pkgadd $PKGASK $ADMINFLAG -d $tmpdir $tmppkg
  }
   
  ###############################################################################
***************
*** 1572,1578 ****
  # We do the standard way first.
  # Then duplicate everything lower down, for longopts type args
   
! while getopts \"dDs:uUacirhvf\" mode_var ; do
        case $mode_var in
        d)
                mode=install
--- 1628,1634 ----
  # We do the standard way first.
  # Then duplicate everything lower down, for longopts type args
   
! while getopts \"dDs:puUacirhvf\" mode_var ; do
        case $mode_var in
        d)
                mode=install
***************
*** 1606,1611 ****
--- 1662,1670 ----
        r)
                mode=remove
        ;;
+ p)
+ pkgask=true
+ ;;
        f)
                force=true
        ;;
***************
*** 1665,1670 ****
--- 1724,1733 ----
                mode=remove
                shift
        ;;
+ pkgask|--pkgask)
+ pkgask=true
+ shift
+ ;;
        moo|--moo)
                mode=moo
                shift
***************
*** 1713,1719 ****
        # HAVE wget available. Check for it.
        whence wget >/dev/null
        if [[ $? -ne 0 ]] ; then
! PATH=$PATH:/opt/csw/bin:/opt/sfw/bin:/usr/sfw/bin:/usr/local/bin
        fi
   
        whence wget >/dev/null || get_wget
--- 1776,1782 ----
        # HAVE wget available. Check for it.
        whence wget >/dev/null
        if [[ $? -ne 0 ]] ; then
! PATH=$PATH:/opt/csw/bin:/opt/sfw/bin:/usr/sfw/bin:/usr/local/bin:/var/pkg-get
        fi
   
        whence wget >/dev/null || get_wget
Tags No tags attached.
Attached Files

- Relationships
has duplicate 0000679closedjames ghostscript Even with pkg-get -f requires interaction 

-  Notes
(0001201)
phil (manager)
2004-10-19 14:38

rather than just dumping a hundred or so lines of patch on me, how about describing from the user\'s point of view how your proposal would work.
I dont see how this would work in a clean fashion, from a user\'s perspective.
(0001202)
phil (manager)
2004-10-19 14:39

PS: putting wget in /var/pkg-get seems like a non-optimal method of doing things. It can be anywhere in the PATH, so you should either just copy it over to somewhere in your standard PATH, or extend your PATH to somewhere temporary, rather than hacking up the pkg-get script.
(0001205)
duncs (reporter)
2004-10-20 04:53
edited on: 2004-10-20 05:27

re: the patch - sorry \'bout that but couldnt see any way of uploading it as a file instead (maybe add an \"upload patch\" option on the web page?)

Basically, for those people that use pkg-get with their own repository (and maybe for some CSW packages too) the repository admin drops in the pkgask file in the same place as the package, but called <pkg>.pkgask instead of <pkg>.pkg. In the \"pkg-get -c\" output a 4th column is added that should state whether or not a package ask file exists )\"pkgask\" in column 6 of the catalog file). The user can then decide whether or not to use it for installing the package by using \"pkg-get -p -i <pkg>\". Why? To totally automate installation of all packges for 100% hands-off installs (i.e. for SUNWexplo 4.2 and 4.2.1 - i think 4.3 is differnt now). We have 400+ solaris servers and we have always had a nightmare of a time trying to keep up to date on packages.

edited on: 10-20 02:27
(0001206)
duncs (reporter)
2004-10-20 04:57
edited on: 2004-10-20 05:28

re: wget - i have stuck the pkg-get package into our jumpstart system, and this seemed the easiest way of ensuring there was a bog-standard wget install (that could be superceeded by installing a more up-to-date package - /var/pkg-get is last in the PATH). This way it should always work by only having to install 1 package instead of 2 or more to get pkg-get working.

One problem I have (working in a financial institution) is our security team do not want extra (\"unnecessary\") packages installed where it can be avoided and this was one of their rules.

BTW - i am also working on a possible solution to the dependency version checking for I, P and R (if you are interested in having it and when i prove it works...)

edited on: 10-20 02:28
(0001208)
phil (manager)
2004-10-20 13:57

Having to modify the catalog file seems like an extreme and unneccessary task.
Particularly if you plan to have per-package unique pkgadd files.
How about a nice simple standard /var/pkg-get/pkgask/CSWxxxxx ?
pkg-get could then check for the existance of a pkgadd file for a package,
directly before it pkgadds it.

My ownly reservation about this would be whether to go by PKGname, or software name. Perhaps I should check for both.
But in that case, I still need to decide on which would take priority if both are present.
(0001221)
duncs (reporter)
2004-10-25 09:46

I dont fully understand what you mean by the pkgask files being in /var/pkg-get/pkgask - however, if the repository contains a pkgask file without the catalog being modified, pkg-get will need to check for the pkgask for every package every time you run -U which to me seems a very \"expensive\" way of doing things, and modifying the catalog/description generator is a trivial task.

As for the software name - i wouldnt worry about that bit - pkgask files are specific to packages (and version of packages in most cases). In my mind the pkgask file should always match the package name, otherwise it can all get too confusing.
(0001222)
phil (manager)
2004-10-25 11:35

pkgadd files in the *repository*? nono. pkgadd files must be site-local.
you make your own. you would put them in /var/pkg-get/pkgask yourself.
(0001223)
duncs (reporter)
2004-10-25 11:44

This is the whole point of me running my own internal repository, so i don\'t have to locally admin any of my 400+ servers for such things. I guess i\'ll have to keep patching my own local copy for any new versions then. Oh well.
(0005595)
phil (manager)
2009-03-01 03:08

it's been a long time coming, i'm afraid... but i finally am having a "patch the heck out of pkg-get" day again :) and this bug has hit the top of the remaining list.

I have implemented some code changes, so that pkg-get 4.x will now check for BOTH a local pkgask file, and ALSO a GLOBAL pkg-ask file.
Going with our assumption that /opt/csw is globally shared, the global config is looked for in /opt/csw/etc/pkgask/

even if you dont currently nfs-share out /opt/csw, you could then choose to at least globally share /opt/csw/etc/pkgask.
hope this meets your needs.
(0005596)
phil (manager)
2009-03-01 03:10

PS: it hasnt quite yet been released :) but expect pkg-get 4.1 to be released to testing this weekend.

http://mirror.opencsw.org/testing.html [^]
(0005597)
phil (manager)
2009-03-01 03:12

Hmm. in retrospect, it doesnt quite make sense to have a globally shared /opt/csw, if you are adding packages locally. but at least the location is consistent; If you want global configurations, you can share out /opt/csw/etc.
Or config/replicate it with puppet or something, as you require.
That way, it can stay nice and automated, and globally consistant, one way or another.


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker