Init, adding corrade,magnum,magnum-plugins,magnum-integration,magnum-extras, and magnum-examples 2025.47_1

This commit is contained in:
2025-11-19 13:35:26 +02:00
parent 6031ef978f
commit 17b687c5c1
346 changed files with 28087 additions and 12 deletions

View File

View File

@@ -0,0 +1,184 @@
vextract() {
local sc=--strip-components=1
local dst=
while [ "$#" -ne 1 ]; do
case "$1" in
-C)
if [ -z "$2" ]; then
msg_error "$pkgver: vextract -C <directory>.\n"
fi
dst="$2"
mkdir -p "$dst"
shift 2
;;
--no-strip-components)
sc=
shift
;;
--strip-components=*)
sc="$1"
shift
;;
--)
shift; break ;;
*)
break ;;
esac
done
local TAR_CMD="${tar_cmd}"
local sfx
local archive="$1"
local ret=0
[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v bsdtar)"
[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v tar)"
[ -z "$TAR_CMD" ] && msg_error "xbps-src: no suitable tar cmd (bsdtar, tar)\n"
case "$archive" in
*.tar.lzma) sfx="txz";;
*.tar.lz) sfx="tlz";;
*.tlz) sfx="tlz";;
*.tar.xz) sfx="txz";;
*.txz) sfx="txz";;
*.tar.bz2) sfx="tbz";;
*.tbz) sfx="tbz";;
*.tar.gz) sfx="tgz";;
*.tgz) sfx="tgz";;
*.tar.zst) sfx="tzst";;
*.tzst) sfx="tzst";;
*.gz) sfx="gz";;
*.xz) sfx="xz";;
*.bz2) sfx="bz2";;
*.zst) sfx="zst";;
*.tar) sfx="tar";;
*.zip) sfx="zip";;
*.rpm) sfx="rpm";;
*.deb) sfx="deb";;
*.patch) sfx="txt";;
*.diff) sfx="txt";;
*.txt) sfx="txt";;
*.sh) sfx="txt";;
*.7z) sfx="7z";;
*.gem) sfx="gem";;
*.crate) sfx="crate";;
*) msg_error "$pkgver: unknown distfile suffix for $archive.\n";;
esac
case ${sfx} in
tar|txz|tbz|tlz|tgz|tzst|crate)
$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner \
-f $archive
;;
gz|bz2|xz|zst)
cp -f $archive "${dst:-.}"
(
if [ "$dst" ]; then cd "$dst"; fi
case ${sfx} in
gz)
gunzip -f ${archive##*/}
;;
bz2)
bunzip2 -f ${archive##*/}
;;
xz)
unxz -f ${archive##*/}
;;
zst)
unzstd ${archive##*/}
;;
esac
)
;;
zip)
if command -v unzip &>/dev/null; then
unzip -o -q $archive ${dst:+-d "$dst"}
elif command -v bsdtar &>/dev/null; then
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
else
msg_error "$pkgver: cannot find unzip or bsdtar bin for extraction.\n"
fi
;;
rpm)
if ! command -v bsdtar &>/dev/null; then
msg_error "$pkgver: cannot find bsdtar for extraction.\n"
fi
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner -f $archive
;;
deb)
if command -v bsdtar &>/dev/null; then
bsdtar -x -O -f "$archive" "data.tar.*" |
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
--no-same-permissions --no-same-owner -f -
else
msg_error "$pkgver: cannot find bsdtar for extraction.\n"
fi
;;
txt)
cp -f $archive "$dst"
;;
7z)
if command -v 7z &>/dev/null; then
7z x $archive -o"$dst"
elif command -v bsdtar &>/dev/null; then
bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
else
msg_error "$pkgver: cannot find 7z or bsdtar bin for extraction.\n"
fi
;;
gem)
$TAR_CMD -xOf $archive data.tar.gz |
$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -xz -f -
;;
*)
msg_error "$pkgver: cannot guess $archive extract suffix. ($sfx)\n"
;;
esac
if [ "$?" -ne 0 ]; then
msg_error "$pkgver: extracting $archive.\n"
fi
}
vsrcextract() {
local sc=--strip-components=1
local dst=
while [ "$#" -ge 1 ]; do
case "$1" in
-C)
if [ -z "$2" ]; then
msg_error "$pkgver: vsrcextract -C <directory>.\n"
fi
dst="$2"
shift 2
;;
--no-strip-components|--strip-components=*)
sc="$1"
shift
;;
*)
break ;;
esac
done
local archive="$1"
shift
vextract "$sc" ${dst:+-C "$dst"} \
"${XBPS_SRCDISTDIR}/${sourcepkg}-${version}/$archive" "$@"
}
vtar() {
bsdtar "$@"
}
vsrccopy() {
local _tgt
if [ $# -lt 2 ]; then
msg_error "vsrccopy <file>... <target>"
fi
_tgt="${@: -1}"
mkdir -p "$_tgt"
while [ $# -gt 1 ]; do
cp -a "${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1" "$_tgt"
shift
done
}

View File

@@ -0,0 +1,35 @@
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
# only run this, if SOURCE_DATE_EPOCH isn't set.
if [ -z "$XBPS_GIT_CMD" ]; then
if [ -z "$XBPS_USE_BUILD_MTIME" ] || [ -n "$XBPS_USE_GIT_REVS" ]; then
msg_error "BUG: environment/setup: XBPS_GIT_CMD is not set\n"
fi
fi
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
unset SOURCE_DATE_EPOCH
elif [ -z "${SOURCE_DATE_EPOCH}" ]; then
if [ -n "$IN_CHROOT" ]; then
msg_error "xbps-src's BUG: SOURCE_DATE_EPOCH is undefined\n"
fi
# check if the template is under version control:
if [ -n "$basepkg" -a -z "$($XBPS_GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} ls-files template)" ]; then
export SOURCE_DATE_EPOCH="$(stat_mtime ${XBPS_SRCPKGDIR}/${basepkg}/template)"
else
export SOURCE_DATE_EPOCH=$($XBPS_GIT_CMD -C ${XBPS_DISTDIR} cat-file commit HEAD |
sed -n '/^committer /{s/.*> \([0-9][0-9]*\) [-+][0-9].*/\1/p;q;}')
fi
fi
# if XBPS_USE_GIT_REVS is enabled in conf file,
# compute XBPS_GIT_REVS to use in pkg hooks
if [ -z "$XBPS_USE_GIT_REVS" ]; then
unset XBPS_GIT_REVS
elif [ -z "$XBPS_GIT_REVS" ]; then
if [ -n "$IN_CHROOT" ]; then
msg_error "xbps-src's BUG: XBPS_GIT_REVS is undefined\n"
else
export XBPS_GIT_REVS="$($XBPS_GIT_CMD -C "${XBPS_DISTDIR}" rev-parse --verify --short HEAD)"
fi
fi

View File

@@ -0,0 +1,285 @@
# -*-* shell *-*-
# enable aliases
shopt -s expand_aliases
# clear all aliases
unalias -a
# disable wildcards helper
_noglob_helper() {
set +f
IFS= "$@"
}
# Apply _noglob to v* commands
for cmd in vinstall vcopy vcompletion vmove vmkdir vbin vman vdoc vconf vsconf vlicense vsv; do
# intentionally expanded when defined
# shellcheck disable=SC2139
alias ${cmd}="set -f; _noglob_helper _${cmd}"
done
_vsv() {
local service="$1"
local facility="${2:-daemon}"
local LN_OPTS="-s"
local svdir="${PKGDESTDIR}/etc/sv/${service}"
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
# pkgver is defined in common/xbps-src/shutils/commmon.sh
# shellcheck disable=SC2154
msg_red "$pkgver: vsv: up to 2 arguments expected: <service> [<log facility>]\n"
return 1
fi
if [ -n "$XBPS_BUILD_FORCEMODE" ]; then
LN_OPTS+="f"
fi
vmkdir etc/sv
vcopy "${FILESDIR}/$service" etc/sv
grep -Fq 'exec 2>&1' "$svdir/run" || msg_warn "$pkgver: vsv: service '$service' does not contain 'exec 2>&1' to log stderr\n"
for f in run finish check control/{a,c,d,h,i,k,p,q,t,u,x,1,2}; do
[ -e "$svdir/$f" ] && [ ! -L "$svdir/$f" ] && chmod 755 "$svdir/$f"
done
ln ${LN_OPTS} "/run/runit/supervise.${service}" "$svdir/supervise"
if [ -d "$svdir/log" ] || [ -L "$svdir/log" ]; then
msg_warn "$pkgver: vsv: overriding default log service\n"
else
mkdir "$svdir/log"
cat <<-EOF > "$svdir/log/run"
#!/bin/sh
exec vlogger -t $service -p $facility
EOF
fi
ln ${LN_OPTS} "/run/runit/supervise.${service}-log" "$svdir/log/supervise"
if [ -e "$svdir/log/run" ] && [ ! -L "$svdir/log/run" ]; then
chmod 755 "${PKGDESTDIR}/etc/sv/${service}/log/run"
fi
}
_vbin() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vbin: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 755 usr/bin "$targetfile"
}
_vman() {
local file="$1" target="${2:-${1##*/}}"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vman: 1 argument expected: <file>\n"
return 1
fi
suffix=${target##*.}
if [[ $suffix == gz ]]
then
gunzip "$file"
file="${file:0:-3}"
target="${target:0:-3}"
suffix=${target##*.}
fi
if [[ $suffix == bz2 ]]
then
bunzip2 "$file"
file="${file:0:-4}"
target="${target:0:-4}"
suffix=${target##*.}
fi
if [[ $target =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?(\.[^.]+)?)\.(.*) ]]
then
name=${BASH_REMATCH[1]}.${BASH_REMATCH[5]}
mandir=${BASH_REMATCH[2]}/man${suffix:0:1}
else
name=$target
mandir=man${suffix:0:1}
fi
if [[ ${mandir} == *man[0-9n] ]] ; then
vinstall "$file" 644 "usr/share/man/${mandir}" "$name"
return 0
fi
msg_red "$pkgver: vman: Filename '${target}' does not look like a man page\n"
return 1
}
_vdoc() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vdoc: 1 argument expected: <file>\n"
return 1
fi
# pkgname is defined in the package
# shellcheck disable=SC2154
vinstall "$file" 644 "usr/share/doc/${pkgname}" "$targetfile"
}
_vconf() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vconf: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 etc "$targetfile"
}
_vsconf() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vsconf: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 "usr/share/examples/${pkgname}" "$targetfile"
}
_vlicense() {
local file="$1" targetfile="$2"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vlicense: 1 argument expected: <file>\n"
return 1
fi
vinstall "$file" 644 "usr/share/licenses/${pkgname}" "$targetfile"
}
_vinstall() {
local file="$1" mode="$2" targetdir="$3" targetfile="$4"
if [ -z "$PKGDESTDIR" ]; then
msg_red "$pkgver: vinstall: PKGDESTDIR unset, can't continue...\n"
return 1
fi
if [ $# -lt 3 ]; then
msg_red "$pkgver: vinstall: 3 arguments expected: <file> <mode> <target-directory>\n"
return 1
fi
if [ ! -r "${file}" ]; then
msg_red "$pkgver: vinstall: cannot find '$file'...\n"
return 1
fi
if [ -z "$targetfile" ]; then
install -Dm"${mode}" "${file}" "${PKGDESTDIR}/${targetdir}/${file##*/}"
else
install -Dm"${mode}" "${file}" "${PKGDESTDIR}/${targetdir}/${targetfile##*/}"
fi
}
_vcopy() {
local files="$1" targetdir="$2"
if [ -z "$PKGDESTDIR" ]; then
msg_red "$pkgver: vcopy: PKGDESTDIR unset, can't continue...\n"
return 1
fi
if [ $# -ne 2 ]; then
msg_red "$pkgver: vcopy: 2 arguments expected: <files> <target-directory>\n"
return 1
fi
# intentionally unquoted for globbing
# shellcheck disable=SC2086
cp -a $files "${PKGDESTDIR}/${targetdir}"
}
_vmove() {
local f files="$1" _targetdir
if [ -z "$DESTDIR" ]; then
msg_red "$pkgver: vmove: DESTDIR unset, can't continue...\n"
return 1
elif [ -z "$PKGDESTDIR" ]; then
msg_red "$pkgver: vmove: PKGDESTDIR unset, can't continue...\n"
return 1
elif [ "$DESTDIR" = "$PKGDESTDIR" ]; then
msg_red "$pkgver: vmove is intended to be used in pkg_install\n"
return 1
fi
if [ $# -ne 1 ]; then
msg_red "$pkgver: vmove: 1 argument expected: <files>\n"
return 1
fi
for f in ${files}; do
_targetdir=${f%/*}/
break
done
if [ -z "${_targetdir}" ]; then
[ ! -d "${PKGDESTDIR}" ] && install -d "${PKGDESTDIR}"
# intentionally unquoted for globbing
# shellcheck disable=SC2086
mv "${DESTDIR}"/$files "${PKGDESTDIR}"
else
if [ ! -d "${PKGDESTDIR}/${_targetdir}" ]; then
install -d "${PKGDESTDIR}/${_targetdir}"
fi
# intentionally unquoted for globbing
# shellcheck disable=SC2086
mv "${DESTDIR}"/$files "${PKGDESTDIR}/${_targetdir}"
fi
}
_vmkdir() {
local dir="$1" mode="$2"
if [ -z "$PKGDESTDIR" ]; then
msg_red "$pkgver: vmkdir: PKGDESTDIR unset, can't continue...\n"
return 1
fi
if [ -z "$dir" ]; then
msg_red "vmkdir: directory argument unset.\n"
return 1
fi
if [ -z "$mode" ]; then
install -d "${PKGDESTDIR}/${dir}"
else
install -dm"${mode}" "${PKGDESTDIR}/${dir}"
fi
}
_vcompletion() {
local file="$1" shell="$2" cmd="${3:-${pkgname}}"
local _bash_completion_dir=usr/share/bash-completion/completions/
local _fish_completion_dir=usr/share/fish/vendor_completions.d/
local _zsh_completion_dir=usr/share/zsh/site-functions/
if [ $# -lt 2 ]; then
msg_red "$pkgver: vcompletion: 2 arguments expected: <file> <shell>\n"
return 1
fi
if ! [ -f "$file" ]; then
msg_red "$pkgver: vcompletion: file $file doesn't exist\n"
fi
case "$shell" in
bash) vinstall "$file" 0644 $_bash_completion_dir "${cmd}" ;;
fish) vinstall "$file" 0644 $_fish_completion_dir "${cmd}.fish" ;;
zsh) vinstall "$file" 0644 $_zsh_completion_dir "_${cmd}" ;;
*)
msg_red "$pkgver: vcompletion: unknown shell ${shell}"
return 1
;;
esac
}

View File

@@ -0,0 +1,22 @@
#
# Common variables that can be used by xbps-src.
#
# SITE used for distfiles mirrors. For use in $distfiles.
set -a
SOURCEFORGE_SITE="https://downloads.sourceforge.net/sourceforge"
NONGNU_SITE="https://download.savannah.nongnu.org/releases"
UBUNTU_SITE="http://archive.ubuntu.com/ubuntu/pool"
XORG_SITE="https://www.x.org/releases/individual"
DEBIAN_SITE="https://ftp.debian.org/debian/pool"
GNOME_SITE="https://download.gnome.org/sources"
KERNEL_SITE="https://www.kernel.org/pub/linux"
CPAN_SITE="https://www.cpan.org/modules/by-module"
PYPI_SITE="https://files.pythonhosted.org/packages/source"
MOZILLA_SITE="https://ftp.mozilla.org/pub"
GNU_SITE="https://ftp.gnu.org/gnu"
FREEDESKTOP_SITE="https://www.freedesktop.org/software"
KDE_SITE="https://download.kde.org/stable"
VIDEOLAN_SITE="https://download.videolan.org/pub/videolan"
set +a

View File

@@ -0,0 +1,46 @@
# vim: set ts=4 sw=4 et:
vopt_if() {
local name="build_option_$1" t="$2" f="$3"
if [ ${!name} ]; then
echo -n "$t"
else
echo -n "$f"
fi
}
vopt_with() {
local opt="$1" flag="${2:-$1}"
vopt_if "$opt" "--with-${flag}" "--without-${flag}"
}
vopt_enable() {
local opt="$1" flag="${2:-$1}"
if [ "$#" -gt "2" ]; then
msg_error "vopt_enable $opt: $(($# - 2)) excess parameter(s)\n"
fi
vopt_if "$1" "--enable-${flag}" "--disable-${flag}"
}
vopt_conflict() {
local opt1="$1" opt2="$2" n1="build_option_$1" n2="build_option_$2"
if [ "${!n1}" -a "${!n2}" ]; then
msg_error "options '${opt1}' and '${opt2}' conflict\n"
fi
}
vopt_bool() {
local opt="$1" prop="${2:-$1}"
if [ "$#" -gt "2" ]; then
msg_error "vopt_bool $opt: $(($# - 2)) excess parameter(s)\n"
fi
vopt_if "$1" "-D${prop}=true" "-D${prop}=false"
}
vopt_feature() {
local opt="$1" prop="${2:-$1}"
if [ "$#" -gt "2" ]; then
msg_error "vopt_feature $opt: $(($# - 2)) excess parameter(s)\n"
fi
vopt_if "$1" "-D${prop}=enabled" "-D${prop}=disabled"
}

View File

@@ -0,0 +1,14 @@
#
# Useful variables for determining Python version and paths.
#
py2_ver="2.7"
py2_lib="usr/lib/python${py2_ver}"
py2_sitelib="${py2_lib}/site-packages"
py2_inc="usr/include/python${py2_ver}"
py3_ver="3.13"
py3_abiver=""
py3_lib="usr/lib/python${py3_ver}"
py3_sitelib="${py3_lib}/site-packages"
py3_inc="usr/include/python${py3_ver}${py3_abiver}"

View File

@@ -0,0 +1,41 @@
# This helper replaces shebang paths pointing to the correct ones
# as used by xbps. Multiple languages are supported:
#
# - GNU Bash
# - Perl
# - Python
#
bash_regexp=".*sh"
perl_regexp=".*perl[^[:space:]]*"
python_regexp=".*python[^[:space:]]*"
replace_interpreter() {
local lang="$1" file="$2" trsb orsb
[ -z $lang -o -z $file ] && return 1
case $lang in
bash)
orsb=$bash_regexp
trpath="/bin/bash"
;;
perl)
orsb=$perl_regexp
trpath="/usr/bin/perl"
;;
python)
orsb=$python_regexp
trpath="/usr/bin/python"
;;
*)
;;
esac
if [ -f $file ]; then
sed -i -e "1s|^#![[:space:]]*${orsb}|#!${trpath}|" $file
msg_normal "Transformed $lang script: ${file##$wrksrc}.\n"
else
msg_warn "Ignoring nonexistent $lang script: ${file##$wrksrc}.\n"
fi
}

View File

@@ -0,0 +1,87 @@
# This shell snippet unsets all variables/functions that can be used in
# the package template (excluding subpackages).
# Exported variables
for var in $(awk 'BEGIN{for (i in ENVIRON) {print i}}' </dev/null); do
# Those variables in chroot.sh will be kept
case "$var" in
BASH_FUNC_*'%%')
# bash exported functions
var="${var%??}"
var="${var#BASH_FUNC_}"
unset -f "$var"
;;
XBPS_* | IN_CHROOT | CHROOT_READY | SOURCE_DATE_EPOCH | NOCOLORS)
# xbps-src specific
;;
SOURCEFORGE_SITE | NONGNU_SITE | XORG_SITE | DEBIAN_SITE | GNOME_SITE)
;;
KERNEL_SITE | CPAN_SITE | PYPI_SITE | MOZILLA_SITE | GNU_SITE)
;;
FREEDESKTOP_SITE | KDE_SITE | VIDEOLAN_SITE | UBUNTU_SITE)
;;
_ | PWD | SHLVL | USER | PATH | SHELL | HOME | LC_COLLATE | LANG | TERM | PS1)
# known variables for shell
;;
DISTCC_HOSTS | DISTCC_DIR)
;;
CCACHE_DIR | CCACHE_COMPRESS)
;;
HTTP_PROXY | HTTPS_PROXY | SOCKS_PROXY | NO_PROXY | HTTP_PROXY_AUTH)
;;
FTP_PROXY | FTP_RETRIES)
;;
http_proxy | https_proxy | ftp_proxy | all_proxy | no_proxy)
;;
*)
unset -v "$var"
;;
esac
done
unset -v var
## VARIABLES
unset -v pkgname version revision short_desc homepage license maintainer
unset -v archs distfiles checksum build_style build_helper nocross broken
unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc
unset -v make_build_args make_check_args make_install_args
unset -v make_build_target make_check_target make_install_target
unset -v make_cmd meson_cmd gem_cmd fetch_cmd make_check_pre
unset -v python_version stackage
unset -v cmake_builddir meson_builddir
unset -v meson_crossfile
unset -v qmake_default_version
unset -v gemspec
unset -v go_import_path go_package go_mod_mode
unset -v patch_args disable_parallel_build disable_parallel_check
unset -v keep_libtool_archives make_use_env
unset -v reverts subpackages makedepends hostmakedepends checkdepends depends restricted
unset -v nopie build_options build_options_default bootstrap repository reverts
unset -v CFLAGS CXXFLAGS FFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH
unset -v CC CXX CPP GCC LD AR AS RANLIB NM OBJDUMP OBJCOPY STRIP READELF PKG_CONFIG
unset -v CMAKE_GENERATOR
unset -v scons_use_destdir
# build-helper python3
unset -v PYPREFIX LDSHARED PYTHON_CONFIG PYTHONPATH _PYTHON_SYSCONFIGDATA_NAME
# unset all $build_option_ variables
unset -v "${!build_option_@}"
# hooks/do-extract/00-distfiles
unset -v skip_extraction
# hooks/post-install/03-strip-and-debug-pkgs
unset -v nodebug
# build-helpers/gir.sh for cross builds
unset -v GIR_EXTRA_LIBS_PATH GIR_EXTRA_OPTIONS
## FUNCTIONS
unset -f pre_fetch do_fetch post_fetch
unset -f pre_extract do_extract post_extract
unset -f pre_patch do_patch post_patch
unset -f pre_configure do_configure post_configure
unset -f pre_build do_build post_build
unset -f pre_check do_check post_check
unset -f pre_install do_install post_install
unset -f do_clean

View File

@@ -0,0 +1,71 @@
# Helper function for calling sed on files and checking if the
# file is actually changed
#
# NOTE: this will not check if the input is valid, you can problably
# make it execute arbirtrary commands via passing '; cmd' to a vsed
# call.
vsed() {
local files=() regexes=() OPTIND OPTSTRING="ie:" has_inline=
eval set -- "$(getopt -s bash "$OPTSTRING" "$@")";
while getopts "$OPTSTRING" opt; do
case $opt in
i) has_inline=1 ;;
e) regexes+=("$OPTARG") ;;
*) ;;
esac
done
if ! [ "$has_inline" ]; then
msg_red "$pkgver: vsed: you must specify -i.\n"
return 1
fi
shift $(($OPTIND - 1))
if [ ${#regexes[@]} -eq 0 ] && [ $# -ge 2 ]; then
regexes+=("$1")
shift
fi
if [ ${#regexes[@]} -eq 0 ]; then
msg_red "$pkgver: vsed: no regexes specified.\n"
return 1
fi
for i; do
files+=("$i")
done
if [ ${#files[@]} -eq 0 ]; then
msg_red "$pkgver: vsed: no files specified.\n"
return 1
fi
for f in "${files[@]}"; do
olddigest="$($XBPS_DIGEST_CMD "$f")"
olddigest="${olddigest%% *}"
for rx in "${regexes[@]}"; do
sed -i "$f" -e "$rx" || {
msg_red "$pkgver: vsed: sed call failed with regex \"$rx\" on file \"$f\"\n"
return 1
}
newdigest="$($XBPS_DIGEST_CMD "$f")"
newdigest="${newdigest%% *}"
msgfunc=msg_warn
if [ -n "$XBPS_STRICT" ]; then
msgfunc=msg_error
fi
if [ "$olddigest" = "$newdigest" ]; then
$msgfunc "$pkgver: vsed: regex \"$rx\" didn't change file \"$f\"\n"
fi
olddigest="${newdigest}"
done
done
}