public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/
@ 2021-09-10  7:16 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2021-09-10  7:16 UTC (permalink / raw
  To: gentoo-commits

commit:     230c312676ea79c7fa4c9fa983c80d2443455dd4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  3 12:09:42 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep 10 07:16:38 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=230c3126

Remove deprecated dbkey support from doebuild/ebuild.sh

Remove the support for the dbkey logic that used to write metadata into
a file.  This logic has stopped being used and became deprecated
in 2013.  If any external tool is still using it, it's probably been
broken by changes in metadata itself since, and would definitely
be broken by the incoming change in metadata format.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/ebuild.sh                          | 23 ++++-------------------
 lib/portage/package/ebuild/doebuild.py | 22 +++-------------------
 2 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 3042e6c8c..32995d95b 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -754,14 +754,6 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 	export SANDBOX_ON="0"
 	set -f
 
-	if [ -n "${dbkey}" ] ; then
-		if [ ! -d "${dbkey%/*}" ]; then
-			install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
-		fi
-		# Make it group writable. 666&~002==664
-		umask 002
-	fi
-
 	auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
 		DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND BDEPEND
 		EAPI PROPERTIES DEFINED_PHASES IDEPEND UNUSED_04
@@ -775,17 +767,10 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 	fi
 
 	# The extra $(echo) commands remove newlines.
-	if [ -n "${dbkey}" ] ; then
-		> "${dbkey}"
-		for f in ${auxdbkeys} ; do
-			echo $(echo ${!f}) >> "${dbkey}" || exit $?
-		done
-	else
-		for f in ${auxdbkeys} ; do
-			eval "echo \$(echo \${!f}) 1>&${PORTAGE_PIPE_FD}" || exit $?
-		done
-		eval "exec ${PORTAGE_PIPE_FD}>&-"
-	fi
+	for f in ${auxdbkeys} ; do
+		eval "echo \$(echo \${!f}) 1>&${PORTAGE_PIPE_FD}" || exit $?
+	done
+	eval "exec ${PORTAGE_PIPE_FD}>&-"
 	set +f
 else
 	# Note: readonly variables interfere with __preprocess_ebuild_env(), so

diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 3da239be2..3bcfd3a5d 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -568,7 +568,7 @@ _doebuild_commands_without_builddir = (
 )
 
 def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, listonly=0,
-	fetchonly=0, cleanup=0, dbkey=DeprecationWarning, use_cache=1, fetchall=0, tree=None,
+	fetchonly=0, cleanup=0, use_cache=1, fetchall=0, tree=None,
 	mydbapi=None, vartree=None, prev_mtimes=None,
 	fd_pipes=None, returnpid=False):
 	"""
@@ -591,9 +591,6 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0,
 	@type fetchonly: Boolean
 	@param cleanup: Passed to prepare_build_dirs (TODO: what does it do?)
 	@type cleanup: Boolean
-	@param dbkey: A file path where metadata generated by the 'depend' phase
-		will be written.
-	@type dbkey: String
 	@param use_cache: Enables the cache
 	@type use_cache: Boolean
 	@param fetchall: Used to wrap fetch(), fetches all URIs (even ones invalid due to USE conditionals)
@@ -637,11 +634,6 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0,
 			"settings['EROOT'] is used.",
 			DeprecationWarning, stacklevel=2)
 
-	if dbkey is not DeprecationWarning:
-		warnings.warn("portage.doebuild() called "
-			"with deprecated dbkey argument.",
-			DeprecationWarning, stacklevel=2)
-
 	if not tree:
 		writemsg("Warning: tree not specified to doebuild\n")
 		tree = "porttree"
@@ -836,16 +828,8 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0,
 
 		# get possible slot information from the deps file
 		if mydo == "depend":
-			writemsg("!!! DEBUG: dbkey: %s\n" % str(dbkey), 2)
-			if returnpid:
-				return _spawn_phase(mydo, mysettings,
-					fd_pipes=fd_pipes, returnpid=returnpid)
-			if dbkey and dbkey is not DeprecationWarning:
-				mysettings["dbkey"] = dbkey
-			else:
-				mysettings["dbkey"] = \
-					os.path.join(mysettings.depcachedir, "aux_db_key_temp")
-
+			if not returnpid:
+				raise TypeError("returnpid must be True for depend phase")
 			return _spawn_phase(mydo, mysettings,
 				fd_pipes=fd_pipes, returnpid=returnpid)
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/
@ 2021-09-27  6:55 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2021-09-27  6:55 UTC (permalink / raw
  To: gentoo-commits

commit:     2fa008aae8571d525af1f5ca7cf4cce90d835826
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 26 07:07:32 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Sep 26 10:19:39 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2fa008aa

Copy files/* into the work tree instead of symlinking it

Symlinking FILESDIR into the work tree has the unintended consequence
of preserving all original file metadata, including system-specific ACLs
and so on.  When these files are installed, this could lead to
unintentionally copying this metadata to the system and/or binary
packages.

Let's copy all files instead and drop metadata in the process.  Since
FILESDIR is expected to be small by design, this shouldn't cause any
major trouble.  It is also easier and less likely to cause regressions
than making sure stuff is not preserved when installing.

Unfortunately, a similar problem applies to DISTDIR.  However,
installing files from DISTDIR is rarer than from FILESDIR, so I guess
we'll cross that bridge when we get to it.

Bug: https://bugs.gentoo.org/814857
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/phase-functions.sh                           |  2 +-
 lib/portage/package/ebuild/prepare_build_dirs.py | 19 +++++++++----------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d3221993d..9a4c97b16 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -296,7 +296,7 @@ __dyn_clean() {
 
 		rm -rf "${PORTAGE_BUILDDIR}/build-info"
 		rm -rf "${WORKDIR}"
-		rm -f "${PORTAGE_BUILDDIR}/files"
+		rm -rf "${PORTAGE_BUILDDIR}/files"
 	fi
 
 	if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then

diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py
index 659198905..2e2ef73f4 100644
--- a/lib/portage/package/ebuild/prepare_build_dirs.py
+++ b/lib/portage/package/ebuild/prepare_build_dirs.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2020 Gentoo Authors
+# Copyright 2010-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ["prepare_build_dirs"]
@@ -27,6 +27,7 @@ from portage.util import (
     normalize_path,
     writemsg,
 )
+from portage.util.file_copy import copyfile
 from portage.util.install_mask import _raise_exc
 
 
@@ -478,16 +479,14 @@ def _ensure_log_subdirs(logdir, subdir):
 
 def _prepare_fake_filesdir(settings):
     real_filesdir = settings["O"] + "/files"
-    symlink_path = settings["FILESDIR"]
+    filesdir = settings["FILESDIR"]
+    portage.util.ensure_dirs(filesdir, mode=0o755)
 
-    try:
-        link_target = os.readlink(symlink_path)
-    except OSError:
-        os.symlink(real_filesdir, symlink_path)
-    else:
-        if link_target != real_filesdir:
-            os.unlink(symlink_path)
-            os.symlink(real_filesdir, symlink_path)
+    # Copy files from real directory to ebuild directory (without metadata).
+    if os.path.isdir(real_filesdir):
+        shutil.copytree(
+            real_filesdir, filesdir, copy_function=copyfile, dirs_exist_ok=True
+        )
 
 
 def _prepare_fake_distdir(settings, alist):


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/
@ 2021-10-05  6:52 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2021-10-05  6:52 UTC (permalink / raw
  To: gentoo-commits

commit:     c2da00e04086fa8eefc981e97ae3559d42c4937d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  5 06:51:11 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Oct  5 06:52:29 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2da00e0

Revert "Copy files/* into the work tree instead of symlinking it"

Revert the series of FILESDIR changes that keep causing new regressions.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/phase-functions.sh                           |  2 +-
 lib/portage/package/ebuild/prepare_build_dirs.py | 35 ++++++++----------------
 2 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 9a4c97b16..d3221993d 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -296,7 +296,7 @@ __dyn_clean() {
 
 		rm -rf "${PORTAGE_BUILDDIR}/build-info"
 		rm -rf "${WORKDIR}"
-		rm -rf "${PORTAGE_BUILDDIR}/files"
+		rm -f "${PORTAGE_BUILDDIR}/files"
 	fi
 
 	if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then

diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py
index 410c7e4ae..659198905 100644
--- a/lib/portage/package/ebuild/prepare_build_dirs.py
+++ b/lib/portage/package/ebuild/prepare_build_dirs.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2021 Gentoo Authors
+# Copyright 2010-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ["prepare_build_dirs"]
@@ -27,7 +27,6 @@ from portage.util import (
     normalize_path,
     writemsg,
 )
-from portage.util.file_copy import copyfile
 from portage.util.install_mask import _raise_exc
 
 
@@ -477,30 +476,18 @@ def _ensure_log_subdirs(logdir, subdir):
         ensure_dirs(current, uid=uid, gid=gid, mode=grp_mode, mask=0)
 
 
-def _copytree(src, dst, **kwargs):
-    try:
-        shutil.copytree(src, dst, **kwargs)
-    except FileExistsError:
-        shutil.rmtree(dst)
-        shutil.copytree(src, dst, **kwargs)
-
-
 def _prepare_fake_filesdir(settings):
     real_filesdir = settings["O"] + "/files"
-    filesdir = settings["FILESDIR"]
-
-    # Copy files from real directory to ebuild directory (without metadata).
-    if os.path.isdir(real_filesdir):
-        _copytree(real_filesdir, filesdir, copy_function=copyfile)
-        apply_recursive_permissions(
-            filesdir,
-            uid=portage_uid,
-            gid=portage_gid,
-            dirmode=0o750,
-            dirmask=0,
-            filemode=0o640,
-            filemask=0,
-        )
+    symlink_path = settings["FILESDIR"]
+
+    try:
+        link_target = os.readlink(symlink_path)
+    except OSError:
+        os.symlink(real_filesdir, symlink_path)
+    else:
+        if link_target != real_filesdir:
+            os.unlink(symlink_path)
+            os.symlink(real_filesdir, symlink_path)
 
 
 def _prepare_fake_distdir(settings, alist):


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-05  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-10  7:16 [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-09-27  6:55 Michał Górny
2021-10-05  6:52 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox