Ticket #10970: trac_10970_do_not_generate_pipestatus.patch

File trac_10970_do_not_generate_pipestatus.patch, 3.1 KB (added by vbraun, 10 years ago)

Patch to SAGE_ROOT repo

  • spkg/install

    # HG changeset patch
    # User Volker Braun <vbraun@stp.dias.ie>
    # Date 1300731901 25200
    # Node ID 17d10961bbc6d2aa9846636c6d50bd6c03898f40
    # Parent  15a38d81058ce7b146fd75a34a8a2b8b841fdb21
    Trac #10970: Remove pipestatus from spkg/install
    
    The $SAGE_ROOT/spkg/install has a here document that creates
    pipestatus. With the sage root repository, this is no longer needed
    as pipestatus is tracked by the repository.
    
    diff -r 15a38d81058c -r 17d10961bbc6 spkg/install
    a b  
    11#!/usr/bin/env bash
    22
    3 ###############################################################################
    4 # Check if pipestatus already exists, otherwise
    5 # create it to allow upgrade from Sage <4.5.  This is a temporary fix.
    6 # See trac 9528: http://trac.sagemath.org/sage_trac/ticket/9528
    7 # Go about 56 lines down from here for the actual "install" script.
    8 ###############################################################################
    9 if [ ! -f pipestatus ]; then
    10   echo "Creating pipestatus."
    11   cat >pipestatus <<'EOF'
    12 #!/usr/bin/env bash
    13 #
    14 # spkg/pipestatus: run two commands in a pipeline CMD1 | CMD2 and exit
    15 # with the status of the last command to exit with a non-zero status, or
    16 # zero if no command exited with a non-zero status.
    17 #
    18 # This is useful, for example, in a Makefile, where we tee the output
    19 # of a build command to a log file.  Using pipestatus, make will stop if
    20 # tee succeeds but a preceding command in the pipeline fails.
    21 #
    22 # Syntactically, the command executed is "CMD1 | CMD2" where CMD1 and
    23 # CMD2 are *not* treated as atoms.  If CMD1 is "A && B" and CMD2 is "C",
    24 # then pipestatus CMD1 CMD2 will act as A && (B | C).  This also implies
    25 # that CMD1 and CMD2 *MUST NOT* contain pipes, or this script will break.
    26 #
    27 # IMPORTANT: if you edit this file, be sure to also edit spkg/install
    28 #            where this file is created for upgrading.
    29 #
    30 #
    31 # AUTHORS:
    32 #
    33 # - Jeroen Demeyer (2010-12-19): complete rewrite (#10339)
    34 #
    35 #*****************************************************************************
    36 #       Copyright (C) 2010 Jeroen Demeyer <jdemeyer@cage.ugent.be>
    37 #
    38 #  Distributed under the terms of the GNU General Public License (GPL)
    39 #  as published by the Free Software Foundation; either version 2 of
    40 #  the License, or (at your option) any later version.
    41 #                  http://www.gnu.org/licenses/
    42 #*****************************************************************************
    43 
    44 
    45 if [ $# -ne 2 ] || [ -z "$1" -o -z "$2" ]; then
    46     echo >&2 "Usage: $0 CMD1 CMD2"
    47     echo >&2 "Run two commands in a pipeline 'CMD1 | CMD2' and exit with the status"
    48     echo >&2 "of the last command to exit with a non-zero status, or zero if no"
    49     echo >&2 "command exited with a non-zero status."
    50     exit 2
    51 fi
    52 
    53 eval "$1 | $2; pipestatus=(\${PIPESTATUS[*]})"
    54 
    55 if [ ${pipestatus[1]} -ne 0 ]; then
    56     exit ${pipestatus[1]}
    57 else
    58     exit ${pipestatus[0]}
    59 fi
    60 EOF
    61   chmod +x pipestatus
    62 fi
    63 
    64 ###############################################################################
    65 
    66 
    673CUR=`pwd`
    684cd ..
    695SAGE_ROOT=`pwd`