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 Monday 20 January 2014 22:53:25 Gordon Pettey wrote: 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. (1) don't top post (2) you posted nothing to support your assertion that using 's to pluralize acronyms is bad grammar (3) i posted information that shows it's an accepted form so if you don't have anything useful to post, then just refrain from doing so -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.
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 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
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 Saturday 18 January 2014 21:00:48 Chris Reffett wrote: --- /dev/null +++ b/pym/portage/util/rochecker.py @@ -0,0 +1,81 @@ +#-*- 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 of directories and returns a list of mounts which need to be +remounted RW, then add elif ostype == (the ostype value for your OS) to prefer OSes - OS's +get_ro_checker() + period at the end +def get_ro_checker(): + + Uses the system type to find an appropriate method for testing whether Portage + is going to write to any read-only filesystems + + @return: + 1. A method for testing for RO filesystems appropriate to the current system + not a new issue, but we really need to get away from this style and use PEP257. someone feel like fixing that in the code base ? :) + if ostype == Linux: + return linux_ro_checker + else: + return empty_ro_checker isn't this a glorified dict ? _CHECKERS = { 'Linux': linux_ro_checker, } def get_ro_checker() return _CHECKERS.get(ostype, empty_ro_checker) -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.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 19/01/14 10:17, Mike Frysinger wrote: prefer OSes - OS's That's just not proper English. It makes no sense. Please don't prefer that. If for nothing else, then to prevent me from sighing whenever I have to read it. not a new issue, but we really need to get away from this style and use PEP257. someone feel like fixing that in the code base ? :) I agree. If you give me at least a week (won't have time until next weekend), I can look into it. - -- 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/ iF4EAREIAAYFAlLbq10ACgkQRtClrXBQc7U7MAD/Yl2pd0ood3UKmvNMg9gdWMsw hQqnReHPRwLpDNRccOcA/jUODDanycVmNLpD/rjkYnKyllnbUSIxduYuMcJFqXme =vaDs -END PGP SIGNATURE-
[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.
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 --- pym/portage/dbapi/vartree.py | 32 + pym/portage/util/rochecker.py | 81 +++ 2 files changed, 113 insertions(+) create mode 100644 pym/portage/util/rochecker.py diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ed62323..917634f 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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..67e8131 --- /dev/null +++ b/pym/portage/util/rochecker.py @@ -0,0 +1,81 @@ +#-*- 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 of directories and returns a list of mounts which need to be +remounted RW, then add elif ostype == (the ostype value for your OS) to +get_ro_checker() + +from __future__ import unicode_literals + +import logging +import re + +from portage.util import writemsg_level +from portage.localization import _ +from portage.data import ostype + + +def get_ro_checker(): + + Uses the system type to find an appropriate method for