Ticket #14538: 14538_spkg_huge.patch

File 14538_spkg_huge.patch, 3.1 KB (added by jdemeyer, 6 years ago)
  • spkg/bin/sage-spkg

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1367919066 -7200
    # Node ID ee2d0432876a071e52840f96afa3f63a87ec4c66
    # Parent  94a43085c264ab5e5f26c203cb93b867efd1a372
    Support "huge" packages (not mirrored)
    
    diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
    a b  
    265265    else
    266266        # Handle cases 2a and 3, where the package name is something
    267267        # like "foo" or "foo-1.2.3".
    268         URL_BASE="${SAGE_SERVER}packages"
    269         for repo in optional experimental standard archive; do
     268        for repo in optional experimental standard huge archive; do
    270269            # Download the list of packages.
    271270            echo ">>> Checking online list of $repo packages."
     271
     272            # Huge packages are not mirrored
     273            if [ $repo = huge ]; then
     274                URL_REPO="http://www.sagemath.org/spkg/huge"
     275            else
     276                URL_REPO="${SAGE_SERVER}spkg/$repo"
     277            fi
     278
    272279            repolist="${repo}.list"
    273             sage-download-file "$URL_BASE/$repo/list" >$repolist
     280            sage-download-file "$URL_REPO/list" >$repolist
    274281            if [ $? -ne 0 ]; then
    275                 echo >&2 "Error: failed to download $URL_BASE/$repo/list, aborting"
     282                echo >&2 "Error: failed to download $URL_REPO/list, aborting"
    276283                rm -f $repolist
    277284                exit 1
    278285            fi
     
    286293            if [ -n "$pkg" ]; then
    287294                echo ">>> Found $pkg"
    288295                PKG_NAME=$pkg
     296
    289297                # If INFO is set, try downloading only the .txt file
    290298                if [ $INFO -eq 1 ]; then
    291                     PKG_URL="$URL_BASE/$repo/$pkg.txt"
     299                    PKG_URL="$URL_REPO/$pkg.txt"
    292300                    sage-download-file 2>/dev/null "$PKG_URL" && exit 0
    293301                    # If the download failed (for whatever reason),
    294302                    # fall through and use the .spkg file.
     
    318326                        esac
    319327                    fi
    320328                fi
    321                 PKG_URL="$URL_BASE/$repo/$pkg.spkg"
     329                PKG_URL="$URL_REPO/$pkg.spkg"
    322330                break
    323331            fi
    324332        done
    325333        if [ -z "$PKG_URL" ]; then
    326             echo >&2 "Error: could not find a package matching $PKG_NAME in $URL_BASE"
     334            echo >&2 "Error: could not find a package matching $PKG_NAME on $SAGE_SERVER"
    327335            exit 1
    328336        fi
    329337
     
    340348    # Download to a temporary file (such that we don't end up with a
    341349    # corrupted .spkg file).
    342350    PKG_TMP="$PKG_NAME.tmp"
    343     echo ">>> Downloading $PKG_NAME.spkg."
     351    echo ">>> Downloading $PKG_URL."
    344352    sage-download-file "$PKG_URL" >"$PKG_TMP"
    345353    if [ $? -ne 0 ]; then
    346354        # Delete failed download
     
    423431echo "Extracting package $PKG_SRC"
    424432ls -l "$PKG_SRC"
    425433
    426 uncompress_spkg "$PKG_SRC" | tar x${UNTAR_VERBOSE}f - --no-same-owner 
     434uncompress_spkg "$PKG_SRC" | tar x${UNTAR_VERBOSE}f - --no-same-owner
    427435if [ $? -ne 0 ]; then
    428436    echo >&2 "Error: failed to extract $PKG_SRC"
    429437    exit 1