Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] env-update: change prelink to use /etc/prelink.conf.d/portage.conf
Date: Sat, 11 May 2013 22:45:59
Message-Id: CAMiTYSqFB6QqppycnJOkLzKZ3NoD1gh3bWTntowT8BTa0tYB1w@mail.gmail.com
In Reply to: [gentoo-portage-dev] [PATCH] env-update: change prelink to use /etc/prelink.conf.d/portage.conf by Mike Frysinger
1 On Sat, May 11, 2013 at 12:45 PM, Mike Frysinger <vapier@g.o> wrote:
2 > + # Migration code path. If /etc/prelink.conf was generated by us, then
3 > + # point it to the new stuff until the prelink package re-installs.
4 > + prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf')
5 > + if os.path.exists(prelink_conf):
6 > + if open(prelink_conf).readline() == '# prelink.conf autogenerated by env-update; make all changes to\n':
7
8 I would do it like this:
9
10 with open(prelink_conf, 'rb') as f:
11 if f.readline() == b'# prelink.conf autogenerated by
12 env-update; make all changes to\n':
13
14 The "with" block prevents resource warning messages with python3, and
15 using binary mode side-steps potential unicode decode errors.
16
17 Other than that, the patch looks good to me.

Replies