Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- parrot/bin/2to3 +5 -0
- parrot/bin/accelerate-estimate-memory +8 -0
- parrot/bin/bzip2 +3 -0
- parrot/bin/bzless +61 -0
- parrot/bin/convert-caffe2-to-onnx +8 -0
- parrot/bin/deepspeed.pt +3 -0
- parrot/bin/distro +8 -0
- parrot/bin/ds +6 -0
- parrot/bin/ds_report +6 -0
- parrot/bin/ds_ssh +34 -0
- parrot/bin/gradio +8 -0
- parrot/bin/httpx +8 -0
- parrot/bin/imageio_remove_bin +8 -0
- parrot/bin/infocmp +0 -0
- parrot/bin/infotocap +0 -0
- parrot/bin/l2m +8 -0
- parrot/bin/lzdiff +220 -0
- parrot/bin/lzmadec +0 -0
- parrot/bin/lzmainfo +0 -0
- parrot/bin/lzmore +80 -0
- parrot/bin/markdown2 +8 -0
- parrot/bin/mistral-chat +8 -0
- parrot/bin/normalizer +8 -0
- parrot/bin/openai +8 -0
- parrot/bin/pip +8 -0
- parrot/bin/pip3.10 +8 -0
- parrot/bin/proton-viewer +8 -0
- parrot/bin/pydoc3.10 +5 -0
- parrot/bin/pygmentize +8 -0
- parrot/bin/sqlite3_analyzer +899 -0
- parrot/bin/tabs +0 -0
- parrot/bin/tabulate +8 -0
- parrot/bin/tclsh +0 -0
- parrot/bin/tclsh8.6 +0 -0
- parrot/bin/tic +0 -0
- parrot/bin/toe +0 -0
- parrot/bin/typer +8 -0
- parrot/bin/undill +22 -0
- parrot/bin/wb +8 -0
- parrot/bin/wish8.6 +0 -0
- parrot/bin/xzcmp +220 -0
- parrot/bin/xzdiff +220 -0
- parrot/bin/xzegrep +300 -0
- parrot/bin/xzfgrep +300 -0
- parrot/bin/xzgrep +300 -0
- parrot/bin/xzmore +80 -0
- parrot/compiler_compat/README +2 -0
- parrot/conda-meta/_openmp_mutex-5.1-1_gnu.json +43 -0
- parrot/conda-meta/bzip2-1.0.8-h5eee18b_6.json +219 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
parrot/bin/bzip2 filter=lfs diff=lfs merge=lfs -text
|
parrot/bin/2to3
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
import sys
|
| 3 |
+
from lib2to3.main import main
|
| 4 |
+
|
| 5 |
+
sys.exit(main("lib2to3.fixes"))
|
parrot/bin/accelerate-estimate-memory
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.estimate import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/bzip2
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed
|
| 3 |
+
size 299464
|
parrot/bin/bzless
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Bzmore wrapped for bzip2,
|
| 4 |
+
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
| 5 |
+
|
| 6 |
+
PATH="/usr/bin:$PATH"; export PATH
|
| 7 |
+
|
| 8 |
+
prog=`echo $0 | sed 's|.*/||'`
|
| 9 |
+
case "$prog" in
|
| 10 |
+
*less) more=less ;;
|
| 11 |
+
*) more=more ;;
|
| 12 |
+
esac
|
| 13 |
+
|
| 14 |
+
if test "`echo -n a`" = "-n a"; then
|
| 15 |
+
# looks like a SysV system:
|
| 16 |
+
n1=''; n2='\c'
|
| 17 |
+
else
|
| 18 |
+
n1='-n'; n2=''
|
| 19 |
+
fi
|
| 20 |
+
oldtty=`stty -g 2>/dev/null`
|
| 21 |
+
if stty -cbreak 2>/dev/null; then
|
| 22 |
+
cb='cbreak'; ncb='-cbreak'
|
| 23 |
+
else
|
| 24 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
| 25 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
| 26 |
+
fi
|
| 27 |
+
if test $? -eq 0 -a -n "$oldtty"; then
|
| 28 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 29 |
+
else
|
| 30 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 31 |
+
fi
|
| 32 |
+
|
| 33 |
+
if test $# = 0; then
|
| 34 |
+
if test -t 0; then
|
| 35 |
+
echo usage: $prog files...
|
| 36 |
+
else
|
| 37 |
+
bzip2 -cdfq | eval $more
|
| 38 |
+
fi
|
| 39 |
+
else
|
| 40 |
+
FIRST=1
|
| 41 |
+
for FILE
|
| 42 |
+
do
|
| 43 |
+
if test $FIRST -eq 0; then
|
| 44 |
+
echo $n1 "--More--(Next file: $FILE)$n2"
|
| 45 |
+
stty $cb -echo 2>/dev/null
|
| 46 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
| 47 |
+
stty $ncb echo 2>/dev/null
|
| 48 |
+
echo " "
|
| 49 |
+
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
|
| 50 |
+
exit
|
| 51 |
+
fi
|
| 52 |
+
fi
|
| 53 |
+
if test "$ANS" != 's'; then
|
| 54 |
+
echo "------> $FILE <------"
|
| 55 |
+
bzip2 -cdfq "$FILE" | eval $more
|
| 56 |
+
fi
|
| 57 |
+
if test -t; then
|
| 58 |
+
FIRST=0
|
| 59 |
+
fi
|
| 60 |
+
done
|
| 61 |
+
fi
|
parrot/bin/convert-caffe2-to-onnx
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from caffe2.python.onnx.bin.conversion import caffe2_to_onnx
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(caffe2_to_onnx())
|
parrot/bin/deepspeed.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b71dff48ed8d6b9db40fd642e9ace0ccd173ff5b220e4fde03ff943a63f5d907
|
| 3 |
+
size 114
|
parrot/bin/distro
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from distro.distro import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/ds
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
|
| 3 |
+
from deepspeed.launcher.runner import main
|
| 4 |
+
|
| 5 |
+
if __name__ == '__main__':
|
| 6 |
+
main()
|
parrot/bin/ds_report
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
|
| 3 |
+
from deepspeed.env_report import cli_main
|
| 4 |
+
|
| 5 |
+
if __name__ == '__main__':
|
| 6 |
+
cli_main()
|
parrot/bin/ds_ssh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Copyright 2020 The Microsoft DeepSpeed Team
|
| 4 |
+
|
| 5 |
+
command -v pdsh
|
| 6 |
+
if [ $? != 0 ]; then
|
| 7 |
+
echo "Cannot find pdsh, please install via 'apt-get install -y pdsh'"
|
| 8 |
+
exit 1
|
| 9 |
+
fi
|
| 10 |
+
|
| 11 |
+
hostfile=/job/hostfile
|
| 12 |
+
|
| 13 |
+
while getopts "h?f:" opt; do
|
| 14 |
+
case "$opt" in
|
| 15 |
+
h|\?)
|
| 16 |
+
echo "-f <hostfile>: specify a hostfile, defaults to /job/hostfile"
|
| 17 |
+
exit 0
|
| 18 |
+
;;
|
| 19 |
+
f)
|
| 20 |
+
hostfile=$OPTARG
|
| 21 |
+
shift $((OPTIND-1))
|
| 22 |
+
;;
|
| 23 |
+
esac
|
| 24 |
+
done
|
| 25 |
+
|
| 26 |
+
echo "hostfile=$hostfile"
|
| 27 |
+
|
| 28 |
+
if [ -f $hostfile ]; then
|
| 29 |
+
hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
|
| 30 |
+
export PDSH_RCMD_TYPE=ssh
|
| 31 |
+
pdsh -w ${hosts} $@
|
| 32 |
+
else
|
| 33 |
+
echo "Missing hostfile at ${hostfile}, unable to proceed"
|
| 34 |
+
fi
|
parrot/bin/gradio
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from gradio.cli import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
parrot/bin/httpx
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from httpx import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/imageio_remove_bin
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from imageio.__main__ import remove_bin_main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(remove_bin_main())
|
parrot/bin/infocmp
ADDED
|
Binary file (63.5 kB). View file
|
|
|
parrot/bin/infotocap
ADDED
|
Binary file (92.2 kB). View file
|
|
|
parrot/bin/l2m
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from latex2mathml.converter import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/lzdiff
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 25 |
+
# environment variables.
|
| 26 |
+
xz='xz --format=auto'
|
| 27 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 28 |
+
|
| 29 |
+
case ${0##*/} in
|
| 30 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
| 31 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
| 32 |
+
esac
|
| 33 |
+
|
| 34 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 35 |
+
|
| 36 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
| 37 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
| 38 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
| 39 |
+
FILE1 from which the compression format suffix has been stripped.
|
| 40 |
+
|
| 41 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
| 42 |
+
|
| 43 |
+
Report bugs to <xz@tukaani.org>."
|
| 44 |
+
|
| 45 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 46 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 47 |
+
escape='
|
| 48 |
+
s/'\''/'\''\\'\'''\''/g
|
| 49 |
+
$s/X$/'\''/
|
| 50 |
+
'
|
| 51 |
+
|
| 52 |
+
while :; do
|
| 53 |
+
case $1 in
|
| 54 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
| 55 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
| 56 |
+
--) shift; break;;
|
| 57 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
| 58 |
+
-?*) cmp="$cmp '$1'";;
|
| 59 |
+
*) break;;
|
| 60 |
+
esac
|
| 61 |
+
shift
|
| 62 |
+
done
|
| 63 |
+
cmp="$cmp --"
|
| 64 |
+
|
| 65 |
+
for file; do
|
| 66 |
+
test "X$file" = X- || <"$file" || exit 2
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
| 70 |
+
xz1="$xz -qQ"
|
| 71 |
+
xz2="$xz -qQ"
|
| 72 |
+
xz_status=0
|
| 73 |
+
exec 3>&1
|
| 74 |
+
|
| 75 |
+
if test $# -eq 1; then
|
| 76 |
+
case $1 in
|
| 77 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
| 78 |
+
;;
|
| 79 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
| 80 |
+
xz1=bzip2;;
|
| 81 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
| 82 |
+
xz1=gzip;;
|
| 83 |
+
*[-.]lzo | *.tzo)
|
| 84 |
+
xz1=lzop;;
|
| 85 |
+
*[-.]zst | *.tzst)
|
| 86 |
+
xz1='zstd -q';;
|
| 87 |
+
*[-.]lz4)
|
| 88 |
+
xz1=lz4;;
|
| 89 |
+
*)
|
| 90 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
| 91 |
+
exit 2;;
|
| 92 |
+
esac
|
| 93 |
+
case $1 in
|
| 94 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
|
| 95 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
|
| 96 |
+
*.t[abglx]z)
|
| 97 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
| 98 |
+
*.tbz2)
|
| 99 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
| 100 |
+
*.tzo)
|
| 101 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
| 102 |
+
*.tzst)
|
| 103 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
| 104 |
+
esac
|
| 105 |
+
xz_status=$(
|
| 106 |
+
exec 4>&1
|
| 107 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
| 108 |
+
)
|
| 109 |
+
elif test $# -eq 2; then
|
| 110 |
+
case $1 in
|
| 111 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
| 112 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
| 113 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
| 114 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
| 115 |
+
*[-.]lz4) xz1=lz4;;
|
| 116 |
+
esac
|
| 117 |
+
case $2 in
|
| 118 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
| 119 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
| 120 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
| 121 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
| 122 |
+
*[-.]lz4) xz2=lz4;;
|
| 123 |
+
esac
|
| 124 |
+
case $1 in
|
| 125 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 126 |
+
case "$2" in
|
| 127 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 128 |
+
if test "$1$2" = --; then
|
| 129 |
+
xz_status=$(
|
| 130 |
+
exec 4>&1
|
| 131 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
| 132 |
+
eval "$cmp" - - >&3
|
| 133 |
+
)
|
| 134 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
| 135 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
| 136 |
+
# NOTE: xz_status will contain two numbers.
|
| 137 |
+
xz_status=$(
|
| 138 |
+
exec 4>&1
|
| 139 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 140 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
| 141 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
| 142 |
+
)
|
| 143 |
+
else
|
| 144 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
| 145 |
+
tmp=
|
| 146 |
+
trap '
|
| 147 |
+
test -n "$tmp" && rm -rf "$tmp"
|
| 148 |
+
(exit 2); exit 2
|
| 149 |
+
' HUP INT PIPE TERM 0
|
| 150 |
+
if type mktemp >/dev/null 2>&1; then
|
| 151 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
| 152 |
+
# the implementations from mktemp.org and GNU coreutils.
|
| 153 |
+
# It is important that the -t argument is the last argument
|
| 154 |
+
# and that no "--" is used between -t and the template argument.
|
| 155 |
+
# This way this command works on all implementations.
|
| 156 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
| 157 |
+
else
|
| 158 |
+
# Fallback code if mktemp is missing. This isn't as
|
| 159 |
+
# robust as using mktemp since this doesn't try with
|
| 160 |
+
# different file names in case of a file name conflict.
|
| 161 |
+
#
|
| 162 |
+
# There's no need to save the original umask since
|
| 163 |
+
# we don't create any non-temp files. Note that using
|
| 164 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
| 165 |
+
# create the dir with the default umask and chmod the
|
| 166 |
+
# the dir afterwards.
|
| 167 |
+
umask 0077
|
| 168 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
| 169 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
| 170 |
+
fi
|
| 171 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
| 172 |
+
xz_status=$(
|
| 173 |
+
exec 4>&1
|
| 174 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 175 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
| 176 |
+
)
|
| 177 |
+
cmp_status=$?
|
| 178 |
+
rm -rf "$tmp" || xz_status=$?
|
| 179 |
+
trap - HUP INT PIPE TERM 0
|
| 180 |
+
(exit $cmp_status)
|
| 181 |
+
fi;;
|
| 182 |
+
*)
|
| 183 |
+
xz_status=$(
|
| 184 |
+
exec 4>&1
|
| 185 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 186 |
+
eval "$cmp" - '"$2"' >&3
|
| 187 |
+
);;
|
| 188 |
+
esac;;
|
| 189 |
+
*)
|
| 190 |
+
case "$2" in
|
| 191 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 192 |
+
xz_status=$(
|
| 193 |
+
exec 4>&1
|
| 194 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
| 195 |
+
eval "$cmp" '"$1"' - >&3
|
| 196 |
+
);;
|
| 197 |
+
*)
|
| 198 |
+
eval "$cmp" '"$1"' '"$2"';;
|
| 199 |
+
esac;;
|
| 200 |
+
esac
|
| 201 |
+
else
|
| 202 |
+
printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2
|
| 203 |
+
exit 2
|
| 204 |
+
fi
|
| 205 |
+
|
| 206 |
+
cmp_status=$?
|
| 207 |
+
for num in $xz_status ; do
|
| 208 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
| 209 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
| 210 |
+
# has been decompressed. In that case we want to retain the exit status
|
| 211 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
| 212 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
| 213 |
+
# is ignored.
|
| 214 |
+
test "$num" -eq 0 && continue
|
| 215 |
+
test "$num" -ge 128 \
|
| 216 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
| 217 |
+
&& continue
|
| 218 |
+
exit 2
|
| 219 |
+
done
|
| 220 |
+
exit $cmp_status
|
parrot/bin/lzmadec
ADDED
|
Binary file (17.2 kB). View file
|
|
|
parrot/bin/lzmainfo
ADDED
|
Binary file (17 kB). View file
|
|
|
parrot/bin/lzmore
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 2001, 2002, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1992, 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT.
|
| 25 |
+
xz='xz --format=auto'
|
| 26 |
+
|
| 27 |
+
version='xzmore (XZ Utils) 5.6.4'
|
| 28 |
+
|
| 29 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
| 30 |
+
Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
|
| 31 |
+
|
| 32 |
+
Report bugs to <xz@tukaani.org>."
|
| 33 |
+
|
| 34 |
+
case $1 in
|
| 35 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
| 36 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
| 37 |
+
esac
|
| 38 |
+
|
| 39 |
+
oldtty=`stty -g 2>/dev/null`
|
| 40 |
+
if stty -cbreak 2>/dev/null; then
|
| 41 |
+
cb='cbreak'; ncb='-cbreak'
|
| 42 |
+
else
|
| 43 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
| 44 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
| 45 |
+
fi
|
| 46 |
+
if test $? -eq 0 && test -n "$oldtty"; then
|
| 47 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 48 |
+
else
|
| 49 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 50 |
+
fi
|
| 51 |
+
|
| 52 |
+
if test $# = 0; then
|
| 53 |
+
if test -t 0; then
|
| 54 |
+
printf '%s\n' "$usage"; exit 1
|
| 55 |
+
else
|
| 56 |
+
$xz -cdfqQ | eval "${PAGER:-more}"
|
| 57 |
+
fi
|
| 58 |
+
else
|
| 59 |
+
FIRST=1
|
| 60 |
+
for FILE; do
|
| 61 |
+
< "$FILE" || continue
|
| 62 |
+
if test $FIRST -eq 0; then
|
| 63 |
+
printf "%s--More--(Next file: %s)" "" "$FILE"
|
| 64 |
+
stty $cb -echo 2>/dev/null
|
| 65 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
| 66 |
+
stty $ncb echo 2>/dev/null
|
| 67 |
+
echo " "
|
| 68 |
+
case "$ANS" in
|
| 69 |
+
[eq]) exit;;
|
| 70 |
+
esac
|
| 71 |
+
fi
|
| 72 |
+
if test "$ANS" != 's'; then
|
| 73 |
+
printf '%s\n' "------> $FILE <------"
|
| 74 |
+
$xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}"
|
| 75 |
+
fi
|
| 76 |
+
if test -t 1; then
|
| 77 |
+
FIRST=0
|
| 78 |
+
fi
|
| 79 |
+
done
|
| 80 |
+
fi
|
parrot/bin/markdown2
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown2 import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/mistral-chat
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from mistral_inference.main import mistral_chat
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(mistral_chat())
|
parrot/bin/normalizer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from charset_normalizer.cli import cli_detect
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli_detect())
|
parrot/bin/openai
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from openai.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pip
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pip3.10
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pip._internal.cli.main import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/proton-viewer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from triton.profiler.viewer import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/pydoc3.10
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python3.10
|
| 2 |
+
|
| 3 |
+
import pydoc
|
| 4 |
+
if __name__ == '__main__':
|
| 5 |
+
pydoc.cli()
|
parrot/bin/pygmentize
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from pygments.cmdline import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/sqlite3_analyzer
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/sh
|
| 2 |
+
# restart with tclsh \
|
| 3 |
+
exec tclsh "$0" ${1+"$@"}
|
| 4 |
+
package require sqlite3
|
| 5 |
+
|
| 6 |
+
# Run this TCL script using an SQLite-enabled TCL interpreter to get a report
|
| 7 |
+
# on how much disk space is used by a particular data to actually store data
|
| 8 |
+
# versus how much space is unused.
|
| 9 |
+
#
|
| 10 |
+
# The dbstat virtual table is required.
|
| 11 |
+
#
|
| 12 |
+
|
| 13 |
+
if {[catch {
|
| 14 |
+
|
| 15 |
+
# Argument $tname is the name of a table within the database opened by
|
| 16 |
+
# database handle [db]. Return true if it is a WITHOUT ROWID table, or
|
| 17 |
+
# false otherwise.
|
| 18 |
+
#
|
| 19 |
+
proc is_without_rowid {tname} {
|
| 20 |
+
set t [string map {' ''} $tname]
|
| 21 |
+
db eval "PRAGMA index_list = '$t'" o {
|
| 22 |
+
if {$o(origin) == "pk"} {
|
| 23 |
+
set n $o(name)
|
| 24 |
+
if {0==[db one { SELECT count(*) FROM sqlite_schema WHERE name=$n }]} {
|
| 25 |
+
return 1
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
return 0
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# Read and run TCL commands from standard input. Used to implement
|
| 33 |
+
# the --tclsh option.
|
| 34 |
+
#
|
| 35 |
+
proc tclsh {} {
|
| 36 |
+
set line {}
|
| 37 |
+
while {![eof stdin]} {
|
| 38 |
+
if {$line!=""} {
|
| 39 |
+
puts -nonewline "> "
|
| 40 |
+
} else {
|
| 41 |
+
puts -nonewline "% "
|
| 42 |
+
}
|
| 43 |
+
flush stdout
|
| 44 |
+
append line [gets stdin]
|
| 45 |
+
if {[info complete $line]} {
|
| 46 |
+
if {[catch {uplevel #0 $line} result]} {
|
| 47 |
+
puts stderr "Error: $result"
|
| 48 |
+
} elseif {$result!=""} {
|
| 49 |
+
puts $result
|
| 50 |
+
}
|
| 51 |
+
set line {}
|
| 52 |
+
} else {
|
| 53 |
+
append line \n
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Get the name of the database to analyze
|
| 60 |
+
#
|
| 61 |
+
proc usage {} {
|
| 62 |
+
set argv0 [file rootname [file tail [info script]]]
|
| 63 |
+
puts stderr "Usage: $argv0 ?--pageinfo? ?--stats? database-filename"
|
| 64 |
+
puts stderr {
|
| 65 |
+
Analyze the SQLite3 database file specified by the "database-filename"
|
| 66 |
+
argument and output a report detailing size and storage efficiency
|
| 67 |
+
information for the database and its constituent tables and indexes.
|
| 68 |
+
|
| 69 |
+
Options:
|
| 70 |
+
|
| 71 |
+
--pageinfo Show how each page of the database-file is used
|
| 72 |
+
|
| 73 |
+
--stats Output SQL text that creates a new database containing
|
| 74 |
+
statistics about the database that was analyzed
|
| 75 |
+
|
| 76 |
+
--tclsh Run the built-in TCL interpreter interactively (for debugging)
|
| 77 |
+
|
| 78 |
+
--version Show the version number of SQLite
|
| 79 |
+
}
|
| 80 |
+
exit 1
|
| 81 |
+
}
|
| 82 |
+
set file_to_analyze {}
|
| 83 |
+
set flags(-pageinfo) 0
|
| 84 |
+
set flags(-stats) 0
|
| 85 |
+
set flags(-debug) 0
|
| 86 |
+
append argv {}
|
| 87 |
+
foreach arg $argv {
|
| 88 |
+
if {[regexp {^-+pageinfo$} $arg]} {
|
| 89 |
+
set flags(-pageinfo) 1
|
| 90 |
+
} elseif {[regexp {^-+stats$} $arg]} {
|
| 91 |
+
set flags(-stats) 1
|
| 92 |
+
} elseif {[regexp {^-+debug$} $arg]} {
|
| 93 |
+
set flags(-debug) 1
|
| 94 |
+
} elseif {[regexp {^-+tclsh$} $arg]} {
|
| 95 |
+
tclsh
|
| 96 |
+
exit 0
|
| 97 |
+
} elseif {[regexp {^-+version$} $arg]} {
|
| 98 |
+
sqlite3 mem :memory:
|
| 99 |
+
puts [mem one {SELECT sqlite_version()||' '||sqlite_source_id()}]
|
| 100 |
+
mem close
|
| 101 |
+
exit 0
|
| 102 |
+
} elseif {[regexp {^-} $arg]} {
|
| 103 |
+
puts stderr "Unknown option: $arg"
|
| 104 |
+
usage
|
| 105 |
+
} elseif {$file_to_analyze!=""} {
|
| 106 |
+
usage
|
| 107 |
+
} else {
|
| 108 |
+
set file_to_analyze $arg
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
if {$file_to_analyze==""} usage
|
| 112 |
+
set root_filename $file_to_analyze
|
| 113 |
+
regexp {^file:(//)?([^?]*)} $file_to_analyze all x1 root_filename
|
| 114 |
+
if {![file exists $root_filename]} {
|
| 115 |
+
puts stderr "No such file: $root_filename"
|
| 116 |
+
exit 1
|
| 117 |
+
}
|
| 118 |
+
if {![file readable $root_filename]} {
|
| 119 |
+
puts stderr "File is not readable: $root_filename"
|
| 120 |
+
exit 1
|
| 121 |
+
}
|
| 122 |
+
set true_file_size [file size $root_filename]
|
| 123 |
+
if {$true_file_size<512} {
|
| 124 |
+
puts stderr "Empty or malformed database: $root_filename"
|
| 125 |
+
exit 1
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
# Compute the total file size assuming test_multiplexor is being used.
|
| 129 |
+
# Assume that SQLITE_ENABLE_8_3_NAMES might be enabled
|
| 130 |
+
#
|
| 131 |
+
set extension [file extension $root_filename]
|
| 132 |
+
set pattern $root_filename
|
| 133 |
+
append pattern {[0-3][0-9][0-9]}
|
| 134 |
+
foreach f [glob -nocomplain $pattern] {
|
| 135 |
+
incr true_file_size [file size $f]
|
| 136 |
+
set extension {}
|
| 137 |
+
}
|
| 138 |
+
if {[string length $extension]>=2 && [string length $extension]<=4} {
|
| 139 |
+
set pattern [file rootname $root_filename]
|
| 140 |
+
append pattern {.[0-3][0-9][0-9]}
|
| 141 |
+
foreach f [glob -nocomplain $pattern] {
|
| 142 |
+
incr true_file_size [file size $f]
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
# Open the database
|
| 147 |
+
#
|
| 148 |
+
if {[catch {sqlite3 db $file_to_analyze -uri 1} msg]} {
|
| 149 |
+
puts stderr "error trying to open $file_to_analyze: $msg"
|
| 150 |
+
exit 1
|
| 151 |
+
}
|
| 152 |
+
if {$flags(-debug)} {
|
| 153 |
+
proc dbtrace {txt} {puts $txt; flush stdout;}
|
| 154 |
+
db trace ::dbtrace
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
# Make sure all required compile-time options are available
|
| 158 |
+
#
|
| 159 |
+
if {![db exists {SELECT 1 FROM pragma_compile_options
|
| 160 |
+
WHERE compile_options='ENABLE_DBSTAT_VTAB'}]} {
|
| 161 |
+
puts "The SQLite database engine linked with this application\
|
| 162 |
+
lacks required capabilities. Recompile using the\
|
| 163 |
+
-DSQLITE_ENABLE_DBSTAT_VTAB compile-time option to fix\
|
| 164 |
+
this problem."
|
| 165 |
+
exit 1
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
db eval {SELECT count(*) FROM sqlite_schema}
|
| 169 |
+
set pageSize [expr {wide([db one {PRAGMA page_size}])}]
|
| 170 |
+
|
| 171 |
+
if {$flags(-pageinfo)} {
|
| 172 |
+
db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
|
| 173 |
+
db eval {SELECT name, path, pageno FROM temp.stat ORDER BY pageno} {
|
| 174 |
+
puts "$pageno $name $path"
|
| 175 |
+
}
|
| 176 |
+
exit 0
|
| 177 |
+
}
|
| 178 |
+
if {$flags(-stats)} {
|
| 179 |
+
db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
|
| 180 |
+
puts "BEGIN;"
|
| 181 |
+
puts "CREATE TABLE stats("
|
| 182 |
+
puts " name STRING, /* Name of table or index */"
|
| 183 |
+
puts " path INTEGER, /* Path to page from root */"
|
| 184 |
+
puts " pageno INTEGER, /* Page number */"
|
| 185 |
+
puts " pagetype STRING, /* 'internal', 'leaf' or 'overflow' */"
|
| 186 |
+
puts " ncell INTEGER, /* Cells on page (0 for overflow) */"
|
| 187 |
+
puts " payload INTEGER, /* Bytes of payload on this page */"
|
| 188 |
+
puts " unused INTEGER, /* Bytes of unused space on this page */"
|
| 189 |
+
puts " mx_payload INTEGER, /* Largest payload size of all cells */"
|
| 190 |
+
puts " pgoffset INTEGER, /* Offset of page in file */"
|
| 191 |
+
puts " pgsize INTEGER /* Size of the page */"
|
| 192 |
+
puts ");"
|
| 193 |
+
db eval {SELECT quote(name) || ',' ||
|
| 194 |
+
quote(path) || ',' ||
|
| 195 |
+
quote(pageno) || ',' ||
|
| 196 |
+
quote(pagetype) || ',' ||
|
| 197 |
+
quote(ncell) || ',' ||
|
| 198 |
+
quote(payload) || ',' ||
|
| 199 |
+
quote(unused) || ',' ||
|
| 200 |
+
quote(mx_payload) || ',' ||
|
| 201 |
+
quote(pgoffset) || ',' ||
|
| 202 |
+
quote(pgsize) AS x FROM stat} {
|
| 203 |
+
puts "INSERT INTO stats VALUES($x);"
|
| 204 |
+
}
|
| 205 |
+
puts "COMMIT;"
|
| 206 |
+
exit 0
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
# In-memory database for collecting statistics. This script loops through
|
| 211 |
+
# the tables and indices in the database being analyzed, adding a row for each
|
| 212 |
+
# to an in-memory database (for which the schema is shown below). It then
|
| 213 |
+
# queries the in-memory db to produce the space-analysis report.
|
| 214 |
+
#
|
| 215 |
+
sqlite3 mem :memory:
|
| 216 |
+
if {$flags(-debug)} {
|
| 217 |
+
proc dbtrace {txt} {puts $txt; flush stdout;}
|
| 218 |
+
mem trace ::dbtrace
|
| 219 |
+
}
|
| 220 |
+
set tabledef {CREATE TABLE space_used(
|
| 221 |
+
name clob, -- Name of a table or index in the database file
|
| 222 |
+
tblname clob, -- Name of associated table
|
| 223 |
+
is_index boolean, -- TRUE if it is an index, false for a table
|
| 224 |
+
is_without_rowid boolean, -- TRUE if WITHOUT ROWID table
|
| 225 |
+
nentry int, -- Number of entries in the BTree
|
| 226 |
+
leaf_entries int, -- Number of leaf entries
|
| 227 |
+
depth int, -- Depth of the b-tree
|
| 228 |
+
payload int, -- Total amount of data stored in this table or index
|
| 229 |
+
ovfl_payload int, -- Total amount of data stored on overflow pages
|
| 230 |
+
ovfl_cnt int, -- Number of entries that use overflow
|
| 231 |
+
mx_payload int, -- Maximum payload size
|
| 232 |
+
int_pages int, -- Number of interior pages used
|
| 233 |
+
leaf_pages int, -- Number of leaf pages used
|
| 234 |
+
ovfl_pages int, -- Number of overflow pages used
|
| 235 |
+
int_unused int, -- Number of unused bytes on interior pages
|
| 236 |
+
leaf_unused int, -- Number of unused bytes on primary pages
|
| 237 |
+
ovfl_unused int, -- Number of unused bytes on overflow pages
|
| 238 |
+
gap_cnt int, -- Number of gaps in the page layout
|
| 239 |
+
compressed_size int -- Total bytes stored on disk
|
| 240 |
+
);}
|
| 241 |
+
mem eval $tabledef
|
| 242 |
+
|
| 243 |
+
# Create a temporary "dbstat" virtual table.
|
| 244 |
+
#
|
| 245 |
+
db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
|
| 246 |
+
db eval {CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat
|
| 247 |
+
ORDER BY name, path}
|
| 248 |
+
db eval {DROP TABLE temp.stat}
|
| 249 |
+
|
| 250 |
+
set isCompressed 0
|
| 251 |
+
set compressOverhead 0
|
| 252 |
+
set depth 0
|
| 253 |
+
set sql { SELECT name, tbl_name FROM sqlite_schema WHERE rootpage>0 }
|
| 254 |
+
foreach {name tblname} [concat sqlite_schema sqlite_schema [db eval $sql]] {
|
| 255 |
+
|
| 256 |
+
set is_index [expr {$name!=$tblname}]
|
| 257 |
+
set is_without_rowid [is_without_rowid $name]
|
| 258 |
+
db eval {
|
| 259 |
+
SELECT
|
| 260 |
+
sum(ncell) AS nentry,
|
| 261 |
+
sum((pagetype=='leaf')*ncell) AS leaf_entries,
|
| 262 |
+
sum(payload) AS payload,
|
| 263 |
+
sum((pagetype=='overflow') * payload) AS ovfl_payload,
|
| 264 |
+
sum(path LIKE '%+000000') AS ovfl_cnt,
|
| 265 |
+
max(mx_payload) AS mx_payload,
|
| 266 |
+
sum(pagetype=='internal') AS int_pages,
|
| 267 |
+
sum(pagetype=='leaf') AS leaf_pages,
|
| 268 |
+
sum(pagetype=='overflow') AS ovfl_pages,
|
| 269 |
+
sum((pagetype=='internal') * unused) AS int_unused,
|
| 270 |
+
sum((pagetype=='leaf') * unused) AS leaf_unused,
|
| 271 |
+
sum((pagetype=='overflow') * unused) AS ovfl_unused,
|
| 272 |
+
sum(pgsize) AS compressed_size,
|
| 273 |
+
max((length(CASE WHEN path LIKE '%+%' THEN '' ELSE path END)+3)/4)
|
| 274 |
+
AS depth
|
| 275 |
+
FROM temp.dbstat WHERE name = $name
|
| 276 |
+
} break
|
| 277 |
+
|
| 278 |
+
set total_pages [expr {$leaf_pages+$int_pages+$ovfl_pages}]
|
| 279 |
+
set storage [expr {$total_pages*$pageSize}]
|
| 280 |
+
if {!$isCompressed && $storage>$compressed_size} {
|
| 281 |
+
set isCompressed 1
|
| 282 |
+
set compressOverhead 14
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
# Column 'gap_cnt' is set to the number of non-contiguous entries in the
|
| 286 |
+
# list of pages visited if the b-tree structure is traversed in a top-down
|
| 287 |
+
# fashion (each node visited before its child-tree is passed). Any overflow
|
| 288 |
+
# chains present are traversed from start to finish before any child-tree
|
| 289 |
+
# is.
|
| 290 |
+
#
|
| 291 |
+
set gap_cnt 0
|
| 292 |
+
set prev 0
|
| 293 |
+
db eval {
|
| 294 |
+
SELECT pageno, pagetype FROM temp.dbstat
|
| 295 |
+
WHERE name=$name
|
| 296 |
+
ORDER BY pageno
|
| 297 |
+
} {
|
| 298 |
+
if {$prev>0 && $pagetype=="leaf" && $pageno!=$prev+1} {
|
| 299 |
+
incr gap_cnt
|
| 300 |
+
}
|
| 301 |
+
set prev $pageno
|
| 302 |
+
}
|
| 303 |
+
mem eval {
|
| 304 |
+
INSERT INTO space_used VALUES(
|
| 305 |
+
$name,
|
| 306 |
+
$tblname,
|
| 307 |
+
$is_index,
|
| 308 |
+
$is_without_rowid,
|
| 309 |
+
$nentry,
|
| 310 |
+
$leaf_entries,
|
| 311 |
+
$depth,
|
| 312 |
+
$payload,
|
| 313 |
+
$ovfl_payload,
|
| 314 |
+
$ovfl_cnt,
|
| 315 |
+
$mx_payload,
|
| 316 |
+
$int_pages,
|
| 317 |
+
$leaf_pages,
|
| 318 |
+
$ovfl_pages,
|
| 319 |
+
$int_unused,
|
| 320 |
+
$leaf_unused,
|
| 321 |
+
$ovfl_unused,
|
| 322 |
+
$gap_cnt,
|
| 323 |
+
$compressed_size
|
| 324 |
+
);
|
| 325 |
+
}
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
proc integerify {real} {
|
| 329 |
+
if {[string is double -strict $real]} {
|
| 330 |
+
return [expr {wide($real)}]
|
| 331 |
+
} else {
|
| 332 |
+
return 0
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
mem function int integerify
|
| 336 |
+
|
| 337 |
+
# Quote a string for use in an SQL query. Examples:
|
| 338 |
+
#
|
| 339 |
+
# [quote {hello world}] == {'hello world'}
|
| 340 |
+
# [quote {hello world's}] == {'hello world''s'}
|
| 341 |
+
#
|
| 342 |
+
proc quote {txt} {
|
| 343 |
+
return [string map {' ''} $txt]
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
# Output a title line
|
| 347 |
+
#
|
| 348 |
+
proc titleline {title} {
|
| 349 |
+
if {$title==""} {
|
| 350 |
+
puts [string repeat * 79]
|
| 351 |
+
} else {
|
| 352 |
+
set len [string length $title]
|
| 353 |
+
set stars [string repeat * [expr {79-$len-5}]]
|
| 354 |
+
puts "*** $title $stars"
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
# Generate a single line of output in the statistics section of the
|
| 359 |
+
# report.
|
| 360 |
+
#
|
| 361 |
+
proc statline {title value {extra {}}} {
|
| 362 |
+
set len [string length $title]
|
| 363 |
+
set dots [string repeat . [expr {50-$len}]]
|
| 364 |
+
set len [string length $value]
|
| 365 |
+
set sp2 [string range { } $len end]
|
| 366 |
+
if {$extra ne ""} {
|
| 367 |
+
set extra " $extra"
|
| 368 |
+
}
|
| 369 |
+
puts "$title$dots $value$sp2$extra"
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
# Generate a formatted percentage value for $num/$denom
|
| 373 |
+
#
|
| 374 |
+
proc percent {num denom {of {}}} {
|
| 375 |
+
if {$denom==0.0} {return ""}
|
| 376 |
+
set v [expr {$num*100.0/$denom}]
|
| 377 |
+
set of {}
|
| 378 |
+
if {$v==100.0 || $v<0.001 || ($v>1.0 && $v<99.0)} {
|
| 379 |
+
return [format {%5.1f%% %s} $v $of]
|
| 380 |
+
} elseif {$v<0.1 || $v>99.9} {
|
| 381 |
+
return [format {%7.3f%% %s} $v $of]
|
| 382 |
+
} else {
|
| 383 |
+
return [format {%6.2f%% %s} $v $of]
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
proc divide {num denom} {
|
| 388 |
+
if {$denom==0} {return 0.0}
|
| 389 |
+
return [format %.2f [expr {double($num)/double($denom)}]]
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
# Generate a subreport that covers some subset of the database.
|
| 393 |
+
# the $where clause determines which subset to analyze.
|
| 394 |
+
#
|
| 395 |
+
proc subreport {title where showFrag} {
|
| 396 |
+
global pageSize file_pgcnt compressOverhead
|
| 397 |
+
|
| 398 |
+
# Query the in-memory database for the sum of various statistics
|
| 399 |
+
# for the subset of tables/indices identified by the WHERE clause in
|
| 400 |
+
# $where. Note that even if the WHERE clause matches no rows, the
|
| 401 |
+
# following query returns exactly one row (because it is an aggregate).
|
| 402 |
+
#
|
| 403 |
+
# The results of the query are stored directly by SQLite into local
|
| 404 |
+
# variables (i.e. $nentry, $payload etc.).
|
| 405 |
+
#
|
| 406 |
+
mem eval "
|
| 407 |
+
SELECT
|
| 408 |
+
int(sum(
|
| 409 |
+
CASE WHEN (is_without_rowid OR is_index) THEN nentry
|
| 410 |
+
ELSE leaf_entries
|
| 411 |
+
END
|
| 412 |
+
)) AS nentry,
|
| 413 |
+
int(sum(payload)) AS payload,
|
| 414 |
+
int(sum(ovfl_payload)) AS ovfl_payload,
|
| 415 |
+
max(mx_payload) AS mx_payload,
|
| 416 |
+
int(sum(ovfl_cnt)) as ovfl_cnt,
|
| 417 |
+
int(sum(leaf_pages)) AS leaf_pages,
|
| 418 |
+
int(sum(int_pages)) AS int_pages,
|
| 419 |
+
int(sum(ovfl_pages)) AS ovfl_pages,
|
| 420 |
+
int(sum(leaf_unused)) AS leaf_unused,
|
| 421 |
+
int(sum(int_unused)) AS int_unused,
|
| 422 |
+
int(sum(ovfl_unused)) AS ovfl_unused,
|
| 423 |
+
int(sum(gap_cnt)) AS gap_cnt,
|
| 424 |
+
int(sum(compressed_size)) AS compressed_size,
|
| 425 |
+
int(max(depth)) AS depth,
|
| 426 |
+
count(*) AS cnt
|
| 427 |
+
FROM space_used WHERE $where" {} {}
|
| 428 |
+
|
| 429 |
+
# Output the sub-report title, nicely decorated with * characters.
|
| 430 |
+
#
|
| 431 |
+
puts ""
|
| 432 |
+
titleline $title
|
| 433 |
+
puts ""
|
| 434 |
+
|
| 435 |
+
# Calculate statistics and store the results in TCL variables, as follows:
|
| 436 |
+
#
|
| 437 |
+
# total_pages: Database pages consumed.
|
| 438 |
+
# total_pages_percent: Pages consumed as a percentage of the file.
|
| 439 |
+
# storage: Bytes consumed.
|
| 440 |
+
# payload_percent: Payload bytes used as a percentage of $storage.
|
| 441 |
+
# total_unused: Unused bytes on pages.
|
| 442 |
+
# avg_payload: Average payload per btree entry.
|
| 443 |
+
# avg_fanout: Average fanout for internal pages.
|
| 444 |
+
# avg_unused: Average unused bytes per btree entry.
|
| 445 |
+
# avg_meta: Average metadata overhead per entry.
|
| 446 |
+
# ovfl_cnt_percent: Percentage of btree entries that use overflow pages.
|
| 447 |
+
#
|
| 448 |
+
set total_pages [expr {$leaf_pages+$int_pages+$ovfl_pages}]
|
| 449 |
+
set total_pages_percent [percent $total_pages $file_pgcnt]
|
| 450 |
+
set storage [expr {$total_pages*$pageSize}]
|
| 451 |
+
set payload_percent [percent $payload $storage {of storage consumed}]
|
| 452 |
+
set total_unused [expr {$ovfl_unused+$int_unused+$leaf_unused}]
|
| 453 |
+
set avg_payload [divide $payload $nentry]
|
| 454 |
+
set avg_unused [divide $total_unused $nentry]
|
| 455 |
+
set total_meta [expr {$storage - $payload - $total_unused}]
|
| 456 |
+
set total_meta [expr {$total_meta + 4*($ovfl_pages - $ovfl_cnt)}]
|
| 457 |
+
set meta_percent [percent $total_meta $storage {of metadata}]
|
| 458 |
+
set avg_meta [divide $total_meta $nentry]
|
| 459 |
+
if {$int_pages>0} {
|
| 460 |
+
# TODO: Is this formula correct?
|
| 461 |
+
set nTab [mem eval "
|
| 462 |
+
SELECT count(*) FROM (
|
| 463 |
+
SELECT DISTINCT tblname FROM space_used WHERE $where AND is_index=0
|
| 464 |
+
)
|
| 465 |
+
"]
|
| 466 |
+
set avg_fanout [mem eval "
|
| 467 |
+
SELECT (sum(leaf_pages+int_pages)-$nTab)/sum(int_pages) FROM space_used
|
| 468 |
+
WHERE $where
|
| 469 |
+
"]
|
| 470 |
+
set avg_fanout [format %.2f $avg_fanout]
|
| 471 |
+
}
|
| 472 |
+
set ovfl_cnt_percent [percent $ovfl_cnt $nentry {of all entries}]
|
| 473 |
+
|
| 474 |
+
# Print out the sub-report statistics.
|
| 475 |
+
#
|
| 476 |
+
statline {Percentage of total database} $total_pages_percent
|
| 477 |
+
statline {Number of entries} $nentry
|
| 478 |
+
statline {Bytes of storage consumed} $storage
|
| 479 |
+
if {$compressed_size!=$storage} {
|
| 480 |
+
set compressed_size [expr {$compressed_size+$compressOverhead*$total_pages}]
|
| 481 |
+
set pct [expr {$compressed_size*100.0/$storage}]
|
| 482 |
+
set pct [format {%5.1f%%} $pct]
|
| 483 |
+
statline {Bytes used after compression} $compressed_size $pct
|
| 484 |
+
}
|
| 485 |
+
statline {Bytes of payload} $payload $payload_percent
|
| 486 |
+
statline {Bytes of metadata} $total_meta $meta_percent
|
| 487 |
+
if {$cnt==1} {statline {B-tree depth} $depth}
|
| 488 |
+
statline {Average payload per entry} $avg_payload
|
| 489 |
+
statline {Average unused bytes per entry} $avg_unused
|
| 490 |
+
statline {Average metadata per entry} $avg_meta
|
| 491 |
+
if {[info exists avg_fanout]} {
|
| 492 |
+
statline {Average fanout} $avg_fanout
|
| 493 |
+
}
|
| 494 |
+
if {$showFrag && $total_pages>1} {
|
| 495 |
+
set fragmentation [percent $gap_cnt [expr {$total_pages-1}]]
|
| 496 |
+
statline {Non-sequential pages} $gap_cnt $fragmentation
|
| 497 |
+
}
|
| 498 |
+
statline {Maximum payload per entry} $mx_payload
|
| 499 |
+
statline {Entries that use overflow} $ovfl_cnt $ovfl_cnt_percent
|
| 500 |
+
if {$int_pages>0} {
|
| 501 |
+
statline {Index pages used} $int_pages
|
| 502 |
+
}
|
| 503 |
+
statline {Primary pages used} $leaf_pages
|
| 504 |
+
statline {Overflow pages used} $ovfl_pages
|
| 505 |
+
statline {Total pages used} $total_pages
|
| 506 |
+
if {$int_unused>0} {
|
| 507 |
+
set int_unused_percent [
|
| 508 |
+
percent $int_unused [expr {$int_pages*$pageSize}] {of index space}]
|
| 509 |
+
statline "Unused bytes on index pages" $int_unused $int_unused_percent
|
| 510 |
+
}
|
| 511 |
+
statline "Unused bytes on primary pages" $leaf_unused [
|
| 512 |
+
percent $leaf_unused [expr {$leaf_pages*$pageSize}] {of primary space}]
|
| 513 |
+
statline "Unused bytes on overflow pages" $ovfl_unused [
|
| 514 |
+
percent $ovfl_unused [expr {$ovfl_pages*$pageSize}] {of overflow space}]
|
| 515 |
+
statline "Unused bytes on all pages" $total_unused [
|
| 516 |
+
percent $total_unused $storage {of all space}]
|
| 517 |
+
return 1
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
# Calculate the overhead in pages caused by auto-vacuum.
|
| 521 |
+
#
|
| 522 |
+
# This procedure calculates and returns the number of pages used by the
|
| 523 |
+
# auto-vacuum 'pointer-map'. If the database does not support auto-vacuum,
|
| 524 |
+
# then 0 is returned. The two arguments are the size of the database file in
|
| 525 |
+
# pages and the page size used by the database (in bytes).
|
| 526 |
+
proc autovacuum_overhead {filePages pageSize} {
|
| 527 |
+
|
| 528 |
+
# Set $autovacuum to non-zero for databases that support auto-vacuum.
|
| 529 |
+
set autovacuum [db one {PRAGMA auto_vacuum}]
|
| 530 |
+
|
| 531 |
+
# If the database is not an auto-vacuum database or the file consists
|
| 532 |
+
# of one page only then there is no overhead for auto-vacuum. Return zero.
|
| 533 |
+
if {0==$autovacuum || $filePages==1} {
|
| 534 |
+
return 0
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
# The number of entries on each pointer map page. The layout of the
|
| 538 |
+
# database file is one pointer-map page, followed by $ptrsPerPage other
|
| 539 |
+
# pages, followed by a pointer-map page etc. The first pointer-map page
|
| 540 |
+
# is the second page of the file overall.
|
| 541 |
+
set ptrsPerPage [expr {double($pageSize/5)}]
|
| 542 |
+
|
| 543 |
+
# Return the number of pointer map pages in the database.
|
| 544 |
+
return [expr {wide(ceil(($filePages-1.0)/($ptrsPerPage+1.0)))}]
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
|
| 548 |
+
# Calculate the summary statistics for the database and store the results
|
| 549 |
+
# in TCL variables. They are output below. Variables are as follows:
|
| 550 |
+
#
|
| 551 |
+
# pageSize: Size of each page in bytes.
|
| 552 |
+
# file_bytes: File size in bytes.
|
| 553 |
+
# file_pgcnt: Number of pages in the file.
|
| 554 |
+
# file_pgcnt2: Number of pages in the file (calculated).
|
| 555 |
+
# av_pgcnt: Pages consumed by the auto-vacuum pointer-map.
|
| 556 |
+
# av_percent: Percentage of the file consumed by auto-vacuum pointer-map.
|
| 557 |
+
# inuse_pgcnt: Data pages in the file.
|
| 558 |
+
# inuse_percent: Percentage of pages used to store data.
|
| 559 |
+
# free_pgcnt: Free pages calculated as (<total pages> - <in-use pages>)
|
| 560 |
+
# free_pgcnt2: Free pages in the file according to the file header.
|
| 561 |
+
# free_percent: Percentage of file consumed by free pages (calculated).
|
| 562 |
+
# free_percent2: Percentage of file consumed by free pages (header).
|
| 563 |
+
# ntable: Number of tables in the db.
|
| 564 |
+
# nindex: Number of indices in the db.
|
| 565 |
+
# nautoindex: Number of indices created automatically.
|
| 566 |
+
# nmanindex: Number of indices created manually.
|
| 567 |
+
# user_payload: Number of bytes of payload in table btrees
|
| 568 |
+
# (not including sqlite_schema)
|
| 569 |
+
# user_percent: $user_payload as a percentage of total file size.
|
| 570 |
+
|
| 571 |
+
### The following, setting $file_bytes based on the actual size of the file
|
| 572 |
+
### on disk, causes this tool to choke on zipvfs databases. So set it based
|
| 573 |
+
### on the return of [PRAGMA page_count] instead.
|
| 574 |
+
if 0 {
|
| 575 |
+
set file_bytes [file size $file_to_analyze]
|
| 576 |
+
set file_pgcnt [expr {$file_bytes/$pageSize}]
|
| 577 |
+
}
|
| 578 |
+
set file_pgcnt [db one {PRAGMA page_count}]
|
| 579 |
+
set file_bytes [expr {$file_pgcnt * $pageSize}]
|
| 580 |
+
|
| 581 |
+
set av_pgcnt [autovacuum_overhead $file_pgcnt $pageSize]
|
| 582 |
+
set av_percent [percent $av_pgcnt $file_pgcnt]
|
| 583 |
+
|
| 584 |
+
set sql {SELECT sum(leaf_pages+int_pages+ovfl_pages) FROM space_used}
|
| 585 |
+
set inuse_pgcnt [expr {wide([mem eval $sql])}]
|
| 586 |
+
set inuse_percent [percent $inuse_pgcnt $file_pgcnt]
|
| 587 |
+
|
| 588 |
+
set free_pgcnt [expr {$file_pgcnt-$inuse_pgcnt-$av_pgcnt}]
|
| 589 |
+
set free_percent [percent $free_pgcnt $file_pgcnt]
|
| 590 |
+
set free_pgcnt2 [db one {PRAGMA freelist_count}]
|
| 591 |
+
set free_percent2 [percent $free_pgcnt2 $file_pgcnt]
|
| 592 |
+
|
| 593 |
+
set file_pgcnt2 [expr {$inuse_pgcnt+$free_pgcnt2+$av_pgcnt}]
|
| 594 |
+
|
| 595 |
+
# Account for the lockbyte page
|
| 596 |
+
if {$file_pgcnt2*$pageSize>1073742335} {incr file_pgcnt2}
|
| 597 |
+
|
| 598 |
+
set ntable [db eval {SELECT count(*)+1 FROM sqlite_schema WHERE type='table'}]
|
| 599 |
+
set nindex [db eval {SELECT count(*) FROM sqlite_schema WHERE type='index'}]
|
| 600 |
+
set sql {SELECT count(*) FROM sqlite_schema WHERE name LIKE 'sqlite_autoindex%'}
|
| 601 |
+
set nautoindex [db eval $sql]
|
| 602 |
+
set nmanindex [expr {$nindex-$nautoindex}]
|
| 603 |
+
|
| 604 |
+
# set total_payload [mem eval "SELECT sum(payload) FROM space_used"]
|
| 605 |
+
set user_payload [mem one {SELECT int(sum(payload)) FROM space_used
|
| 606 |
+
WHERE NOT is_index AND name NOT LIKE 'sqlite_schema'}]
|
| 607 |
+
set user_percent [percent $user_payload $file_bytes]
|
| 608 |
+
|
| 609 |
+
# Output the summary statistics calculated above.
|
| 610 |
+
#
|
| 611 |
+
puts "/** Disk-Space Utilization Report For $root_filename"
|
| 612 |
+
puts ""
|
| 613 |
+
statline {Page size in bytes} $pageSize
|
| 614 |
+
statline {Pages in the whole file (measured)} $file_pgcnt
|
| 615 |
+
statline {Pages in the whole file (calculated)} $file_pgcnt2
|
| 616 |
+
statline {Pages that store data} $inuse_pgcnt $inuse_percent
|
| 617 |
+
statline {Pages on the freelist (per header)} $free_pgcnt2 $free_percent2
|
| 618 |
+
statline {Pages on the freelist (calculated)} $free_pgcnt $free_percent
|
| 619 |
+
statline {Pages of auto-vacuum overhead} $av_pgcnt $av_percent
|
| 620 |
+
statline {Number of tables in the database} $ntable
|
| 621 |
+
statline {Number of indices} $nindex
|
| 622 |
+
statline {Number of defined indices} $nmanindex
|
| 623 |
+
statline {Number of implied indices} $nautoindex
|
| 624 |
+
if {$isCompressed} {
|
| 625 |
+
statline {Size of uncompressed content in bytes} $file_bytes
|
| 626 |
+
set efficiency [percent $true_file_size $file_bytes]
|
| 627 |
+
statline {Size of compressed file on disk} $true_file_size $efficiency
|
| 628 |
+
} else {
|
| 629 |
+
statline {Size of the file in bytes} $file_bytes
|
| 630 |
+
}
|
| 631 |
+
statline {Bytes of user payload stored} $user_payload $user_percent
|
| 632 |
+
|
| 633 |
+
# Output table rankings
|
| 634 |
+
#
|
| 635 |
+
puts ""
|
| 636 |
+
titleline "Page counts for all tables with their indices"
|
| 637 |
+
puts ""
|
| 638 |
+
mem eval {SELECT tblname, count(*) AS cnt,
|
| 639 |
+
int(sum(int_pages+leaf_pages+ovfl_pages)) AS size
|
| 640 |
+
FROM space_used GROUP BY tblname ORDER BY size+0 DESC, tblname} {} {
|
| 641 |
+
statline [string toupper $tblname] $size [percent $size $file_pgcnt]
|
| 642 |
+
}
|
| 643 |
+
puts ""
|
| 644 |
+
titleline "Page counts for all tables and indices separately"
|
| 645 |
+
puts ""
|
| 646 |
+
mem eval {
|
| 647 |
+
SELECT
|
| 648 |
+
upper(name) AS nm,
|
| 649 |
+
int(int_pages+leaf_pages+ovfl_pages) AS size
|
| 650 |
+
FROM space_used
|
| 651 |
+
ORDER BY size+0 DESC, name} {} {
|
| 652 |
+
statline $nm $size [percent $size $file_pgcnt]
|
| 653 |
+
}
|
| 654 |
+
if {$isCompressed} {
|
| 655 |
+
puts ""
|
| 656 |
+
titleline "Bytes of disk space used after compression"
|
| 657 |
+
puts ""
|
| 658 |
+
set csum 0
|
| 659 |
+
mem eval {SELECT tblname,
|
| 660 |
+
int(sum(compressed_size)) +
|
| 661 |
+
$compressOverhead*sum(int_pages+leaf_pages+ovfl_pages)
|
| 662 |
+
AS csize
|
| 663 |
+
FROM space_used GROUP BY tblname ORDER BY csize+0 DESC, tblname} {} {
|
| 664 |
+
incr csum $csize
|
| 665 |
+
statline [string toupper $tblname] $csize [percent $csize $true_file_size]
|
| 666 |
+
}
|
| 667 |
+
set overhead [expr {$true_file_size - $csum}]
|
| 668 |
+
if {$overhead>0} {
|
| 669 |
+
statline {Header and free space} $overhead [percent $overhead $true_file_size]
|
| 670 |
+
}
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
# Output subreports
|
| 674 |
+
#
|
| 675 |
+
if {$nindex>0} {
|
| 676 |
+
subreport {All tables and indices} 1 0
|
| 677 |
+
}
|
| 678 |
+
subreport {All tables} {NOT is_index} 0
|
| 679 |
+
if {$nindex>0} {
|
| 680 |
+
subreport {All indices} {is_index} 0
|
| 681 |
+
}
|
| 682 |
+
foreach tbl [mem eval {SELECT DISTINCT tblname name FROM space_used
|
| 683 |
+
ORDER BY name}] {
|
| 684 |
+
set qn [quote $tbl]
|
| 685 |
+
set name [string toupper $tbl]
|
| 686 |
+
set n [mem eval {SELECT count(*) FROM space_used WHERE tblname=$tbl}]
|
| 687 |
+
if {$n>1} {
|
| 688 |
+
set idxlist [mem eval "SELECT name FROM space_used
|
| 689 |
+
WHERE tblname='$qn' AND is_index
|
| 690 |
+
ORDER BY 1"]
|
| 691 |
+
subreport "Table $name and all its indices" "tblname='$qn'" 0
|
| 692 |
+
subreport "Table $name w/o any indices" "name='$qn'" 1
|
| 693 |
+
if {[llength $idxlist]>1} {
|
| 694 |
+
subreport "Indices of table $name" "tblname='$qn' AND is_index" 0
|
| 695 |
+
}
|
| 696 |
+
foreach idx $idxlist {
|
| 697 |
+
set qidx [quote $idx]
|
| 698 |
+
subreport "Index [string toupper $idx] of table $name" "name='$qidx'" 1
|
| 699 |
+
}
|
| 700 |
+
} else {
|
| 701 |
+
subreport "Table $name" "name='$qn'" 1
|
| 702 |
+
}
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
# Output instructions on what the numbers above mean.
|
| 706 |
+
#
|
| 707 |
+
puts ""
|
| 708 |
+
titleline Definitions
|
| 709 |
+
puts {
|
| 710 |
+
Page size in bytes
|
| 711 |
+
|
| 712 |
+
The number of bytes in a single page of the database file.
|
| 713 |
+
Usually 1024.
|
| 714 |
+
|
| 715 |
+
Number of pages in the whole file
|
| 716 |
+
}
|
| 717 |
+
puts " The number of $pageSize-byte pages that go into forming the complete
|
| 718 |
+
database"
|
| 719 |
+
puts {
|
| 720 |
+
Pages that store data
|
| 721 |
+
|
| 722 |
+
The number of pages that store data, either as primary B*Tree pages or
|
| 723 |
+
as overflow pages. The number at the right is the data pages divided by
|
| 724 |
+
the total number of pages in the file.
|
| 725 |
+
|
| 726 |
+
Pages on the freelist
|
| 727 |
+
|
| 728 |
+
The number of pages that are not currently in use but are reserved for
|
| 729 |
+
future use. The percentage at the right is the number of freelist pages
|
| 730 |
+
divided by the total number of pages in the file.
|
| 731 |
+
|
| 732 |
+
Pages of auto-vacuum overhead
|
| 733 |
+
|
| 734 |
+
The number of pages that store data used by the database to facilitate
|
| 735 |
+
auto-vacuum. This is zero for databases that do not support auto-vacuum.
|
| 736 |
+
|
| 737 |
+
Number of tables in the database
|
| 738 |
+
|
| 739 |
+
The number of tables in the database, including the SQLITE_SCHEMA table
|
| 740 |
+
used to store schema information.
|
| 741 |
+
|
| 742 |
+
Number of indices
|
| 743 |
+
|
| 744 |
+
The total number of indices in the database.
|
| 745 |
+
|
| 746 |
+
Number of defined indices
|
| 747 |
+
|
| 748 |
+
The number of indices created using an explicit CREATE INDEX statement.
|
| 749 |
+
|
| 750 |
+
Number of implied indices
|
| 751 |
+
|
| 752 |
+
The number of indices used to implement PRIMARY KEY or UNIQUE constraints
|
| 753 |
+
on tables.
|
| 754 |
+
|
| 755 |
+
Size of the file in bytes
|
| 756 |
+
|
| 757 |
+
The total amount of disk space used by the entire database files.
|
| 758 |
+
|
| 759 |
+
Bytes of user payload stored
|
| 760 |
+
|
| 761 |
+
The total number of bytes of user payload stored in the database. The
|
| 762 |
+
schema information in the SQLITE_SCHEMA table is not counted when
|
| 763 |
+
computing this number. The percentage at the right shows the payload
|
| 764 |
+
divided by the total file size.
|
| 765 |
+
|
| 766 |
+
Percentage of total database
|
| 767 |
+
|
| 768 |
+
The amount of the complete database file that is devoted to storing
|
| 769 |
+
information described by this category.
|
| 770 |
+
|
| 771 |
+
Number of entries
|
| 772 |
+
|
| 773 |
+
The total number of B-Tree key/value pairs stored under this category.
|
| 774 |
+
|
| 775 |
+
Bytes of storage consumed
|
| 776 |
+
|
| 777 |
+
The total amount of disk space required to store all B-Tree entries
|
| 778 |
+
under this category. The is the total number of pages used times
|
| 779 |
+
the pages size.
|
| 780 |
+
|
| 781 |
+
Bytes of payload
|
| 782 |
+
|
| 783 |
+
The amount of payload stored under this category. Payload is the data
|
| 784 |
+
part of table entries and the key part of index entries. The percentage
|
| 785 |
+
at the right is the bytes of payload divided by the bytes of storage
|
| 786 |
+
consumed.
|
| 787 |
+
|
| 788 |
+
Bytes of metadata
|
| 789 |
+
|
| 790 |
+
The amount of formatting and structural information stored in the
|
| 791 |
+
table or index. Metadata includes the btree page header, the cell pointer
|
| 792 |
+
array, the size field for each cell, the left child pointer or non-leaf
|
| 793 |
+
cells, the overflow pointers for overflow cells, and the rowid value for
|
| 794 |
+
rowid table cells. In other words, metadata is everything that is neither
|
| 795 |
+
unused space nor content. The record header in the payload is counted as
|
| 796 |
+
content, not metadata.
|
| 797 |
+
|
| 798 |
+
Average payload per entry
|
| 799 |
+
|
| 800 |
+
The average amount of payload on each entry. This is just the bytes of
|
| 801 |
+
payload divided by the number of entries.
|
| 802 |
+
|
| 803 |
+
Average unused bytes per entry
|
| 804 |
+
|
| 805 |
+
The average amount of free space remaining on all pages under this
|
| 806 |
+
category on a per-entry basis. This is the number of unused bytes on
|
| 807 |
+
all pages divided by the number of entries.
|
| 808 |
+
|
| 809 |
+
Non-sequential pages
|
| 810 |
+
|
| 811 |
+
The number of pages in the table or index that are out of sequence.
|
| 812 |
+
Many filesystems are optimized for sequential file access so a small
|
| 813 |
+
number of non-sequential pages might result in faster queries,
|
| 814 |
+
especially for larger database files that do not fit in the disk cache.
|
| 815 |
+
Note that after running VACUUM, the root page of each table or index is
|
| 816 |
+
at the beginning of the database file and all other pages are in a
|
| 817 |
+
separate part of the database file, resulting in a single non-
|
| 818 |
+
sequential page.
|
| 819 |
+
|
| 820 |
+
Maximum payload per entry
|
| 821 |
+
|
| 822 |
+
The largest payload size of any entry.
|
| 823 |
+
|
| 824 |
+
Entries that use overflow
|
| 825 |
+
|
| 826 |
+
The number of entries that user one or more overflow pages.
|
| 827 |
+
|
| 828 |
+
Total pages used
|
| 829 |
+
|
| 830 |
+
This is the number of pages used to hold all information in the current
|
| 831 |
+
category. This is the sum of index, primary, and overflow pages.
|
| 832 |
+
|
| 833 |
+
Index pages used
|
| 834 |
+
|
| 835 |
+
This is the number of pages in a table B-tree that hold only key (rowid)
|
| 836 |
+
information and no data.
|
| 837 |
+
|
| 838 |
+
Primary pages used
|
| 839 |
+
|
| 840 |
+
This is the number of B-tree pages that hold both key and data.
|
| 841 |
+
|
| 842 |
+
Overflow pages used
|
| 843 |
+
|
| 844 |
+
The total number of overflow pages used for this category.
|
| 845 |
+
|
| 846 |
+
Unused bytes on index pages
|
| 847 |
+
|
| 848 |
+
The total number of bytes of unused space on all index pages. The
|
| 849 |
+
percentage at the right is the number of unused bytes divided by the
|
| 850 |
+
total number of bytes on index pages.
|
| 851 |
+
|
| 852 |
+
Unused bytes on primary pages
|
| 853 |
+
|
| 854 |
+
The total number of bytes of unused space on all primary pages. The
|
| 855 |
+
percentage at the right is the number of unused bytes divided by the
|
| 856 |
+
total number of bytes on primary pages.
|
| 857 |
+
|
| 858 |
+
Unused bytes on overflow pages
|
| 859 |
+
|
| 860 |
+
The total number of bytes of unused space on all overflow pages. The
|
| 861 |
+
percentage at the right is the number of unused bytes divided by the
|
| 862 |
+
total number of bytes on overflow pages.
|
| 863 |
+
|
| 864 |
+
Unused bytes on all pages
|
| 865 |
+
|
| 866 |
+
The total number of bytes of unused space on all primary and overflow
|
| 867 |
+
pages. The percentage at the right is the number of unused bytes
|
| 868 |
+
divided by the total number of bytes.
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
# Output a dump of the in-memory database. This can be used for more
|
| 872 |
+
# complex offline analysis.
|
| 873 |
+
#
|
| 874 |
+
titleline {}
|
| 875 |
+
puts "The entire text of this report can be sourced into any SQL database"
|
| 876 |
+
puts "engine for further analysis. All of the text above is an SQL comment."
|
| 877 |
+
puts "The data used to generate this report follows:"
|
| 878 |
+
puts "*/"
|
| 879 |
+
puts "BEGIN;"
|
| 880 |
+
puts $tabledef
|
| 881 |
+
unset -nocomplain x
|
| 882 |
+
mem eval {SELECT * FROM space_used} x {
|
| 883 |
+
puts -nonewline "INSERT INTO space_used VALUES"
|
| 884 |
+
set sep (
|
| 885 |
+
foreach col $x(*) {
|
| 886 |
+
set v $x($col)
|
| 887 |
+
if {$v=="" || ![string is double $v]} {set v '[quote $v]'}
|
| 888 |
+
puts -nonewline $sep$v
|
| 889 |
+
set sep ,
|
| 890 |
+
}
|
| 891 |
+
puts ");"
|
| 892 |
+
}
|
| 893 |
+
puts "COMMIT;"
|
| 894 |
+
|
| 895 |
+
} err]} {
|
| 896 |
+
puts "ERROR: $err"
|
| 897 |
+
puts $errorInfo
|
| 898 |
+
exit 1
|
| 899 |
+
}
|
parrot/bin/tabs
ADDED
|
Binary file (22.4 kB). View file
|
|
|
parrot/bin/tabulate
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from tabulate import _main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(_main())
|
parrot/bin/tclsh
ADDED
|
Binary file (16 kB). View file
|
|
|
parrot/bin/tclsh8.6
ADDED
|
Binary file (16 kB). View file
|
|
|
parrot/bin/tic
ADDED
|
Binary file (92.2 kB). View file
|
|
|
parrot/bin/toe
ADDED
|
Binary file (22.4 kB). View file
|
|
|
parrot/bin/typer
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from typer.cli import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
parrot/bin/undill
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
#
|
| 3 |
+
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
|
| 4 |
+
# Copyright (c) 2008-2016 California Institute of Technology.
|
| 5 |
+
# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.
|
| 6 |
+
# License: 3-clause BSD. The full license text is available at:
|
| 7 |
+
# - https://github.com/uqfoundation/dill/blob/master/LICENSE
|
| 8 |
+
"""
|
| 9 |
+
unpickle the contents of a pickled object file
|
| 10 |
+
|
| 11 |
+
Examples::
|
| 12 |
+
|
| 13 |
+
$ undill hello.pkl
|
| 14 |
+
['hello', 'world']
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
if __name__ == '__main__':
|
| 18 |
+
import sys
|
| 19 |
+
import dill
|
| 20 |
+
for file in sys.argv[1:]:
|
| 21 |
+
print (dill.load(open(file,'rb')))
|
| 22 |
+
|
parrot/bin/wb
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/parrot/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from wandb.cli.cli import cli
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(cli())
|
parrot/bin/wish8.6
ADDED
|
Binary file (16.1 kB). View file
|
|
|
parrot/bin/xzcmp
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 25 |
+
# environment variables.
|
| 26 |
+
xz='xz --format=auto'
|
| 27 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 28 |
+
|
| 29 |
+
case ${0##*/} in
|
| 30 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
| 31 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
| 32 |
+
esac
|
| 33 |
+
|
| 34 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 35 |
+
|
| 36 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
| 37 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
| 38 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
| 39 |
+
FILE1 from which the compression format suffix has been stripped.
|
| 40 |
+
|
| 41 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
| 42 |
+
|
| 43 |
+
Report bugs to <xz@tukaani.org>."
|
| 44 |
+
|
| 45 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 46 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 47 |
+
escape='
|
| 48 |
+
s/'\''/'\''\\'\'''\''/g
|
| 49 |
+
$s/X$/'\''/
|
| 50 |
+
'
|
| 51 |
+
|
| 52 |
+
while :; do
|
| 53 |
+
case $1 in
|
| 54 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
| 55 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
| 56 |
+
--) shift; break;;
|
| 57 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
| 58 |
+
-?*) cmp="$cmp '$1'";;
|
| 59 |
+
*) break;;
|
| 60 |
+
esac
|
| 61 |
+
shift
|
| 62 |
+
done
|
| 63 |
+
cmp="$cmp --"
|
| 64 |
+
|
| 65 |
+
for file; do
|
| 66 |
+
test "X$file" = X- || <"$file" || exit 2
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
| 70 |
+
xz1="$xz -qQ"
|
| 71 |
+
xz2="$xz -qQ"
|
| 72 |
+
xz_status=0
|
| 73 |
+
exec 3>&1
|
| 74 |
+
|
| 75 |
+
if test $# -eq 1; then
|
| 76 |
+
case $1 in
|
| 77 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
| 78 |
+
;;
|
| 79 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
| 80 |
+
xz1=bzip2;;
|
| 81 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
| 82 |
+
xz1=gzip;;
|
| 83 |
+
*[-.]lzo | *.tzo)
|
| 84 |
+
xz1=lzop;;
|
| 85 |
+
*[-.]zst | *.tzst)
|
| 86 |
+
xz1='zstd -q';;
|
| 87 |
+
*[-.]lz4)
|
| 88 |
+
xz1=lz4;;
|
| 89 |
+
*)
|
| 90 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
| 91 |
+
exit 2;;
|
| 92 |
+
esac
|
| 93 |
+
case $1 in
|
| 94 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
|
| 95 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
|
| 96 |
+
*.t[abglx]z)
|
| 97 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
| 98 |
+
*.tbz2)
|
| 99 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
| 100 |
+
*.tzo)
|
| 101 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
| 102 |
+
*.tzst)
|
| 103 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
| 104 |
+
esac
|
| 105 |
+
xz_status=$(
|
| 106 |
+
exec 4>&1
|
| 107 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
| 108 |
+
)
|
| 109 |
+
elif test $# -eq 2; then
|
| 110 |
+
case $1 in
|
| 111 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
| 112 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
| 113 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
| 114 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
| 115 |
+
*[-.]lz4) xz1=lz4;;
|
| 116 |
+
esac
|
| 117 |
+
case $2 in
|
| 118 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
| 119 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
| 120 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
| 121 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
| 122 |
+
*[-.]lz4) xz2=lz4;;
|
| 123 |
+
esac
|
| 124 |
+
case $1 in
|
| 125 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 126 |
+
case "$2" in
|
| 127 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 128 |
+
if test "$1$2" = --; then
|
| 129 |
+
xz_status=$(
|
| 130 |
+
exec 4>&1
|
| 131 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
| 132 |
+
eval "$cmp" - - >&3
|
| 133 |
+
)
|
| 134 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
| 135 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
| 136 |
+
# NOTE: xz_status will contain two numbers.
|
| 137 |
+
xz_status=$(
|
| 138 |
+
exec 4>&1
|
| 139 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 140 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
| 141 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
| 142 |
+
)
|
| 143 |
+
else
|
| 144 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
| 145 |
+
tmp=
|
| 146 |
+
trap '
|
| 147 |
+
test -n "$tmp" && rm -rf "$tmp"
|
| 148 |
+
(exit 2); exit 2
|
| 149 |
+
' HUP INT PIPE TERM 0
|
| 150 |
+
if type mktemp >/dev/null 2>&1; then
|
| 151 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
| 152 |
+
# the implementations from mktemp.org and GNU coreutils.
|
| 153 |
+
# It is important that the -t argument is the last argument
|
| 154 |
+
# and that no "--" is used between -t and the template argument.
|
| 155 |
+
# This way this command works on all implementations.
|
| 156 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
| 157 |
+
else
|
| 158 |
+
# Fallback code if mktemp is missing. This isn't as
|
| 159 |
+
# robust as using mktemp since this doesn't try with
|
| 160 |
+
# different file names in case of a file name conflict.
|
| 161 |
+
#
|
| 162 |
+
# There's no need to save the original umask since
|
| 163 |
+
# we don't create any non-temp files. Note that using
|
| 164 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
| 165 |
+
# create the dir with the default umask and chmod the
|
| 166 |
+
# the dir afterwards.
|
| 167 |
+
umask 0077
|
| 168 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
| 169 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
| 170 |
+
fi
|
| 171 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
| 172 |
+
xz_status=$(
|
| 173 |
+
exec 4>&1
|
| 174 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 175 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
| 176 |
+
)
|
| 177 |
+
cmp_status=$?
|
| 178 |
+
rm -rf "$tmp" || xz_status=$?
|
| 179 |
+
trap - HUP INT PIPE TERM 0
|
| 180 |
+
(exit $cmp_status)
|
| 181 |
+
fi;;
|
| 182 |
+
*)
|
| 183 |
+
xz_status=$(
|
| 184 |
+
exec 4>&1
|
| 185 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 186 |
+
eval "$cmp" - '"$2"' >&3
|
| 187 |
+
);;
|
| 188 |
+
esac;;
|
| 189 |
+
*)
|
| 190 |
+
case "$2" in
|
| 191 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 192 |
+
xz_status=$(
|
| 193 |
+
exec 4>&1
|
| 194 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
| 195 |
+
eval "$cmp" '"$1"' - >&3
|
| 196 |
+
);;
|
| 197 |
+
*)
|
| 198 |
+
eval "$cmp" '"$1"' '"$2"';;
|
| 199 |
+
esac;;
|
| 200 |
+
esac
|
| 201 |
+
else
|
| 202 |
+
printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2
|
| 203 |
+
exit 2
|
| 204 |
+
fi
|
| 205 |
+
|
| 206 |
+
cmp_status=$?
|
| 207 |
+
for num in $xz_status ; do
|
| 208 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
| 209 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
| 210 |
+
# has been decompressed. In that case we want to retain the exit status
|
| 211 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
| 212 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
| 213 |
+
# is ignored.
|
| 214 |
+
test "$num" -eq 0 && continue
|
| 215 |
+
test "$num" -ge 128 \
|
| 216 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
| 217 |
+
&& continue
|
| 218 |
+
exit 2
|
| 219 |
+
done
|
| 220 |
+
exit $cmp_status
|
parrot/bin/xzdiff
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 25 |
+
# environment variables.
|
| 26 |
+
xz='xz --format=auto'
|
| 27 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 28 |
+
|
| 29 |
+
case ${0##*/} in
|
| 30 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
| 31 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
| 32 |
+
esac
|
| 33 |
+
|
| 34 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 35 |
+
|
| 36 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
| 37 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
| 38 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
| 39 |
+
FILE1 from which the compression format suffix has been stripped.
|
| 40 |
+
|
| 41 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
| 42 |
+
|
| 43 |
+
Report bugs to <xz@tukaani.org>."
|
| 44 |
+
|
| 45 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 46 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 47 |
+
escape='
|
| 48 |
+
s/'\''/'\''\\'\'''\''/g
|
| 49 |
+
$s/X$/'\''/
|
| 50 |
+
'
|
| 51 |
+
|
| 52 |
+
while :; do
|
| 53 |
+
case $1 in
|
| 54 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
| 55 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
| 56 |
+
--) shift; break;;
|
| 57 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
| 58 |
+
-?*) cmp="$cmp '$1'";;
|
| 59 |
+
*) break;;
|
| 60 |
+
esac
|
| 61 |
+
shift
|
| 62 |
+
done
|
| 63 |
+
cmp="$cmp --"
|
| 64 |
+
|
| 65 |
+
for file; do
|
| 66 |
+
test "X$file" = X- || <"$file" || exit 2
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
| 70 |
+
xz1="$xz -qQ"
|
| 71 |
+
xz2="$xz -qQ"
|
| 72 |
+
xz_status=0
|
| 73 |
+
exec 3>&1
|
| 74 |
+
|
| 75 |
+
if test $# -eq 1; then
|
| 76 |
+
case $1 in
|
| 77 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
| 78 |
+
;;
|
| 79 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
| 80 |
+
xz1=bzip2;;
|
| 81 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
| 82 |
+
xz1=gzip;;
|
| 83 |
+
*[-.]lzo | *.tzo)
|
| 84 |
+
xz1=lzop;;
|
| 85 |
+
*[-.]zst | *.tzst)
|
| 86 |
+
xz1='zstd -q';;
|
| 87 |
+
*[-.]lz4)
|
| 88 |
+
xz1=lz4;;
|
| 89 |
+
*)
|
| 90 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
| 91 |
+
exit 2;;
|
| 92 |
+
esac
|
| 93 |
+
case $1 in
|
| 94 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
|
| 95 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
|
| 96 |
+
*.t[abglx]z)
|
| 97 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
| 98 |
+
*.tbz2)
|
| 99 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
| 100 |
+
*.tzo)
|
| 101 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
| 102 |
+
*.tzst)
|
| 103 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
| 104 |
+
esac
|
| 105 |
+
xz_status=$(
|
| 106 |
+
exec 4>&1
|
| 107 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
| 108 |
+
)
|
| 109 |
+
elif test $# -eq 2; then
|
| 110 |
+
case $1 in
|
| 111 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
| 112 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
| 113 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
| 114 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
| 115 |
+
*[-.]lz4) xz1=lz4;;
|
| 116 |
+
esac
|
| 117 |
+
case $2 in
|
| 118 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
| 119 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
| 120 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
| 121 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
| 122 |
+
*[-.]lz4) xz2=lz4;;
|
| 123 |
+
esac
|
| 124 |
+
case $1 in
|
| 125 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 126 |
+
case "$2" in
|
| 127 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 128 |
+
if test "$1$2" = --; then
|
| 129 |
+
xz_status=$(
|
| 130 |
+
exec 4>&1
|
| 131 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
| 132 |
+
eval "$cmp" - - >&3
|
| 133 |
+
)
|
| 134 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
| 135 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
| 136 |
+
# NOTE: xz_status will contain two numbers.
|
| 137 |
+
xz_status=$(
|
| 138 |
+
exec 4>&1
|
| 139 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 140 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
| 141 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
| 142 |
+
)
|
| 143 |
+
else
|
| 144 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
| 145 |
+
tmp=
|
| 146 |
+
trap '
|
| 147 |
+
test -n "$tmp" && rm -rf "$tmp"
|
| 148 |
+
(exit 2); exit 2
|
| 149 |
+
' HUP INT PIPE TERM 0
|
| 150 |
+
if type mktemp >/dev/null 2>&1; then
|
| 151 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
| 152 |
+
# the implementations from mktemp.org and GNU coreutils.
|
| 153 |
+
# It is important that the -t argument is the last argument
|
| 154 |
+
# and that no "--" is used between -t and the template argument.
|
| 155 |
+
# This way this command works on all implementations.
|
| 156 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
| 157 |
+
else
|
| 158 |
+
# Fallback code if mktemp is missing. This isn't as
|
| 159 |
+
# robust as using mktemp since this doesn't try with
|
| 160 |
+
# different file names in case of a file name conflict.
|
| 161 |
+
#
|
| 162 |
+
# There's no need to save the original umask since
|
| 163 |
+
# we don't create any non-temp files. Note that using
|
| 164 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
| 165 |
+
# create the dir with the default umask and chmod the
|
| 166 |
+
# the dir afterwards.
|
| 167 |
+
umask 0077
|
| 168 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
| 169 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
| 170 |
+
fi
|
| 171 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
| 172 |
+
xz_status=$(
|
| 173 |
+
exec 4>&1
|
| 174 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 175 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
| 176 |
+
)
|
| 177 |
+
cmp_status=$?
|
| 178 |
+
rm -rf "$tmp" || xz_status=$?
|
| 179 |
+
trap - HUP INT PIPE TERM 0
|
| 180 |
+
(exit $cmp_status)
|
| 181 |
+
fi;;
|
| 182 |
+
*)
|
| 183 |
+
xz_status=$(
|
| 184 |
+
exec 4>&1
|
| 185 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 186 |
+
eval "$cmp" - '"$2"' >&3
|
| 187 |
+
);;
|
| 188 |
+
esac;;
|
| 189 |
+
*)
|
| 190 |
+
case "$2" in
|
| 191 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 192 |
+
xz_status=$(
|
| 193 |
+
exec 4>&1
|
| 194 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
| 195 |
+
eval "$cmp" '"$1"' - >&3
|
| 196 |
+
);;
|
| 197 |
+
*)
|
| 198 |
+
eval "$cmp" '"$1"' '"$2"';;
|
| 199 |
+
esac;;
|
| 200 |
+
esac
|
| 201 |
+
else
|
| 202 |
+
printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2
|
| 203 |
+
exit 2
|
| 204 |
+
fi
|
| 205 |
+
|
| 206 |
+
cmp_status=$?
|
| 207 |
+
for num in $xz_status ; do
|
| 208 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
| 209 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
| 210 |
+
# has been decompressed. In that case we want to retain the exit status
|
| 211 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
| 212 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
| 213 |
+
# is ignored.
|
| 214 |
+
test "$num" -eq 0 && continue
|
| 215 |
+
test "$num" -ge 128 \
|
| 216 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
| 217 |
+
&& continue
|
| 218 |
+
exit 2
|
| 219 |
+
done
|
| 220 |
+
exit $cmp_status
|
parrot/bin/xzegrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/xzfgrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/xzgrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
parrot/bin/xzmore
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 2001, 2002, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1992, 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT.
|
| 25 |
+
xz='xz --format=auto'
|
| 26 |
+
|
| 27 |
+
version='xzmore (XZ Utils) 5.6.4'
|
| 28 |
+
|
| 29 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
| 30 |
+
Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
|
| 31 |
+
|
| 32 |
+
Report bugs to <xz@tukaani.org>."
|
| 33 |
+
|
| 34 |
+
case $1 in
|
| 35 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
| 36 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
| 37 |
+
esac
|
| 38 |
+
|
| 39 |
+
oldtty=`stty -g 2>/dev/null`
|
| 40 |
+
if stty -cbreak 2>/dev/null; then
|
| 41 |
+
cb='cbreak'; ncb='-cbreak'
|
| 42 |
+
else
|
| 43 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
| 44 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
| 45 |
+
fi
|
| 46 |
+
if test $? -eq 0 && test -n "$oldtty"; then
|
| 47 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 48 |
+
else
|
| 49 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 50 |
+
fi
|
| 51 |
+
|
| 52 |
+
if test $# = 0; then
|
| 53 |
+
if test -t 0; then
|
| 54 |
+
printf '%s\n' "$usage"; exit 1
|
| 55 |
+
else
|
| 56 |
+
$xz -cdfqQ | eval "${PAGER:-more}"
|
| 57 |
+
fi
|
| 58 |
+
else
|
| 59 |
+
FIRST=1
|
| 60 |
+
for FILE; do
|
| 61 |
+
< "$FILE" || continue
|
| 62 |
+
if test $FIRST -eq 0; then
|
| 63 |
+
printf "%s--More--(Next file: %s)" "" "$FILE"
|
| 64 |
+
stty $cb -echo 2>/dev/null
|
| 65 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
| 66 |
+
stty $ncb echo 2>/dev/null
|
| 67 |
+
echo " "
|
| 68 |
+
case "$ANS" in
|
| 69 |
+
[eq]) exit;;
|
| 70 |
+
esac
|
| 71 |
+
fi
|
| 72 |
+
if test "$ANS" != 's'; then
|
| 73 |
+
printf '%s\n' "------> $FILE <------"
|
| 74 |
+
$xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}"
|
| 75 |
+
fi
|
| 76 |
+
if test -t 1; then
|
| 77 |
+
FIRST=0
|
| 78 |
+
fi
|
| 79 |
+
done
|
| 80 |
+
fi
|
parrot/compiler_compat/README
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Files in this folder are to enhance backwards compatibility of anaconda software with older compilers.
|
| 2 |
+
See: https://github.com/conda/conda/issues/6030 for more information.
|
parrot/conda-meta/_openmp_mutex-5.1-1_gnu.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"build": "1_gnu",
|
| 3 |
+
"build_number": 0,
|
| 4 |
+
"channel": "https://repo.anaconda.com/pkgs/main",
|
| 5 |
+
"constrains": [
|
| 6 |
+
"openmp_impl 9999"
|
| 7 |
+
],
|
| 8 |
+
"depends": [
|
| 9 |
+
"_libgcc_mutex 0.1 main",
|
| 10 |
+
"libgomp >=7.5.0"
|
| 11 |
+
],
|
| 12 |
+
"extracted_package_dir": "/opt/conda/pkgs/_openmp_mutex-5.1-1_gnu",
|
| 13 |
+
"files": [
|
| 14 |
+
"lib/libgomp.so.1"
|
| 15 |
+
],
|
| 16 |
+
"fn": "_openmp_mutex-5.1-1_gnu.conda",
|
| 17 |
+
"license": "BSD-3-Clause",
|
| 18 |
+
"link": {
|
| 19 |
+
"source": "/opt/conda/pkgs/_openmp_mutex-5.1-1_gnu",
|
| 20 |
+
"type": 1
|
| 21 |
+
},
|
| 22 |
+
"md5": "71d281e9c2192cb3fa425655a8defb85",
|
| 23 |
+
"name": "_openmp_mutex",
|
| 24 |
+
"package_tarball_full_path": "/opt/conda/pkgs/_openmp_mutex-5.1-1_gnu.conda",
|
| 25 |
+
"paths_data": {
|
| 26 |
+
"paths": [
|
| 27 |
+
{
|
| 28 |
+
"_path": "lib/libgomp.so.1",
|
| 29 |
+
"path_type": "softlink",
|
| 30 |
+
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
| 31 |
+
"size_in_bytes": 0
|
| 32 |
+
}
|
| 33 |
+
],
|
| 34 |
+
"paths_version": 1
|
| 35 |
+
},
|
| 36 |
+
"requested_spec": "None",
|
| 37 |
+
"sha256": "576011048d23f2e03372263493c5529f802286ff53e8426df99a5b11cc2572f3",
|
| 38 |
+
"size": 21315,
|
| 39 |
+
"subdir": "linux-64",
|
| 40 |
+
"timestamp": 1652859733000,
|
| 41 |
+
"url": "https://repo.anaconda.com/pkgs/main/linux-64/_openmp_mutex-5.1-1_gnu.conda",
|
| 42 |
+
"version": "5.1"
|
| 43 |
+
}
|
parrot/conda-meta/bzip2-1.0.8-h5eee18b_6.json
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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gcc-ng >=11.2.0"
|
| 8 |
+
],
|
| 9 |
+
"extracted_package_dir": "/opt/conda/pkgs/bzip2-1.0.8-h5eee18b_6",
|
| 10 |
+
"files": [
|
| 11 |
+
"bin/bunzip2",
|
| 12 |
+
"bin/bzcat",
|
| 13 |
+
"bin/bzcmp",
|
| 14 |
+
"bin/bzdiff",
|
| 15 |
+
"bin/bzegrep",
|
| 16 |
+
"bin/bzfgrep",
|
| 17 |
+
"bin/bzgrep",
|
| 18 |
+
"bin/bzip2",
|
| 19 |
+
"bin/bzip2recover",
|
| 20 |
+
"bin/bzless",
|
| 21 |
+
"bin/bzmore",
|
| 22 |
+
"include/bzlib.h",
|
| 23 |
+
"lib/libbz2.a",
|
| 24 |
+
"lib/libbz2.so",
|
| 25 |
+
"lib/libbz2.so.1.0",
|
| 26 |
+
"lib/libbz2.so.1.0.8",
|
| 27 |
+
"man/man1/bzcmp.1",
|
| 28 |
+
"man/man1/bzdiff.1",
|
| 29 |
+
"man/man1/bzegrep.1",
|
| 30 |
+
"man/man1/bzfgrep.1",
|
| 31 |
+
"man/man1/bzgrep.1",
|
| 32 |
+
"man/man1/bzip2.1",
|
| 33 |
+
"man/man1/bzless.1",
|
| 34 |
+
"man/man1/bzmore.1"
|
| 35 |
+
],
|
| 36 |
+
"fn": "bzip2-1.0.8-h5eee18b_6.conda",
|
| 37 |
+
"license": "bzip2-1.0.8",
|
| 38 |
+
"link": {
|
| 39 |
+
"source": "/opt/conda/pkgs/bzip2-1.0.8-h5eee18b_6",
|
| 40 |
+
"type": 1
|
| 41 |
+
},
|
| 42 |
+
"md5": "f21a3ff51c1b271977f53ce956a69297",
|
| 43 |
+
"name": "bzip2",
|
| 44 |
+
"package_tarball_full_path": "/opt/conda/pkgs/bzip2-1.0.8-h5eee18b_6.conda",
|
| 45 |
+
"paths_data": {
|
| 46 |
+
"paths": [
|
| 47 |
+
{
|
| 48 |
+
"_path": "bin/bunzip2",
|
| 49 |
+
"path_type": "hardlink",
|
| 50 |
+
"sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 51 |
+
"sha256_in_prefix": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 52 |
+
"size_in_bytes": 299464
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"_path": "bin/bzcat",
|
| 56 |
+
"path_type": "hardlink",
|
| 57 |
+
"sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 58 |
+
"sha256_in_prefix": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 59 |
+
"size_in_bytes": 299464
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"_path": "bin/bzcmp",
|
| 63 |
+
"path_type": "softlink",
|
| 64 |
+
"sha256": "1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012",
|
| 65 |
+
"size_in_bytes": 2140
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"_path": "bin/bzdiff",
|
| 69 |
+
"path_type": "hardlink",
|
| 70 |
+
"sha256": "1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012",
|
| 71 |
+
"sha256_in_prefix": "1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012",
|
| 72 |
+
"size_in_bytes": 2140
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"_path": "bin/bzegrep",
|
| 76 |
+
"path_type": "softlink",
|
| 77 |
+
"sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9",
|
| 78 |
+
"size_in_bytes": 2054
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"_path": "bin/bzfgrep",
|
| 82 |
+
"path_type": "softlink",
|
| 83 |
+
"sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9",
|
| 84 |
+
"size_in_bytes": 2054
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"_path": "bin/bzgrep",
|
| 88 |
+
"path_type": "hardlink",
|
| 89 |
+
"sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9",
|
| 90 |
+
"sha256_in_prefix": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9",
|
| 91 |
+
"size_in_bytes": 2054
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"_path": "bin/bzip2",
|
| 95 |
+
"path_type": "hardlink",
|
| 96 |
+
"sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 97 |
+
"sha256_in_prefix": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed",
|
| 98 |
+
"size_in_bytes": 299464
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"_path": "bin/bzip2recover",
|
| 102 |
+
"path_type": "hardlink",
|
| 103 |
+
"sha256": "4713d7b2cdf7a82857e47b9001665d26656a0eb13dc830430a42f5d6fe5fe0b6",
|
| 104 |
+
"sha256_in_prefix": "4713d7b2cdf7a82857e47b9001665d26656a0eb13dc830430a42f5d6fe5fe0b6",
|
| 105 |
+
"size_in_bytes": 30920
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"_path": "bin/bzless",
|
| 109 |
+
"path_type": "softlink",
|
| 110 |
+
"sha256": "836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d",
|
| 111 |
+
"size_in_bytes": 1259
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"_path": "bin/bzmore",
|
| 115 |
+
"path_type": "hardlink",
|
| 116 |
+
"sha256": "836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d",
|
| 117 |
+
"sha256_in_prefix": "836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d",
|
| 118 |
+
"size_in_bytes": 1259
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"_path": "include/bzlib.h",
|
| 122 |
+
"path_type": "hardlink",
|
| 123 |
+
"sha256": "6ac62e811669598ee30c9e1c379b9e627f6ff17a5a3dc1e0b4fa8b8ea75e580d",
|
| 124 |
+
"sha256_in_prefix": "6ac62e811669598ee30c9e1c379b9e627f6ff17a5a3dc1e0b4fa8b8ea75e580d",
|
| 125 |
+
"size_in_bytes": 6240
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"_path": "lib/libbz2.a",
|
| 129 |
+
"path_type": "hardlink",
|
| 130 |
+
"sha256": "4377dc3d8f7542568b6365cd6bb06970b53c20e9a71b7d54271874f7868be500",
|
| 131 |
+
"sha256_in_prefix": "4377dc3d8f7542568b6365cd6bb06970b53c20e9a71b7d54271874f7868be500",
|
| 132 |
+
"size_in_bytes": 264138
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"_path": "lib/libbz2.so",
|
| 136 |
+
"path_type": "softlink",
|
| 137 |
+
"sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301",
|
| 138 |
+
"size_in_bytes": 229016
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"_path": "lib/libbz2.so.1.0",
|
| 142 |
+
"path_type": "softlink",
|
| 143 |
+
"sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301",
|
| 144 |
+
"size_in_bytes": 229016
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"_path": "lib/libbz2.so.1.0.8",
|
| 148 |
+
"path_type": "hardlink",
|
| 149 |
+
"sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301",
|
| 150 |
+
"sha256_in_prefix": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301",
|
| 151 |
+
"size_in_bytes": 229016
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"_path": "man/man1/bzcmp.1",
|
| 155 |
+
"path_type": "hardlink",
|
| 156 |
+
"sha256": "172cde42c47a6d50c244e39d993097dcd3882427d57303078643849cf10a81c4",
|
| 157 |
+
"sha256_in_prefix": "172cde42c47a6d50c244e39d993097dcd3882427d57303078643849cf10a81c4",
|
| 158 |
+
"size_in_bytes": 18
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"_path": "man/man1/bzdiff.1",
|
| 162 |
+
"path_type": "hardlink",
|
| 163 |
+
"sha256": "32d1a7cd115430398e58537532584ef2ab76343c9f094dcd1253d9c4c0f705bf",
|
| 164 |
+
"sha256_in_prefix": "32d1a7cd115430398e58537532584ef2ab76343c9f094dcd1253d9c4c0f705bf",
|
| 165 |
+
"size_in_bytes": 897
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"_path": "man/man1/bzegrep.1",
|
| 169 |
+
"path_type": "hardlink",
|
| 170 |
+
"sha256": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182",
|
| 171 |
+
"sha256_in_prefix": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182",
|
| 172 |
+
"size_in_bytes": 18
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"_path": "man/man1/bzfgrep.1",
|
| 176 |
+
"path_type": "hardlink",
|
| 177 |
+
"sha256": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182",
|
| 178 |
+
"sha256_in_prefix": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182",
|
| 179 |
+
"size_in_bytes": 18
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
"_path": "man/man1/bzgrep.1",
|
| 183 |
+
"path_type": "hardlink",
|
| 184 |
+
"sha256": "924aa4a7c7c1467400181e4c0ee1b527db142b6399a717171f2351b72b5899df",
|
| 185 |
+
"sha256_in_prefix": "924aa4a7c7c1467400181e4c0ee1b527db142b6399a717171f2351b72b5899df",
|
| 186 |
+
"size_in_bytes": 1297
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"_path": "man/man1/bzip2.1",
|
| 190 |
+
"path_type": "hardlink",
|
| 191 |
+
"sha256": "27b984bb2e8bbee2651d11cda87449cfc4138d2e479b9eaa77b8f60fa5d0bf5d",
|
| 192 |
+
"sha256_in_prefix": "27b984bb2e8bbee2651d11cda87449cfc4138d2e479b9eaa77b8f60fa5d0bf5d",
|
| 193 |
+
"size_in_bytes": 16266
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"_path": "man/man1/bzless.1",
|
| 197 |
+
"path_type": "hardlink",
|
| 198 |
+
"sha256": "216898f9b8acf61eeb471ecf23e47c1452dfd648f7f38d7d3bf48627072dc52c",
|
| 199 |
+
"sha256_in_prefix": "216898f9b8acf61eeb471ecf23e47c1452dfd648f7f38d7d3bf48627072dc52c",
|
| 200 |
+
"size_in_bytes": 18
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"_path": "man/man1/bzmore.1",
|
| 204 |
+
"path_type": "hardlink",
|
| 205 |
+
"sha256": "ccfcf3f995e11adae3035e287252091bb72d165da21e0c385a4965d17c9051c7",
|
| 206 |
+
"sha256_in_prefix": "ccfcf3f995e11adae3035e287252091bb72d165da21e0c385a4965d17c9051c7",
|
| 207 |
+
"size_in_bytes": 4310
|
| 208 |
+
}
|
| 209 |
+
],
|
| 210 |
+
"paths_version": 1
|
| 211 |
+
},
|
| 212 |
+
"requested_spec": "None",
|
| 213 |
+
"sha256": "235f266d5f9c3c61748bb1af0eff21bc7ed2a2a356b97ff28d9c1135039b08b0",
|
| 214 |
+
"size": 268384,
|
| 215 |
+
"subdir": "linux-64",
|
| 216 |
+
"timestamp": 1714510571000,
|
| 217 |
+
"url": "https://repo.anaconda.com/pkgs/main/linux-64/bzip2-1.0.8-h5eee18b_6.conda",
|
| 218 |
+
"version": "1.0.8"
|
| 219 |
+
}
|