public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/
Date: Mon, 13 May 2013 15:27:41 +0000 (UTC)	[thread overview]
Message-ID: <1368406047.a2ad553d45b7489976104d3bfc664e00138ceeae.vapier@gentoo> (raw)

commit:     a2ad553d45b7489976104d3bfc664e00138ceeae
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 19:31:48 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon May 13 00:47:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a2ad553d

env-update: change prelink to use /etc/prelink.conf.d/portage.conf

Newer prelinks can support /etc/prelink.conf.d/ files.  So that prelink
can install /etc/prelink.conf and manage it itself, have env-update only
write /etc/prelink.conf.d/portage.conf instead of clobbering the main
/etc/prelink.conf file.

This should be backwards compatible as portage will conditionally change
/etc/prelink.conf to use the new /etc/prelink.conf.d/ too.

URL: http://bugs.gentoo.org/266855
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 pym/portage/util/env_update.py |   61 +++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 4c1fbf8..cf95467 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -194,20 +194,35 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			myfd.write(x + "\n")
 		myfd.close()
 
+	potential_lib_dirs = set()
+	for lib_dir_glob in ('usr/lib*', 'lib*'):
+		x = os.path.join(eroot, lib_dir_glob)
+		for y in glob.glob(_unicode_encode(x,
+			encoding=_encodings['fs'], errors='strict')):
+			try:
+				y = _unicode_decode(y,
+					encoding=_encodings['fs'], errors='strict')
+			except UnicodeDecodeError:
+				continue
+			if os.path.basename(y) != 'libexec':
+				potential_lib_dirs.add(y[len(eroot):])
+
 	# Update prelink.conf if we are prelink-enabled
 	if prelink_capable:
-		newprelink = atomic_ofstream(os.path.join(
-			eroot, "etc", "prelink.conf"))
+		prelink_d = os.path.join(eroot, 'etc', 'prelink.conf.d')
+		if not os.path.isdir(prelink_d):
+			os.makedirs(prelink_d)
+		newprelink = atomic_ofstream(os.path.join(prelink_d, 'portage.conf'))
 		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
 		newprelink.write("# contents of /etc/env.d directory\n")
 
-		for x in ["/bin","/sbin","/usr/bin","/usr/sbin","/lib","/usr/lib"]:
-			newprelink.write("-l %s\n" % (x,));
-		prelink_paths = []
-		prelink_paths += specials.get("LDPATH", [])
-		prelink_paths += specials.get("PATH", [])
-		prelink_paths += specials.get("PRELINK_PATH", [])
-		prelink_path_mask = specials.get("PRELINK_PATH_MASK", [])
+		for x in sorted(potential_lib_dirs) + ['bin', 'sbin']:
+			newprelink.write('-l /%s\n' % (x,));
+		prelink_paths = set()
+		prelink_paths |= set(specials.get('LDPATH', []))
+		prelink_paths |= set(specials.get('PATH', []))
+		prelink_paths |= set(specials.get('PRELINK_PATH', []))
+		prelink_path_mask = specials.get('PRELINK_PATH_MASK', [])
 		for x in prelink_paths:
 			if not x:
 				continue
@@ -228,24 +243,24 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			newprelink.write("-b %s\n" % (x,))
 		newprelink.close()
 
+		# Migration code path.  If /etc/prelink.conf was generated by us, then
+		# point it to the new stuff until the prelink package re-installs.
+		prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf')
+		try:
+			with open(prelink_conf, 'rb') as f:
+				if f.readline() == b'# prelink.conf autogenerated by env-update; make all changes to\n':
+					f = atomic_ofstream(prelink_conf)
+					f.write('-c /etc/prelink.conf.d/*.conf\n')
+					f.close()
+		except IOError as e:
+			if e.errno != errno.ENOENT:
+				raise
+
 	current_time = long(time.time())
 	mtime_changed = False
 
-	potential_lib_dirs = []
-	for lib_dir_glob in ['usr/lib*', 'lib*']:
-		x = os.path.join(eroot, lib_dir_glob)
-		for y in glob.glob(_unicode_encode(x,
-			encoding=_encodings['fs'], errors='strict')):
-			try:
-				y = _unicode_decode(y,
-					encoding=_encodings['fs'], errors='strict')
-			except UnicodeDecodeError:
-				continue
-			if os.path.basename(y) != "libexec":
-				potential_lib_dirs.append(y[len(eroot):])
-
 	lib_dirs = set()
-	for lib_dir in set(specials["LDPATH"] + potential_lib_dirs):
+	for lib_dir in set(specials['LDPATH']) | potential_lib_dirs:
 		x = os.path.join(eroot, lib_dir.lstrip(os.sep))
 		try:
 			newldpathtime = os.stat(x)[stat.ST_MTIME]


             reply	other threads:[~2013-05-13 15:27 UTC|newest]

