#13574: sage-spkg: check much earlier whether package is already installed
----------------------------------+-----------------------------------------
       Reporter:  jdemeyer        |         Owner:  GeorgSWeber 
           Type:  enhancement     |        Status:  needs_review
       Priority:  major           |     Milestone:  sage-5.5    
      Component:  build           |    Resolution:              
       Keywords:                  |   Work issues:              
Report Upstream:  N/A             |     Reviewers:              
        Authors:  Jeroen Demeyer  |     Merged in:              
   Dependencies:                  |      Stopgaps:              
----------------------------------+-----------------------------------------

Comment (by jhpalmieri):

 What should be the behavior of `sage --info mpir` in a binary
 distribution? I think that with this patch, the mpir spkg will be
 downloaded and SPKG.txt will be extracted. This is not very efficient.
 Either the command should exit with an appropriate error message, or we
 should just download
 [http://sagemath.org/packages/standard/mpir-2.4.0.p6.txt SPKG.txt]. I
 think it should be enough to change the URL to end with ".txt" instead of
 ".spkg".

 When looking for the spkg in cases 2a or 3, why not look in spkg/installed
 instead of spkg/standard and spkg/optional?
 {{{
 #!diff
 diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
 --- a/spkg/bin/sage-spkg
 +++ b/spkg/bin/sage-spkg
 @@ -224,15 +224,14 @@ if [ -f "$PKG_SRC" ]; then
      fi
  elif [ -z "$PKG_HAS_PATH" ]; then
      # If PKG_SRC is not an existing file and doesn't contain a slash,
 -    # we are in case 2a or 3.  Try to find a package in spkg/standard
 -    # or spkg/optional (or other possible directories under spkg).
 +    # we are in case 2a or 3.  Try to find a receipt in spkg/installed.
      cd "$SAGE_PACKAGES"
 -    for spkg in `ls -1t */${PKG_NAME}.spkg */${PKG_NAME}-*.spkg
 2>/dev/null`; do
 +    for spkg in `ls -1t installed/${PKG_NAME} installed/${PKG_NAME}-*
 2>/dev/null`; do
          if [ -f "$spkg" ]; then
              # Found a good package
 -            echo "Found package $PKG_NAME in spkg/$spkg"
 +            echo "Found receipt for package $PKG_NAME in spkg/$spkg"
              PKG_SRC="`pwd`/$spkg"
 -            PKG_NAME=`basename "$spkg" | sed 's/\.spkg$//'`
 +            PKG_NAME=`basename "$spkg"`
              break
          fi
      done
 }}}
 The script could actually terminate at this point, if `$FORCE -eq 0` etc.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13574#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to