summaryrefslogtreecommitdiffstats
path: root/slackware64-current/source/a/pkgtools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'slackware64-current/source/a/pkgtools/scripts')
-rw-r--r--slackware64-current/source/a/pkgtools/scripts/explodepkg8
-rw-r--r--slackware64-current/source/a/pkgtools/scripts/installpkg27
-rw-r--r--slackware64-current/source/a/pkgtools/scripts/makepkg212
3 files changed, 118 insertions, 129 deletions
diff --git a/slackware64-current/source/a/pkgtools/scripts/explodepkg b/slackware64-current/source/a/pkgtools/scripts/explodepkg
index a16d03d4e..da35130e3 100644
--- a/slackware64-current/source/a/pkgtools/scripts/explodepkg
+++ b/slackware64-current/source/a/pkgtools/scripts/explodepkg
@@ -39,8 +39,8 @@ EOF
fi
# Set maximum number of threads to use. By default, this will be the number
-# of physical cores:
-THREADS="$(grep "cpu cores" /proc/cpuinfo | tail -n 1 | rev | cut -f 1 -d ' ' | rev)"
+# of CPU threads:
+THREADS="$(nproc)"
# Main loop:
for PKG in $* ; do
@@ -85,10 +85,10 @@ for PKG in $* ; do
packagecompression=lzma
;;
'txz' )
- packagecompression=xz
+ packagecompression="xz --threads=${THREADS}"
;;
'xz' )
- packagecompression=xz
+ packagecompression="xz --threads=${THREADS}"
;;
esac
( umask 000 ; cat $PKG | $packagecompression -dc | tar --xattrs --xattrs-include='*' --keep-directory-symlink -xpvf - 2> /dev/null )
diff --git a/slackware64-current/source/a/pkgtools/scripts/installpkg b/slackware64-current/source/a/pkgtools/scripts/installpkg
index f082ed585..4b25bb079 100644
--- a/slackware64-current/source/a/pkgtools/scripts/installpkg
+++ b/slackware64-current/source/a/pkgtools/scripts/installpkg
@@ -119,10 +119,12 @@ options: --warn (warn if files will be overwritten, but do not install)
--tagfile /somedir/tagfile (specify a different file to use
for package priorities. The default is "tagfile" in
the package's directory)
- --threads <number> For xz/lz compressed packages, set the max
+ --threads <number> For xz/plzip compressed packages, set the max
number of threads to be used for decompression. Only has
an effect if a multithreaded compressor was used, and then
- only on large packages. Default = number of physical cores.
+ only on large packages. For plzip, the default is equal to
+ the number of CPU threads available on the machine. For xz,
+ the default is equal to 2.
--md5sum (record the package's md5sum in the metadata file)
EOF
@@ -141,8 +143,8 @@ package_name() {
}
# Set maximum number of threads to use. By default, this will be the number
-# of physical cores:
-THREADS="$(grep "cpu cores" /proc/cpuinfo | tail -n 1 | rev | cut -f 1 -d ' ' | rev)"
+# of CPU threads:
+THREADS="$(nproc)"
# Parse options:
MODE=install # standard text-mode
@@ -178,6 +180,9 @@ while [ 0 ]; do
elif [ "$1" = "-threads" -o "$1" = "--threads" ]; then
THREADS="$2"
shift 2
+ # xz has not yet implemented multi-threaded decompression.
+ # Who knows if or how well it will work...
+ XZ_THREADS_FORCED=yes
elif [ "$1" = "-priority" -o "$1" = "--priority" ]; then
if [ "$2" = "" ]; then
usage
@@ -248,7 +253,11 @@ if [ "$MODE" = "warn" ]; then
fi
;;
'txz' )
- packagecompression="xz --threads=threads=${THREADS}"
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
;;
esac
( cd $TMP/scan$$ ; $packagecompression -dc | tar xf - install ) < $1 2> /dev/null
@@ -328,12 +337,16 @@ for package in $* ; do
fi
;;
'txz' )
- packagecompression=xz
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
;;
esac
# Test presence of external compression utility:
- if ! $packagecompression --help 1> /dev/null 2> /dev/null ; then
+ if ! $(echo $packagecompression | cut -f 1 -d ' ') --help 1> /dev/null 2> /dev/null ; then
EXITSTATUS=5
if [ "$MODE" = "install" ]; then
echo "Cannot install $package: external compression utility $packagecompression missing"
diff --git a/slackware64-current/source/a/pkgtools/scripts/makepkg b/slackware64-current/source/a/pkgtools/scripts/makepkg
index d3f989d34..4d8b14ab3 100644
--- a/slackware64-current/source/a/pkgtools/scripts/makepkg
+++ b/slackware64-current/source/a/pkgtools/scripts/makepkg
@@ -81,10 +81,13 @@ options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended)
programs in the doinst.sh script)
-c, --chown y|n (resets all permissions to root:root 755
- not generally recommended)
- --threads <number> For xz/lz compressed packages, set the max
+ --threads <number> For xz/plzip compressed packages, set the max
number of threads to be used for compression. Only has
- an effect on large packages. Default = number of physical
- cores for lz, or 1 for xz.
+ an effect on large packages. For plzip, the default is
+ equal to the number of CPU threads available on the
+ machine. For xz, the default is equal to 2 (due to
+ commonly occuring memory related failures when using
+ many threads with multi-threaded xz compression).
--acls Support storing POSIX ACLs in the package. The resulting
package will not be compatible with pkgtools version < 15.0.
@@ -101,9 +104,8 @@ TMP=/tmp # This can be a hole, but I'm going to be careful about file
# creation in there, so don't panic. :^)
# Set maximum number of threads to use. By default, this will be the number
-# of physical cores:
-THREADS="$(grep "cpu cores" /proc/cpuinfo | tail -n 1 | rev | cut -f 1 -d ' ' | rev)"
-
+# of CPU threads:
+THREADS="$(nproc)"
# Parse options
unset ACLS XATTRS
@@ -133,10 +135,10 @@ while [ 0 ]; do
shift 1
elif [ "$1" = "-threads" -o "$1" = "--threads" ]; then
THREADS="$2"
- # xz has memory issues with threads it seems, so we'll use one thread by
+ shift 2
+ # xz has memory issues with threads it seems, so we'll use two threads by
# default unless we see that something else was user-selected:
XZ_THREADS_FORCED=yes
- shift 2
elif [ "$1" = "--acls" ]; then
ACLS="--acls"
shift 1
@@ -155,28 +157,99 @@ PACKAGE_NAME="$1"
TARGET_NAME="$(dirname $PACKAGE_NAME)"
PACKAGE_NAME="$(basename $PACKAGE_NAME)"
-# Identify package extension:
+# Identify package extension and compression type to use:
if [ ! "$(basename $PACKAGE_NAME .tgz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tgz"
+ COMPEXT="gz"
+ COMPRESSOR="gzip -9 -c"
+ if ! which gzip 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: gzip compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.gz)" = "$PACKAGE_NAME" ]; then
- # .tar.compression is also supported, although the resulting "packages" will
- # not be installable by installpkg without the correct 3 letter extension
- # instead.
EXTENSION="tar.gz"
+ COMPRESSOR="gzip -9 -c"
+ if ! which gzip 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: gzip compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tbz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tbz"
+ COMPRESSOR="bzip2 -9 -c"
+ if ! which bzip2 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: bzip2 compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.bz2)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.bz2"
+ COMPRESSOR="bzip2 -9 -c"
+ if ! which bzip2 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: bzip2 compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tlz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tlz"
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="plzip -9 --threads=${THREADS} -c"
+ else
+ echo "WARNING: plzip compression utility not found in \$PATH."
+ echo "WARNING: package will not support multithreaded decompression."
+ if which lzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lzip -9 -c"
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.lz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.lz"
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="plzip -9 --threads=${THREADS} -c"
+ else
+ echo "WARNING: plzip compression utility not found in \$PATH."
+ echo "WARNING: package will not support multithreaded decompression."
+ if which lzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lzip -9 -c"
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.lzma)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.lzma"
+ COMPRESSOR="lzma -9 -c"
+ if ! which lzma 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: lzma compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .txz)" = "$PACKAGE_NAME" ]; then
EXTENSION="txz"
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ # Two threads by default with xz due to memory failures on 32-bit. Not that
+ # it matters much... if upstream ever gets around to implementing multi-
+ # threaded decompression we'll revisit this default. :-D
+ COMPRESSOR="xz -9 --threads=2 -c"
+ else
+ COMPRESSOR="xz -9 --threads=${THREADS} -c"
+ fi
+ if ! which xz 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: xz compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.xz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.xz"
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ # Two threads by default with xz due to memory failures on 32-bit. Not that
+ # it matters much... if upstream ever gets around to implementing multi-
+ # threaded decompression we'll revisit this default. :-D
+ COMPRESSOR="xz -9 --threads=2 -c"
+ else
+ COMPRESSOR="xz -9 --threads=${THREADS} -c"
+ fi
+ if ! which xz 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: xz compression utility not found in \$PATH."
+ exit 3
+ fi
else
EXTENSION="$(echo $PACKAGE_NAME | rev | cut -f 1 -d . | rev)"
echo "ERROR: Package extension .$EXTENSION is not supported."
@@ -191,44 +264,6 @@ if [ "$CWD" = "$TARGET_NAME" -o "." = "$TARGET_NAME" ]; then
exit 2
fi
-# Make sure external compression utility is available:
-case $EXTENSION in
-'tgz' | 'tar.gz' )
- if ! which gzip 1> /dev/null 2> /dev/null ; then
- echo "ERROR: gzip compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'tbz' | 'tar.bz2' )
- if ! which bzip2 1> /dev/null 2> /dev/null ; then
- echo "ERROR: bzip2 compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'tar.lzma' )
- if ! which lzma 1> /dev/null 2> /dev/null ; then
- echo "ERROR: lzma compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'tlz' | 'tar.lz' )
- if ! which plzip 1> /dev/null 2> /dev/null ; then
- echo "WARNING: plzip compression utility not found in \$PATH."
- echo "WARNING: package will not support multithreaded decompression."
- if ! which lzip 1> /dev/null 2> /dev/null ; then
- echo "ERROR: lzip compression utility not found in \$PATH."
- exit 3
- fi
- fi
- ;;
-'txz' | 'tar.xz' )
- if ! which xz 1> /dev/null 2> /dev/null ; then
- echo "ERROR: xz compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-esac
-
echo
echo "Slackware package maker, version 3.1415927."
echo
@@ -342,79 +377,20 @@ rm -f ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
# the end of the archive list. This was the proposed code:
#FILEDIR=$(mktemp -d /tmp/makepkg.XXXXXX)
#find ./ | sed "s,^\./\(.\),\1," > $FILEDIR/filelist
-#tar --no-recursion $ACLS $XATTRS -T $FILEDIR/filelist -cvf - . | gzip -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+#tar --no-recursion $ACLS $XATTRS -T $FILEDIR/filelist -cvf - . > ${TARGET_NAME}/${TAR_NAME}.tar
# If cpio is used to make a tar archive, then the filelist method works:
-#cat $FILEDIR/filelist | cpio --quiet -ovHustar | gzip -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+#cat $FILEDIR/filelist | cpio --quiet -ovHustar > ${TARGET_NAME}/${TAR_NAME}.tar
# The possible disadvantage of using a transform is that it's not available
# with all versions of tar, but hopefully that won't be an issue. If it is,
# we'll worry about it then.
-case $EXTENSION in
-'tgz' | 'tar.gz' )
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | gzip -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $? = 0 ]; then
- echo "ERROR: gzip returned error code $? -- makepkg failed."
- exit 1
- fi
- ;;
-'tbz' | 'tar.bz2' )
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | bzip2 -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: bzip2 returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- ;;
-'tlz' | 'tar.lz' )
- # Try to use plzip regardless of number of requested threads so that the
- # resulting package can be decompressed with multiple threads:
- if which plzip 1> /dev/null 2> /dev/null ; then
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | plzip -9 --threads=${THREADS} -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: plzip returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- else # we've already checked for lzip, so fall back to it now:
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | lzip -9 -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: lzip returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- fi
- ;;
-'tar.lzma' )
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | lzma -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: lzma returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- ;;
-'txz' | 'tar.xz' )
- if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
- # One thread by default due to xz memory bugs with threads:
- THREADS=1
- fi
- if [ "$THREADS" = "1" ]; then
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | xz -9 -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: xz returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- else
- tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | xz -9 --threads=${THREADS} -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: xz returned error code $ERRCODE -- makepkg failed."
- exit 1
- fi
- fi
- ;;
-esac
+# Create the package:
+tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | $COMPRESSOR > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+ERRCODE=$?
+if [ ! $ERRCODE = 0 ]; then
+ echo "ERROR: $COMPRESSOR returned error code $ERRCODE -- makepkg failed."
+ exit 1
+fi
# Warn of zero-length files:
find . -type f -size 0c | while read file ; do