[gentoo-portage-dev] layout.conf: What's our opinion?
Hi all, ${repository}/metadata/layout.conf is a file that allows a repository maintainer to adjust the package manager's behavior for a repository. I guess the best known is the 'masters' key, but there are lots of other things by now (see man portage). Currently layout.conf is not under PMS control. This basically means that every PM (or version thereof) may support different keys and assign different meanings to them. Portage's behavior for unknown keys in layout.conf is to ignore them without a warning. The bad thing about this is that some layout.conf keys portage currently supports, may render the repository unusable for a PM if it doesn't support them. To avoid this type of breakage in other areas (ebuilds, dependency resolution, ...) PMS has been created. Since the council demands PMS to be followed, I would expect that they also want the general idea of not breaking things randomly to be followed. This brings us to reason that made me write that mail. Some days ago Arfrever committed some additions to layout.conf [1], for which he apparently had the ack from Zac from some months ago [2]. After discussing this one IRC I came to the conclusion that we just disagree on how we should handle additions to layout.conf. Basically it's either 1) We add things as we see fit. or 2) We should only add things if absolutely necessary.. I obviously would prefer 2) to follow the things shouldn't break randomly route. So what's your opinion? Should we go for 1) or 2) or something else? - Sebastian [1] http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4c409a049c394389b1de398db511380e2fed0437 [2] http://dpaste.com/1560782/
Re: [gentoo-portage-dev] layout.conf: What's our opinion?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 20/01/14 12:05, Sebastian Luther wrote: Basically it's either 1) We add things as we see fit. or 2) We should only add things if absolutely necessary.. So what's your opinion? Should we go for 1) or 2) or something else? 2. - -- Alexander alexan...@plaimi.net http://plaimi.net/~alexander -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlLdC/AACgkQRtClrXBQc7WW4gEAs2HSB9Mr8F9/seATNJYINUqL ErunU9OjH2Ni/kLWpCsBAI+WvhZ7bPUoL2tIq6D3/xQdyE7dHYE6N+i+7AaDBnaL =hzE4 -END PGP SIGNATURE-
[gentoo-portage-dev] [PATCH v4] Test for read-only filesystems, bail out during preinst if there are any which will be written to and display a useful error message. Fixes bug 378869.
v2: Reformat, add a function to return an appropriate read-only checker for the operating system, so that this can be extended to other OSes. v3: minor formatting tweaks from bernalex, including use os.path.join() instead of string concatenation v4: Update copyright header, change the code in rochecker to open with io.open in order to not break on non-ascii characters as reported by Arfrever. Change get_ro_checker to use a dict as suggested by vapier. --- pym/portage/dbapi/vartree.py | 34 - pym/portage/util/rochecker.py | 87 +++ 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 pym/portage/util/rochecker.py diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ed62323..22cf222 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1,4 +1,4 @@ -# Copyright 1998-2013 Gentoo Foundation +# Copyright 1998-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -32,6 +32,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.util.env_update:env_update', 'portage.util.listdir:dircache,listdir', 'portage.util.movefile:movefile', + 'portage.util.rochecker:get_ro_checker', 'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry', 'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap', 'portage.util._async.SchedulerInterface:SchedulerInterface', @@ -3508,6 +3509,8 @@ class dblink(object): This function does the following: + calls get_ro_checker to retrieve a function for checking whether Portage + will write to a read-only filesystem, then runs it against the directory list calls self._preserve_libs if FEATURES=preserve-libs calls self._collision_protect if FEATURES=collision-protect calls doebuild(mydo=pkg_preinst) @@ -3685,6 +3688,7 @@ class dblink(object): eagain_error = False myfilelist = [] + mydirlist = [] mylinklist = [] paths_with_newlines = [] def onerror(e): @@ -3717,6 +3721,9 @@ class dblink(object): unicode_errors.append(new_parent[ed_len:]) break + relative_path = parent[srcroot_len:] + mydirlist.append(os.path.join(/, relative_path)) + for fname in files: try: fname = _unicode_decode(fname, @@ -3829,6 +3836,31 @@ class dblink(object): for other in others_in_slot]) prepare_build_dirs(settings=self.settings, cleanup=cleanup) + # Check for read-only filesystems + ro_checker = get_ro_checker() + rofilesystems = ro_checker(mydirlist) + + if rofilesystems: + msg = _(One or more files installed to this package are + set to be installed to read-only filesystems. + Please mount the following filesystems as read-write + and retry.) + msg = textwrap.wrap(msg, 70) + msg.append() + for f in rofilesystems: + msg.append(\t%s % os.path.join(destroot, + f.lstrip(os.path.sep))) + msg.append() + self._elog(eerror, preinst, msg) + + msg = _(Package '%s' NOT merged due to read-only file systems.) % \ + self.settings.mycpv + msg += _( If necessary, refer to your elog + messages for the whole content of the above message.) + msg = textwrap.wrap(msg, 70) + eerror(msg) + return 1 + # check for package collisions blockers = self._blockers if blockers is None: diff --git a/pym/portage/util/rochecker.py b/pym/portage/util/rochecker.py new file mode 100644 index 000..2bbfe9d --- /dev/null +++ b/pym/portage/util/rochecker.py @@ -0,0 +1,87 @@ +#-*- coding:utf-8 -*- +# Copyright 2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +Methods to check whether Portage is going to write to read-only filesystems. +Since the methods are not portable across different OSes, each OS needs its +own method. To expand RO checking for different OSes, add a method which +accepts a list
Re: [gentoo-portage-dev] [PATCH v3] Test for read-only filesystems, bail out during preinst if there are any which will be written to and display a useful error message. Fixes bug 378869.
On Sunday 19 January 2014 05:39:25 Alexander Berntsen wrote: On 19/01/14 10:17, Mike Frysinger wrote: prefer OSes - OS's That's just not proper English. i don't think that phrase means what you think it means. if you're wishing for English to be a standard, then you're in for a rude surprise. It makes no sense. of course it does. Please don't prefer that. If for nothing else, then to prevent me from sighing whenever I have to read it. https://en.wikipedia.org/wiki/English_plurals#Plurals_of_letters_and_abbreviations -mike signature.asc Description: This is a digitally signed message part.
Re: [gentoo-portage-dev] [PATCH v4] Test for read-only filesystems, bail out during preinst if there are any which will be written to and display a useful error message. Fixes bug 378869.
On Monday 20 January 2014 19:50:54 Chris Reffett wrote: + # Check for read-only filesystems please use full sentences. that means putting a period at the end. this applies to many additions in this patch. + try: + with io.open(/proc/mounts, mode='r', encoding=_encodings['content'], + errors='replace') as f: + roregex = re.compile(r'(\A|,)ro(\Z|,)') + for line in f: + if roregex.search(line.split( )[3].strip()) is not None: + romount = line.split( )[1].strip() + ro_filesystems.add(romount) pretty sure the body of this with block is indented one too many times -mike signature.asc Description: This is a digitally signed message part.
Re: [gentoo-portage-dev] [PATCH v3] Test for read-only filesystems, bail out during preinst if there are any which will be written to and display a useful error message. Fixes bug 378869.
If your going to make that argumint, ewe mite a's well right the documentation in LOL-1337. Encouraging bad grammar in documentation just make's thing's harder for everybody. On Mon, Jan 20, 2014 at 9:28 PM, Mike Frysinger vap...@gentoo.org wrote: On Sunday 19 January 2014 05:39:25 Alexander Berntsen wrote: On 19/01/14 10:17, Mike Frysinger wrote: prefer OSes - OS's That's just not proper English. i don't think that phrase means what you think it means. if you're wishing for English to be a standard, then you're in for a rude surprise. It makes no sense. of course it does. Please don't prefer that. If for nothing else, then to prevent me from sighing whenever I have to read it. https://en.wikipedia.org/wiki/English_plurals#Plurals_of_letters_and_abbreviations -mike
[gentoo-portage-dev] [PATCH v5] Test for read-only filesystems, bail out during preinst if there are any which will be written to and display a useful error message. Fixes bug 378869.
v2: Reformat, add a function to return an appropriate read-only checker for the operating system, so that this can be extended to other OSes. v3: minor formatting tweaks from bernalex, including use os.path.join() instead of string concatenation v4: Update copyright header, change the code in rochecker to open with io.open in order to not break on non-ascii characters as reported by Arfrever. Change get_ro_checker to use a dict as suggested by vapier. v5: Fix comment format as requested by vapier. --- pym/portage/dbapi/vartree.py | 34 - pym/portage/util/rochecker.py | 88 +++ 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 pym/portage/util/rochecker.py diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ed62323..cf6781b 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1,4 +1,4 @@ -# Copyright 1998-2013 Gentoo Foundation +# Copyright 1998-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -32,6 +32,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.util.env_update:env_update', 'portage.util.listdir:dircache,listdir', 'portage.util.movefile:movefile', + 'portage.util.rochecker:get_ro_checker', 'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry', 'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap', 'portage.util._async.SchedulerInterface:SchedulerInterface', @@ -3508,6 +3509,8 @@ class dblink(object): This function does the following: + calls get_ro_checker to retrieve a function for checking whether Portage + will write to a read-only filesystem, then runs it against the directory list calls self._preserve_libs if FEATURES=preserve-libs calls self._collision_protect if FEATURES=collision-protect calls doebuild(mydo=pkg_preinst) @@ -3685,6 +3688,7 @@ class dblink(object): eagain_error = False myfilelist = [] + mydirlist = [] mylinklist = [] paths_with_newlines = [] def onerror(e): @@ -3717,6 +3721,9 @@ class dblink(object): unicode_errors.append(new_parent[ed_len:]) break + relative_path = parent[srcroot_len:] + mydirlist.append(os.path.join(/, relative_path)) + for fname in files: try: fname = _unicode_decode(fname, @@ -3829,6 +3836,31 @@ class dblink(object): for other in others_in_slot]) prepare_build_dirs(settings=self.settings, cleanup=cleanup) + # Check for read-only filesystems. + ro_checker = get_ro_checker() + rofilesystems = ro_checker(mydirlist) + + if rofilesystems: + msg = _(One or more files installed to this package are + set to be installed to read-only filesystems. + Please mount the following filesystems as read-write + and retry.) + msg = textwrap.wrap(msg, 70) + msg.append() + for f in rofilesystems: + msg.append(\t%s % os.path.join(destroot, + f.lstrip(os.path.sep))) + msg.append() + self._elog(eerror, preinst, msg) + + msg = _(Package '%s' NOT merged due to read-only file systems.) % \ + self.settings.mycpv + msg += _( If necessary, refer to your elog + messages for the whole content of the above message.) + msg = textwrap.wrap(msg, 70) + eerror(msg) + return 1 + # check for package collisions blockers = self._blockers if blockers is None: diff --git a/pym/portage/util/rochecker.py b/pym/portage/util/rochecker.py new file mode 100644 index 000..2d3c89f --- /dev/null +++ b/pym/portage/util/rochecker.py @@ -0,0 +1,88 @@ +#-*- coding:utf-8 -*- +# Copyright 2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +Methods to check whether Portage is going to write to read-only filesystems. +Since the methods are not portable across different OSes, each OS needs its +own method. To expand RO checking for