Thread overview: 134+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 15:27 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-02 17:11 [gentoo-commits] proj/portage:master commit in: pym/portage/util/ Zac Medico
2018-03-28  6:52 Zac Medico
2018-03-04  2:38 Zac Medico
2017-08-21 16:50 Zac Medico
2017-08-21 15:59 Zac Medico
2017-02-23 16:33 Zac Medico
2017-02-21 17:44 Zac Medico
2017-01-22 18:46 Zac Medico
2017-01-07 23:07 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-14 23:14 Brian Dolbec
2015-11-22 20:53 Zac Medico
2015-11-21 18:12 Zac Medico
2015-11-16  1:29 Zac Medico
2015-11-15 22:54 Michał Górny
2015-10-06 20:24 Zac Medico
2015-06-05  1:59 Zac Medico
2015-05-04  6:43 Zac Medico
2015-04-11 16:02 Zac Medico
2015-01-22 17:09 Brian Dolbec
2015-01-22 17:09 Brian Dolbec
2015-01-18 18:04 Michał Górny
2014-12-02 19:07 Brian Dolbec
2014-04-04 23:01 Brian Dolbec
2014-02-05 19:42 Sebastian Luther
2013-10-16 23:25 Brian Dolbec
2013-10-16 20:47 Mike Frysinger
2013-10-15 21:56 Mike Frysinger
2013-09-16 16:51 Arfrever Frehtes Taifersar Arahesis
2013-09-15  9:36 Zac Medico
2013-09-15  0:51 Zac Medico
2013-09-11 14:07 Zac Medico
2013-09-03 20:03 Zac Medico
2013-08-27 19:32 Zac Medico
2013-08-13 18:17 Zac Medico
2013-08-13 15:46 Zac Medico
2013-08-12  3:01 Zac Medico
2013-08-03  9:39 Zac Medico
2013-08-02 23:03 Zac Medico
2013-08-02 18:06 Zac Medico
2013-07-02 17:15 Zac Medico
2013-06-28  1:46 Zac Medico
2013-06-27 21:32 Zac Medico
2013-06-24  4:29 Zac Medico
2013-06-24  2:27 Zac Medico
2013-05-14  0:30 Zac Medico
2013-04-16 14:01 Zac Medico
2013-03-27 15:02 Zac Medico
2013-03-19  8:00 Zac Medico
2013-03-19  6:38 Zac Medico
2013-03-19  6:22 Zac Medico
2013-03-19  5:56 Zac Medico
2013-01-10 14:47 Zac Medico
2012-12-28 22:31 Zac Medico
2012-11-30  2:10 Arfrever Frehtes Taifersar Arahesis
2012-11-29 20:32 Arfrever Frehtes Taifersar Arahesis
2012-11-15  3:41 Zac Medico
2012-10-28 19:26 Zac Medico
2012-10-25  8:35 Zac Medico
2012-09-24  3:01 Zac Medico
2012-09-24  2:25 Zac Medico
2012-09-13 18:40 Zac Medico
2012-09-03 19:51 Zac Medico
2012-09-02 19:33 Zac Medico
2012-09-02 19:31 Zac Medico
2012-08-26 21:46 Zac Medico
2012-08-04 19:27 Zac Medico
2012-08-02 19:55 Zac Medico
2012-08-02  2:28 Zac Medico
2012-08-02  2:26 Zac Medico
2012-08-02  2:22 Zac Medico
2012-08-02  0:57 Zac Medico
2012-06-17 15:22 Zac Medico
2012-06-01 21:30 Zac Medico
2012-05-17 20:21 Zac Medico
2012-05-16 23:58 Zac Medico
2012-05-16  0:07 Zac Medico
2012-05-01 21:21 Zac Medico
2012-03-31 23:19 Zac Medico
2012-03-31 21:17 Zac Medico
2012-03-31 20:27 Zac Medico
2012-03-31 19:48 Zac Medico
2012-03-28  1:50 Zac Medico
2012-03-27 16:31 Zac Medico
2012-03-27 15:42 Zac Medico
2012-03-23 19:58 Zac Medico
2012-03-23 18:22 Zac Medico
2012-03-23 18:20 Zac Medico
2012-03-23 18:05 Zac Medico
2012-03-22 21:37 Zac Medico
2012-03-05  9:55 Zac Medico
2012-02-18  3:40 Zac Medico
2012-02-18  3:11 Zac Medico
2012-02-18  2:41 Zac Medico
2012-01-12  1:35 Zac Medico
2012-01-10  0:37 Zac Medico
2012-01-03 21:59 Zac Medico
2012-01-03 21:36 Zac Medico
2011-12-22 21:36 Zac Medico
2011-12-10 19:41 Zac Medico
2011-12-10  5:28 Arfrever Frehtes Taifersar Arahesis
2011-12-10  0:03 Arfrever Frehtes Taifersar Arahesis
2011-12-09 23:53 Arfrever Frehtes Taifersar Arahesis
2011-11-29  4:52 Zac Medico
2011-11-29  4:26 Zac Medico
2011-11-29  3:09 Zac Medico
2011-11-29  3:00 Zac Medico
2011-11-29  1:26 Arfrever Frehtes Taifersar Arahesis
2011-10-30  0:25 Zac Medico
2011-10-08 15:15 Zac Medico
2011-10-05  0:59 Zac Medico
2011-10-04 16:40 Zac Medico
2011-10-02  5:42 Zac Medico
2011-09-18 23:45 Zac Medico
2011-09-18 22:47 Zac Medico
2011-09-14 20:42 Arfrever Frehtes Taifersar Arahesis
2011-08-30 19:41 Zac Medico
2011-08-30 19:40 Zac Medico
2011-08-29 15:58 Zac Medico
2011-08-29  7:40 Zac Medico
2011-06-30 12:49 Zac Medico
2011-06-30  1:52 Zac Medico
2011-06-28 14:16 Arfrever Frehtes Taifersar Arahesis
2011-06-09 13:01 Arfrever Frehtes Taifersar Arahesis
2011-05-25  4:56 Zac Medico
2011-05-25  4:53 Zac Medico
2011-05-18  1:43 Zac Medico
2011-05-15  4:40 Zac Medico
2011-03-25 17:11 Zac Medico
2011-03-02 17:59 Zac Medico
2011-03-02 17:40 Zac Medico

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=1368406047.a2ad553d45b7489976104d3bfc664e00138ceeae.vapier@gentoo \
    --to=vapier@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