From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/ccache/, dev-util/ccache/files/
Date: Fri, 18 Jun 2021 10:15:12 +0000 (UTC) [thread overview]
Message-ID: <1624011306.8e1ed9330e1ac2cbf65e01bad5b97910daf0397d.slyfox@gentoo> (raw)
commit: 8e1ed9330e1ac2cbf65e01bad5b97910daf0397d
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 18 10:12:52 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Jun 18 10:15:06 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e1ed933
dev-util/ccache: backport PWD=. handling
Reported-by: 12101111
Closes: https://bugs.gentoo.org/751355
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
dev-util/ccache/ccache-4.3-r2.ebuild | 90 ++++++++++++++++++++++++++++++
dev-util/ccache/files/ccache-4.3-PWD.patch | 85 ++++++++++++++++++++++++++++
2 files changed, 175 insertions(+)
diff --git a/dev-util/ccache/ccache-4.3-r2.ebuild b/dev-util/ccache/ccache-4.3-r2.ebuild
new file mode 100644
index 00000000000..987b811477e
--- /dev/null
+++ b/dev-util/ccache/ccache-4.3-r2.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake toolchain-funcs
+
+DESCRIPTION="fast compiler cache"
+HOMEPAGE="https://ccache.dev/"
+SRC_URI="https://github.com/ccache/ccache/releases/download/v${PV}/ccache-${PV}.tar.xz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="static-c++ test"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+ app-arch/zstd:0=
+ dev-util/shadowman
+ sys-apps/gentoo-functions
+"
+# clang-specific tests use dev-libs/elfutils to compare objects for equality.
+# Let's pull in the dependency unconditionally.
+DEPEND+="
+ test? ( dev-libs/elfutils )
+"
+BDEPEND="
+ app-text/asciidoc
+"
+
+RESTRICT="!test? ( test )"
+
+DOCS=( doc/{AUTHORS,MANUAL,NEWS}.adoc CONTRIBUTING.md README.md )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.5-nvcc-test.patch
+ "${FILESDIR}"/${PN}-4.0-objdump.patch
+ "${FILESDIR}"/${PN}-4.1-avoid-run-user.patch
+ "${FILESDIR}"/${P}-PWD.patch
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed \
+ -e "/^EPREFIX=/s:'':'${EPREFIX}':" \
+ "${FILESDIR}"/ccache-config-3 > ccache-config || die
+
+ # mainly used in tests
+ tc-export CC OBJDUMP
+
+ # Avoid dependency on libstdc++.so. Useful for cases when
+ # we would like to use ccache to build older gcc which injects
+ # into ccache locally built (possibly outdated) libstdc++
+ # See bug #761220 for examples.
+ #
+ # Ideally gcc should not use LD_PRELOAD to avoid this type of failures.
+ use static-c++ && append-ldflags -static-libstdc++
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DUSE_CCACHE=OFF
+ -DUSE_FASTER_LINKER=OFF
+ -DZSTD_FROM_INTERNET=OFF
+ )
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ dobin ccache-config
+ insinto /usr/share/shadowman/tools
+ newins - ccache <<<"${EPREFIX}/usr/lib/ccache/bin"
+}
+
+pkg_prerm() {
+ if [[ -z ${REPLACED_BY_VERSION} && ${ROOT:-/} == / ]] ; then
+ eselect compiler-shadow remove ccache
+ fi
+}
+
+pkg_postinst() {
+ if [[ ${ROOT:-/} == / ]]; then
+ eselect compiler-shadow update ccache
+ fi
+}
diff --git a/dev-util/ccache/files/ccache-4.3-PWD.patch b/dev-util/ccache/files/ccache-4.3-PWD.patch
new file mode 100644
index 00000000000..3943dab5bd2
--- /dev/null
+++ b/dev-util/ccache/files/ccache-4.3-PWD.patch
@@ -0,0 +1,85 @@
+https://github.com/ccache/ccache/commit/2d720aed1843b47aafb2af8bfd15139228545e2b.patch
+https://bugs.gentoo.org/751355
+
+From 2d720aed1843b47aafb2af8bfd15139228545e2b Mon Sep 17 00:00:00 2001
+From: Joel Rosdahl <joel@rosdahl.net>
+Date: Wed, 16 Jun 2021 18:19:04 +0200
+Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20crash=20on=20relative=20PWD=20v?=
+ =?UTF-8?q?alue?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Even though PWD “shall represent an absolute pathname of the current
+working directory”[1], we shouldn’t crash if a user sets it to a
+relative path.
+
+[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
+
+Fixes #860.
+---
+ src/Util.cpp | 2 +-
+ test/run | 1 +
+ test/suites/basedir.bash | 32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 1 deletion(-)
+
+--- a/src/Util.cpp
++++ b/src/Util.cpp
+@@ -617,7 +617,7 @@ get_apparent_cwd(const std::string& actual_cwd)
+ return actual_cwd;
+ #else
+ auto pwd = getenv("PWD");
+- if (!pwd) {
++ if (!pwd || !Util::is_absolute_path(pwd)) {
+ return actual_cwd;
+ }
+
+--- a/test/run
++++ b/test/run
+@@ -356,6 +356,7 @@ reset_environment() {
+ unset TERM
+ unset XDG_CACHE_HOME
+ unset XDG_CONFIG_HOME
++ export PWD=$(pwd)
+
+ export CCACHE_DETECT_SHEBANG=1
+ export CCACHE_DIR=$ABS_TESTDIR/.ccache
+--- a/test/suites/basedir.bash
++++ b/test/suites/basedir.bash
+@@ -311,4 +311,36 @@ EOF
+ expect_stat 'cache miss' 1
+ expect_equal_content reference.stderr ccache.stderr
+ fi
++
++ # -------------------------------------------------------------------------
++ TEST "Relative PWD"
++
++ cd dir1
++ CCACHE_BASEDIR="$(pwd)" PWD=. $CCACHE_COMPILE -I$(pwd)/include -c src/test.c
++ expect_stat 'cache hit (direct)' 0
++ expect_stat 'cache hit (preprocessed)' 0
++ expect_stat 'cache miss' 1
++
++ cd ../dir2
++ CCACHE_BASEDIR="$(pwd)" PWD=. $CCACHE_COMPILE -I$(pwd)/include -c src/test.c
++ expect_stat 'cache hit (direct)' 1
++ expect_stat 'cache hit (preprocessed)' 0
++ expect_stat 'cache miss' 1
++
++ # -------------------------------------------------------------------------
++ TEST "Unset PWD"
++
++ unset PWD
++
++ cd dir1
++ CCACHE_BASEDIR="$(pwd)" $CCACHE_COMPILE -I$(pwd)/include -c src/test.c
++ expect_stat 'cache hit (direct)' 0
++ expect_stat 'cache hit (preprocessed)' 0
++ expect_stat 'cache miss' 1
++
++ cd ../dir2
++ CCACHE_BASEDIR="$(pwd)" $CCACHE_COMPILE -I$(pwd)/include -c src/test.c
++ expect_stat 'cache hit (direct)' 1
++ expect_stat 'cache hit (preprocessed)' 0
++ expect_stat 'cache miss' 1
+ }
next reply other threads:[~2021-06-18 10:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 10:15 Sergei Trofimovich [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-08-10 20:02 [gentoo-commits] repo/gentoo:master commit in: dev-util/ccache/, dev-util/ccache/files/ Sam James
2024-05-31 18:46 Sam James
2024-03-24 18:02 Sam James
2024-02-07 19:20 Sam James
2023-05-20 4:39 Sam James
2023-05-17 4:01 Sam James
2022-09-23 1:56 Sam James
2022-08-22 21:08 Sam James
2022-05-20 19:26 Matt Turner
2022-04-09 11:26 Sam James
2022-04-09 4:30 Sam James
2020-11-18 19:07 Sergei Trofimovich
2020-10-19 18:49 Sergei Trofimovich
2019-02-02 23:40 Sergei Trofimovich
2019-01-04 21:13 Sergei Trofimovich
2018-10-15 21:13 Sergei Trofimovich
2018-08-15 8:39 Sergei Trofimovich
2016-05-27 20:40 Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1624011306.8e1ed9330e1ac2cbf65e01bad5b97910daf0397d.slyfox@gentoo \
--to=slyfox@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox