sys-apps/file: Sync with Gentoo

It's from Gentoo commit 356c6e44a078df5dd408db2f931d668911cae354.
This commit is contained in:
Krzesimir Nowak 2022-12-12 15:24:00 +01:00
parent 7da9b6b6e4
commit a49767dc1f
15 changed files with 233 additions and 261 deletions

View File

@ -1,2 +1,4 @@
DIST file-5.40.tar.gz 1004214 BLAKE2B 4e15a1ca62fe7c03c90b0e509dc899b87f4474f758ad3d08172b3d838dc3f7c2954ba1074eeeeb3da8c04b8df84eff2b8cdf3177da334a926914429df67f60bf SHA512 3b70df75fa4c9050d55b1ffdc28e5f3c8b8ef7d4efd1a06bf53f113b676d81114a85aae56e0897d32b53716662d64ad18ab251ca8c92c6405c69eb758bb99afb DIST file-5.43.tar.gz 1162786 BLAKE2B aaaf32c5054fb83e912af6656e5e67947f45576ec3711c7cba5531ed780e142a448580e0db41a828c8a3c5d2f1bf0c8ed49bc9688499caaae4a08baa16b3610c SHA512 9d02f4e7a69d90468d6bd35df5ec240ddee8c2408b7df3e73427d7f18736baf77db0638a1fe8283f4e6abd1d5ad653890ed3a5a0d48bb52d4023ca4070ecdf06
DIST file-5.41.tar.gz 1064097 BLAKE2B 56fe8a58d9497bb1bfe3ed6b3ce5df70dd27cc308eb0cfdac8e91ba81c733a96aa622c120ac59079986c6d84901c6f2d82fa24f698d481d7f77e6cfdd432d648 SHA512 bbf2d8e39450b31d0ba8d76d202790fea953775657f942f06e6dc9091798d4a395f7205e542388e4a25b6a4506d07f36c5c4da37cfce0734133e9203a3b00654 DIST file-5.43.tar.gz.asc 195 BLAKE2B d7f83b3e21d1390467989f8870e36daa48ebb8c5ac7ab8dc6d667a65d10561126d32cfc5ef3d81a130990b3e46bcba9b5e03f0a7dd169782351b02cebec2471f SHA512 c565958840f2f5c62821cd08d4149ec97c574232913ec00400473364e160250cfaced8c715e109c4c617359e33d2470f7ca6af1891cbdf994329e890f90c8be3
DIST file-5.44.tar.gz 1186437 BLAKE2B a90ccae738a95315d75a0aaee7bbff3624425cc9267daf18ba9147b7c9b9ebfb31288b54c63a73e4695eca0e876f206e40bcb81c422f1bf572b976e753b25a42 SHA512 26c3b9c7a6950649d0b2de896bfeca54289febe4cd487c0f91aa6ff1857fa49f9077f8738a17b86100125668a31dae05b586615c564f78da47ac20a1e4a74f63
DIST file-5.44.tar.gz.asc 195 BLAKE2B a0905d42fec0fa052d75fb5b267c6ae223176451c0f1d3346006d4b760c3d858f2dcda5f0a30c6aa4b09b5afee427b75bc4debd5033d978f39dc1da01d3e1bd1 SHA512 1a4dc39283f4859581441aa35b3ed72b323c4e05ca0960d17126d1b9ec18465c695c0545e24f09f8437a60ab52e582be67b6cbbc656bbb676de00148c3644d23

View File

