This file is indexed.

/usr/share/sagemath/bin/sage-rsyncdist is in sagemath-common 8.1-7ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/env bash
#
# NOTE: This script is of little use after the git transition and
# will be deleted eventually.
#
# Create an rsyncable source distribution of Sage in dist/sage-rsync.tar.gz
# starting from a regular sdist tarball.
#
# This is mostly useful for regular automatic testing of Sage.
#
# All spkgs in spkg/standard are stored extracted: instead of a file
# spkg/standard/atlas-3.8.4.spkg, there is a directory
# spkg/standard/atlas/ (note the directory has no version number).
# In the tarball, there is no top-level directory like "sage-5.0",
# files like "Makefile" are stored directly at the top level.
#
# Running this script requires:
#  * GNU tar
#  * gzip with --rsyncable patch
#
# However, there are no special requirements for *building* from an
# rsyncable distribution.
#
#
# To build from an rsyncable tarball, do the following:
#   mkdir sage-VERSION
#   cd sage-VERSION
#   tar xzf /path/to/sage-rsync.tar.gz
#   ./rsyncpack.sh     # to repack the directories into spkgs
#   make               # as usual
#
#
# AUTHOR: Jeroen Demeyer (2011-12-10): Trac ticket #12106
#
#*****************************************************************************
#       Copyright (C) 2011 Jeroen Demeyer <jdemeyer@cage.ugent.be>
#
#  Distributed under the terms of the GNU General Public License (GPL)
#  as published by the Free Software Foundation; either version 2 of
#  the License, or (at your option) any later version.
#                  http://www.gnu.org/licenses/
#*****************************************************************************


# Exit on error
set -e


# Check whether gzip supports --rsyncable, otherwise bail out immediately
if ! gzip --rsyncable </dev/null >/dev/null 2>/dev/null; then
    echo >&2 "It seems your version of gzip does not support the --rsyncable option."
    echo >&2 "In order to run sage --rsyncdist, you need a patched gzip."
    echo >&2 "For more information about the patch, see"
    echo >&2 "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=118118"
    exit 1
fi


# If $1 starts with "sage-", remove this prefix
SAGE_VERSION=`echo "$1" | sed 's/^sage-//'`
if [ -z "$SAGE_VERSION" ]; then
    echo >&2 "Usage: $0 <SAGE_VERSION>"
    echo >&2 "Create an rsyncable source distribution of Sage"
    exit 2
fi

# Run this script from SAGE_ROOT
[ -z "$SAGE_ROOT" ] || cd "$SAGE_ROOT"

if [ ! -r "dist/sage-$SAGE_VERSION.tar" ]; then
    echo >&2 "The sdist tarball dist/sage-$SAGE_VERSION.tar has not been created yet."
    echo >&2 "You should call this script after running ./sage --sdist
    exit 1
fi

# Extract existing sdist tarball
mkdir -p "dist/sage-rsync"
cd "dist/sage-rsync"
echo "Extracting sdist tarball sage-$SAGE_VERSION.tar"
tar -x --strip-components 1 -f "../sage-$SAGE_VERSION.tar"

# Create a shell script to repack the spkgs.  The repacked spkgs will
# not be compressed, but that's not a problem.  It just means one
# should not make an sdist from an rsyncable Sage distribution.
exec 5>rsyncpack.sh
chmod 755 rsyncpack.sh
cat >&5 <<EOF
#!/usr/bin/env bash
set -e

cd spkg/standard
EOF

# Extract all spkgs and rename them to their base name
# (atlas-3.8.4.spkg would be extracted to a directory atlas/)
cd spkg/standard
for spkg in *.spkg; do
    # Determine bare spkg name, without version number
    spkgnamever=`echo "$spkg" | sed 's|\.spkg$||'`
    spkgname=`echo "$spkgnamever" | sed -n 's|^\([^-]*[^0-9]*\)-[0-9].*$|\1|p'`

    if [ "$spkgname" = "" ]; then
        echo >&2 "Cannot determine base package name for $spkg"
        exit 1
    fi

    echo "Extracting $spkg to directory $spkgname"
    ( bzip2 -cd $spkg || gzip -cd $spkg || cat $spkg ) 2>/dev/null |\
        tar -x --delay-directory-restore
    rm $spkg
    mv "$spkgnamever" "$spkgname"

    echo "mv '$spkgname' '$spkgnamever' && tar c '$spkgnamever' >'$spkg' && rm -rf '$spkgnamever'" >&5
done
exec 5<&-
cd ../..

# Put files in the tar file in *alphabetical* order, which is much
# better for rsync.  Print directories with trailing slash for
# better sorting and skip '.'
echo "Packing tarball sage-rsync.tar.gz"
find . '!' -name . '(' -type d -printf '%P/\n' -or -printf '%P\n' ')' |\
sort |\
tar -c --no-recursion -T /dev/stdin |\
gzip --best --rsyncable >../sage-rsync.tar.gz