@ -1,22 +1,29 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=8
PYTHON_COMPAT=( python3_{8..10} ) DISTUTILS_USE_PEP517=setuptools
DISTUTILS_OPTIONAL=1 DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{8..11} )
inherit distutils-r1 libtool toolchain-funcs multilib-minimal inherit distutils-r1 libtool toolchain-funcs multilib-minimal
if [[ ${PV} == "9999" ]] ; then if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/glensc/file.git" EGIT_REPO_URI="https://github.com/glensc/file.git"
inherit autotools git-r3 inherit autotools git-r3
else else
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
inherit verify-sig
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz" SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi fi
DESCRIPTION="identify a file's format by scanning binary data for patterns" DESCRIPTION="Identify a file's format by scanning binary data for patterns"
HOMEPAGE="https://www.darwinsys.com/file/" HOMEPAGE="https://www.darwinsys.com/file/"
LICENSE="BSD-2" LICENSE="BSD-2"
@ -35,10 +42,16 @@ DEPEND="
RDEPEND="${DEPEND} RDEPEND="${DEPEND}
python? ( !dev-python/python-magic ) python? ( !dev-python/python-magic )
seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )" seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
BDEPEND+="
python? (
${PYTHON_DEPS}
${DISTUTILS_DEPS}
)"
PATCHES=( PATCHES=(
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978 "${FILESDIR}/file-5.43-portage-sandbox.patch" #713710 #728978
"${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/${P}-configure-clang16.patch"
) )
src_prepare() { src_prepare() {
@ -46,13 +59,14 @@ src_prepare() {
if [[ ${PV} == 9999 ]] ; then if [[ ${PV} == 9999 ]] ; then
eautoreconf eautoreconf
else
elibtoolize
fi fi
elibtoolize # don't let python README kill main README, bug ##60043
# don't let python README kill main README #60043
mv python/README.md python/README.python.md || die mv python/README.md python/README.python.md || die
sed 's@README.md@README.python.md@' -i python/setup.py || die #662090 # bug #662090
sed 's@README.md@README.python.md@' -i python/setup.py || die
} }
multilib_src_configure() { multilib_src_configure() {
@ -75,13 +89,14 @@ build_src_configure() {
--disable-xzlib --disable-xzlib
--disable-zlib --disable-zlib
) )
tc-env_build econf "${myeconfargs[@]}"
econf_build "${myeconfargs[@]}"
} }
need_build_file() { need_build_file() {
# when cross-compiling, we need to build up our own file # when cross-compiling, we need to build up our own file
# because people often don't keep matching host/target # because people often don't keep matching host/target
# file versions #362941 # file versions, bug #362941
tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}" tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
} }
@ -101,18 +116,20 @@ multilib_src_compile() {
if multilib_is_native_abi ; then if multilib_is_native_abi ; then
emake emake
else else
cd src || die # bug #586444
emake magic.h #586444 emake -C src magic.h
emake libmagic.la emake -C src libmagic.la
fi fi
} }
src_compile() { src_compile() {
if need_build_file ; then if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444 # bug #586444
emake -C "${WORKDIR}"/build/src magic.h
emake -C "${WORKDIR}"/build/src file emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}" local -x PATH="${WORKDIR}/build/src:${PATH}"
fi fi
multilib-minimal_src_compile multilib-minimal_src_compile
if use python ; then if use python ; then
@ -140,5 +157,6 @@ multilib_src_install_all() {
cd python || die cd python || die
distutils-r1_src_install distutils-r1_src_install
fi fi
find "${ED}" -type f -name "*.la" -delete || die find "${ED}" -type f -name "*.la" -delete || die
} }

View File

@ -1,48 +1,61 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=8
PYTHON_COMPAT=( python3_{8..10} ) DISTUTILS_USE_PEP517=setuptools
DISTUTILS_OPTIONAL=1 DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{8..11} )
inherit distutils-r1 libtool toolchain-funcs multilib-minimal inherit distutils-r1 libtool toolchain-funcs multilib-minimal
if [[ ${PV} == "9999" ]] ; then if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/glensc/file.git" EGIT_REPO_URI="https://github.com/glensc/file.git"
inherit autotools git-r3 inherit autotools git-r3
else else
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
inherit verify-sig
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz" SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi fi
DESCRIPTION="identify a file's format by scanning binary data for patterns" DESCRIPTION="Identify a file's format by scanning binary data for patterns"
HOMEPAGE="https://www.darwinsys.com/file/" HOMEPAGE="https://www.darwinsys.com/file/"
LICENSE="BSD-2" LICENSE="BSD-2"
SLOT="0" SLOT="0"
IUSE="bzip2 lzma python seccomp static-libs zlib" IUSE="bzip2 lzip lzma python seccomp static-libs zlib zstd"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND=" DEPEND="
bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] ) bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
lzip? ( app-arch/lzlib )
lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] ) lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
python? ( python? (
${PYTHON_DEPS} ${PYTHON_DEPS}
dev-python/setuptools[${PYTHON_USEDEP}] dev-python/setuptools[${PYTHON_USEDEP}]
) )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )" zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
"
RDEPEND="${DEPEND} RDEPEND="${DEPEND}
python? ( !dev-python/python-magic ) python? ( !dev-python/python-magic )
seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )" seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
BDEPEND+="
python? (
${PYTHON_DEPS}
${DISTUTILS_DEPS}
)"
PATCHES=( PATCHES=(
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978 "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/file-5.40-xz_magic.patch" #784773 "${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
"${FILESDIR}/file-5.40-seccomp-faccessat.patch" "${FILESDIR}/file-5.44-limits-solaris.patch" # applied upstream
"${FILESDIR}/file-5.40-seccomp-fstatat64.patch" #784857 "${FILESDIR}/file-5.44-seccomp-utimes.patch" # upstream
"${FILESDIR}/file-5.40-revert-char-count.patch" #799188
"${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
) )
src_prepare() { src_prepare() {
@ -50,24 +63,29 @@ src_prepare() {
if [[ ${PV} == 9999 ]] ; then if [[ ${PV} == 9999 ]] ; then
eautoreconf eautoreconf
else
elibtoolize
fi fi
elibtoolize # Don't let python README kill main README, bug ##60043
# don't let python README kill main README #60043
mv python/README.md python/README.python.md || die mv python/README.md python/README.python.md || die
sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
# bug #662090
sed 's@README.md@README.python.md@' -i python/setup.py || die
} }
multilib_src_configure() { multilib_src_configure() {
local myeconfargs=( local myeconfargs=(
--enable-fsect-man5 --enable-fsect-man5
$(use_enable bzip2 bzlib) $(use_enable bzip2 bzlib)
$(multilib_native_use_enable lzip lzlib)
$(use_enable lzma xzlib) $(use_enable lzma xzlib)
$(use_enable seccomp libseccomp) $(use_enable seccomp libseccomp)
$(use_enable static-libs static) $(use_enable static-libs static)
$(use_enable zlib) $(use_enable zlib)
$(use_enable zstd zstdlib)
) )
econf "${myeconfargs[@]}" econf "${myeconfargs[@]}"
} }
@ -79,13 +97,14 @@ build_src_configure() {
--disable-xzlib --disable-xzlib
--disable-zlib --disable-zlib
) )
tc-env_build econf "${myeconfargs[@]}"
econf_build "${myeconfargs[@]}"
} }
need_build_file() { need_build_file() {
# when cross-compiling, we need to build up our own file # When cross-compiling, we need to build up our own file
# because people often don't keep matching host/target # because people often don't keep matching host/target
# file versions #362941 # file versions, bug #362941
tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}" tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
} }
@ -105,18 +124,20 @@ multilib_src_compile() {
if multilib_is_native_abi ; then if multilib_is_native_abi ; then
emake emake
else else
cd src || die # bug #586444
emake magic.h #586444 emake -C src magic.h
emake libmagic.la emake -C src libmagic.la
fi fi
} }
src_compile() { src_compile() {
if need_build_file ; then if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444 # bug #586444
emake -C "${WORKDIR}"/build/src magic.h
emake -C "${WORKDIR}"/build/src file emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}" local -x PATH="${WORKDIR}/build/src:${PATH}"
fi fi
multilib-minimal_src_compile multilib-minimal_src_compile
if use python ; then if use python ; then
@ -134,7 +155,7 @@ multilib_src_install() {
} }
multilib_src_install_all() { multilib_src_install_all() {
dodoc ChangeLog MAINT README dodoc ChangeLog MAINT # README
# Required for `file -C` # Required for `file -C`
insinto /usr/share/misc/magic insinto /usr/share/misc/magic
@ -144,5 +165,6 @@ multilib_src_install_all() {
cd python || die cd python || die
distutils-r1_src_install distutils-r1_src_install
fi fi
find "${ED}" -type f -name "*.la" -delete || die find "${ED}" -type f -name "*.la" -delete || die
} }

View File

@ -1,43 +1,59 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=8
PYTHON_COMPAT=( python3_{8..10} ) DISTUTILS_USE_PEP517=setuptools
DISTUTILS_OPTIONAL=1 DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{8..11} )
inherit distutils-r1 libtool toolchain-funcs multilib-minimal inherit distutils-r1 libtool toolchain-funcs multilib-minimal
if [[ ${PV} == "9999" ]] ; then if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/glensc/file.git" EGIT_REPO_URI="https://github.com/glensc/file.git"
inherit autotools git-r3 inherit autotools git-r3
else else
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
inherit verify-sig
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz" SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi fi
DESCRIPTION="identify a file's format by scanning binary data for patterns" DESCRIPTION="Identify a file's format by scanning binary data for patterns"
HOMEPAGE="https://www.darwinsys.com/file/" HOMEPAGE="https://www.darwinsys.com/file/"
LICENSE="BSD-2" LICENSE="BSD-2"
SLOT="0" SLOT="0"
IUSE="bzip2 lzma python seccomp static-libs zlib" IUSE="bzip2 lzip lzma python seccomp static-libs zlib zstd"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND=" DEPEND="
bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] ) bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
lzip? ( app-arch/lzlib )
lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] ) lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
python? ( python? (
${PYTHON_DEPS} ${PYTHON_DEPS}
dev-python/setuptools[${PYTHON_USEDEP}] dev-python/setuptools[${PYTHON_USEDEP}]
) )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )" zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
"
RDEPEND="${DEPEND} RDEPEND="${DEPEND}
python? ( !dev-python/python-magic ) python? ( !dev-python/python-magic )
seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )" seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
BDEPEND+="
python? (
${PYTHON_DEPS}
${DISTUTILS_DEPS}
)"
PATCHES=( PATCHES=(
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978 "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
) )
src_prepare() { src_prepare() {
@ -45,24 +61,29 @@ src_prepare() {
if [[ ${PV} == 9999 ]] ; then if [[ ${PV} == 9999 ]] ; then
eautoreconf eautoreconf
else
elibtoolize
fi fi
elibtoolize # Don't let python README kill main README, bug ##60043
# don't let python README kill main README #60043
mv python/README.md python/README.python.md || die mv python/README.md python/README.python.md || die
sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
# bug #662090
sed 's@README.md@README.python.md@' -i python/setup.py || die
} }
multilib_src_configure() { multilib_src_configure() {
local myeconfargs=( local myeconfargs=(
--enable-fsect-man5 --enable-fsect-man5
$(use_enable bzip2 bzlib) $(use_enable bzip2 bzlib)
$(multilib_native_use_enable lzip lzlib)
$(use_enable lzma xzlib) $(use_enable lzma xzlib)
$(use_enable seccomp libseccomp) $(use_enable seccomp libseccomp)
$(use_enable static-libs static) $(use_enable static-libs static)
$(use_enable zlib) $(use_enable zlib)
$(use_enable zstd zstdlib)
) )
econf "${myeconfargs[@]}" econf "${myeconfargs[@]}"
} }
@ -74,13 +95,14 @@ build_src_configure() {
--disable-xzlib --disable-xzlib
--disable-zlib --disable-zlib
) )
tc-env_build econf "${myeconfargs[@]}"
econf_build "${myeconfargs[@]}"
} }
need_build_file() { need_build_file() {
# when cross-compiling, we need to build up our own file # When cross-compiling, we need to build up our own file
# because people often don't keep matching host/target # because people often don't keep matching host/target
# file versions #362941 # file versions, bug #362941
tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}" tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
} }
@ -100,18 +122,20 @@ multilib_src_compile() {
if multilib_is_native_abi ; then if multilib_is_native_abi ; then
emake emake
else else
cd src || die # bug #586444
emake magic.h #586444 emake -C src magic.h
emake libmagic.la emake -C src libmagic.la
fi fi
} }
src_compile() { src_compile() {
if need_build_file ; then if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444 # bug #586444
emake -C "${WORKDIR}"/build/src magic.h
emake -C "${WORKDIR}"/build/src file emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}" local -x PATH="${WORKDIR}/build/src:${PATH}"
fi fi
multilib-minimal_src_compile multilib-minimal_src_compile
if use python ; then if use python ; then
@ -129,7 +153,7 @@ multilib_src_install() {
} }
multilib_src_install_all() { multilib_src_install_all() {
dodoc ChangeLog MAINT README dodoc ChangeLog MAINT # README
# Required for `file -C` # Required for `file -C`
insinto /usr/share/misc/magic insinto /usr/share/misc/magic
@ -139,5 +163,6 @@ multilib_src_install_all() {
cd python || die cd python || die
distutils-r1_src_install distutils-r1_src_install
fi fi
find "${ED}" -type f -name "*.la" -delete || die find "${ED}" -type f -name "*.la" -delete || die
} }

View File

@ -1,26 +0,0 @@
From 81765a2d4fcce23f42495d5ec03bbfecb2a3c381 Mon Sep 17 00:00:00 2001
From: tka <tka@kamph.org>
Date: Wed, 24 Jun 2020 11:18:45 +0200
Subject: [PATCH] Allow getcwd for Gentoo's portage sandbox
Bug: https://bugs.gentoo.org/728978
---
src/seccomp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index db9364ae..7f5d6f26 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -229,6 +229,8 @@ enable_sandbox_full(void)
ALLOW_RULE(write);
ALLOW_RULE(writev);
+ // needed by Gentoo's portage sandbox
+ ALLOW_RULE(getcwd);
#if 0
// needed by valgrind
--
2.28.0

View File

@ -1,49 +0,0 @@
From c07e242e766242a44ff720c149b1bdd4924ec247 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 27 Apr 2021 19:37:14 +0000
Subject: [PATCH] Revert the fix for PR/180. It lead to PR/261. Using character
count heuristics ends up with confusing behavior, the following should not be
producing different results: echo -n xx | ./file - echo -n xy |
./file -
---
[patch backported to 5.40 release -- ulm]
src/encoding.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/src/encoding.c b/src/encoding.c
index 31d4d125..3647a481 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -265,9 +265,7 @@ private int \
looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
size_t *ulen) \
{ \
- size_t i, u; \
- unsigned char dist[256]; \
- memset(dist, 0, sizeof(dist)); \
+ size_t i; \
\
*ulen = 0; \
\
@@ -278,16 +276,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
return 0; \
\
ubuf[(*ulen)++] = buf[i]; \
- dist[buf[i]]++; \
} \
- u = 0; \
- for (i = 0; i < __arraycount(dist); i++) { \
- if (dist[i]) \
- u++; \
- } \
- if (u < 3) \
- return 0; \
-\
return 1; \
}
--
2.32.0

View File

@ -1,34 +0,0 @@
From abcd583135bb0762e6bfd0f2e06c50bea1fb3cd0 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 6 Apr 2021 22:02:17 +0000
Subject: [PATCH] On ARM64 Linux access() syscall is no longer a real syscall
to the kernel. Instead it's emulated by glibc with a new faccessat() syscall.
(Icenowy Zheng)
---
src/seccomp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/seccomp.c b/src/seccomp.c
index 0da907ff7..81842cf5c 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: seccomp.c,v 1.18 2021/03/14 17:01:58 christos Exp $")
+FILE_RCSID("@(#)$File: seccomp.c,v 1.19 2021/04/06 22:02:17 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@@ -171,6 +171,9 @@ enable_sandbox_full(void)
ALLOW_RULE(dup2);
ALLOW_RULE(exit);
ALLOW_RULE(exit_group);
+#ifdef __NR_faccessat
+ ALLOW_RULE(faccessat);
+#endif
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
ALLOW_RULE(fstat);

View File

@ -1,29 +0,0 @@
From e3d0265a147878b6c2903bcc83b9842dff68ceb4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 23 Apr 2021 15:00:42 -0400
Subject: [PATCH] seccomp: allow fstatat64
This is needed for the libsandbox LD_PRELOAD wrapper on Gentoo Linux.
Bug: https://bugs.gentoo.org/784857
---
src/seccomp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index 81842cf5..43abc684 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -178,6 +178,9 @@ enable_sandbox_full(void)
ALLOW_RULE(fcntl64);
ALLOW_RULE(fstat);
ALLOW_RULE(fstat64);
+#ifdef __NR_fstatat64
+ ALLOW_RULE(fstatat64);
+#endif
ALLOW_RULE(futex);
ALLOW_RULE(getdents);
#ifdef __NR_getdents64
--
2.31.1

View File

@ -1,37 +0,0 @@
From 9b0459afab309a82aa4e46f73a4e50dd641f3d39 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 19 Apr 2021 17:01:45 +0000
Subject: [PATCH] PR/257: cuihao: put attributes inside the xz magic.
---
magic/Magdir/compress | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/magic/Magdir/compress b/magic/Magdir/compress
index 64d11a736..41a65738f 100644
--- a/magic/Magdir/compress
+++ b/magic/Magdir/compress
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: compress,v 1.80 2021/03/15 17:49:24 christos Exp $
+# $File: compress,v 1.81 2021/04/19 17:01:45 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -265,14 +265,13 @@
# http://tukaani.org/xz/xz-file-format.txt
0 ustring \xFD7zXZ\x00 XZ compressed data, checksum
+!:strength * 2
+!:mime application/x-xz
>7 byte&0xf 0x0 NONE
>7 byte&0xf 0x1 CRC32
>7 byte&0xf 0x4 CRC64
>7 byte&0xf 0xa SHA-256
-!:strength * 2
-!:mime application/x-xz
-
# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
0 string LRZI LRZIP compressed data
>4 byte x - version %d

View File

@ -0,0 +1,20 @@
https://github.com/file/file/commit/4502517cc7316569d5902ab65c97b3b8e46f8a25
https://github.com/file/file/commit/8c845b7bbad085678695d3e70467b8eec3dfa7af
--- a/configure
+++ b/configure
@@ -14037,13 +14037,14 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
+#include <stdlib.h>
int
main (void)
{
#if !HAVE_DECL_DAYLIGHT
extern int daylight;
#endif
-atoi(daylight);
+daylight = atoi("1");
;
return 0;
}

View File

@ -0,0 +1,28 @@
Allow syscalls for Gentoo's portage sandbox
- Add getcwd (bug #728978)
- Add faccessat2 (bug #889046)
Bug: https://bugs.gentoo.org/728978
Bug: https://bugs.gentoo.org/889046
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -174,6 +174,9 @@ enable_sandbox_full(void)
ALLOW_RULE(exit_group);
#ifdef __NR_faccessat
ALLOW_RULE(faccessat);
+#endif
+#ifdef __NR_faccessat2
+ ALLOW_RULE(faccessat2);
#endif
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
@@ -237,6 +240,8 @@ enable_sandbox_full(void)
ALLOW_RULE(write);
ALLOW_RULE(writev);
+ // needed by Gentoo's portage sandbox
+ ALLOW_RULE(getcwd);
#if 0
// needed by valgrind

View File

@ -10,22 +10,13 @@ sys/stat.h in musl does this:
Counteract this with an #undef. Counteract this with an #undef.
Bug: https://bugs.gentoo.org/789336 Bug: https://bugs.gentoo.org/789336
---
src/seccomp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index 3318367c..eb8b1e57 100644
--- a/src/seccomp.c --- a/src/seccomp.c
+++ b/src/seccomp.c +++ b/src/seccomp.c
@@ -179,6 +179,7 @@ enable_sandbox_full(void) @@ -182,6 +182,7 @@ enable_sandbox_full(void)
ALLOW_RULE(fstat); #endif
ALLOW_RULE(fstat64); ALLOW_RULE(fstat64);
#ifdef __NR_fstatat64 #ifdef __NR_fstatat64
+#undef fstatat64 +#undef fstatat64
ALLOW_RULE(fstatat64); ALLOW_RULE(fstatat64);
#endif #endif
ALLOW_RULE(futex); ALLOW_RULE(futex);
--
2.32.0

View File

@ -0,0 +1,19 @@
softmagic: include limits.h for UINT_MAX usage
Platforms like Solaris need this to compile.
Bug: https://bugs.astron.com/view.php?id=413
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -42,6 +42,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
+#include <limits.h>
#include "der.h"
file_private int match(struct magic_set *, struct magic *, file_regex_t **, size_t,

View File

@ -0,0 +1,18 @@
https://github.com/file/file/commit/1590a653b520123d47070a47436abfba42d4c943
From 1590a653b520123d47070a47436abfba42d4c943 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 26 Dec 2022 18:57:29 +0000
Subject: [PATCH] PR/408: SpraxDev: Add utimes to the allow list for -p
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -233,6 +233,7 @@ enable_sandbox_full(void)
ALLOW_RULE(umask); // Used in file_pipe2file()
ALLOW_RULE(getpid); // Used by glibc in file_pipe2file()
ALLOW_RULE(unlink);
+ ALLOW_RULE(utimes);
ALLOW_RULE(write);
ALLOW_RULE(writev);

View File

@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<maintainer type="project"> <maintainer type="project">
<email>base-system@gentoo.org</email> <email>base-system@gentoo.org</email>
<name>Gentoo Base System</name> <name>Gentoo Base System</name>
</maintainer> </maintainer>
<upstream> <upstream>
<bugs-to>https://bugs.astron.com/</bugs-to> <bugs-to>https://bugs.astron.com/</bugs-to>
<remote-id type="cpe">cpe:/a:file_project:file</remote-id> <remote-id type="cpe">cpe:/a:file_project:file</remote-id>
</upstream> <remote-id type="github">file/file</remote-id>
</upstream>
<use>
<flag name="lzip">Enable <pkg>app-arch/lzip</pkg> decompression support via <pkg>app-arch/lzlib</pkg></flag>
</use>
</pkgmetadata> </pkgmetadata>