From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 436EC138247 for ; Sun, 19 Jan 2014 09:17:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 61BEFE0BFD; Sun, 19 Jan 2014 09:17:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C8450E0BFA for ; Sun, 19 Jan 2014 09:17:42 +0000 (UTC) Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id D722C33F8DA; Sun, 19 Jan 2014 09:17:41 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: gentoo-portage-dev@lists.gentoo.org Subject: 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. Date: Sun, 19 Jan 2014 04:17:41 -0500 User-Agent: KMail/1.13.7 (Linux/3.12.1; KDE/4.6.5; x86_64; ; ) Cc: Chris Reffett References: <1389919144-30969-1-git-send-email-creffett@gentoo.org> <1390096848-28010-1-git-send-email-creffett@gentoo.org> In-Reply-To: <1390096848-28010-1-git-send-email-creffett@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1929894.2AoBxcdpxv"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201401190417.41690.vapier@gentoo.org> X-Archives-Salt: 50af39a3-57e3-46e6-be97-8e13daae577b X-Archives-Hash: 276ebc9388161c25dad779203bbfbab5 --nextPart1929894.2AoBxcdpxv Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =3D=3D (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=20 PEP257. someone feel like fixing that in the code base ? :) > + if ostype =3D=3D "Linux": > + return linux_ro_checker > + else: > + return empty_ro_checker isn't this a glorified dict ? _CHECKERS =3D { 'Linux': linux_ro_checker, } def get_ro_checker() return _CHECKERS.get(ostype, empty_ro_checker) =2Dmike --nextPart1929894.2AoBxcdpxv Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJS25g1AAoJEEFjO5/oN/WB4jsP/iTVrXrBVq0emoWd5kRwNH4i e9C6VXRUpm6u/xZCo2bTKBhBrsKVbFtTMxkc/q4YTtQbZfquSoo51vWU8BeeXR5y mNJzJEtIECiKzmWYuioqsdP79uK1rBSmcDEpeabskmUe6t/zwQaHZu0+RDRX4+cD BVbiME/ahgWYihyAMJs3bdXi96i0qPEkyuL8xjEB/IuHZEqjC5ywpNVDrnItAS77 7+Niw0ia/N5jYUop/8jmmTlLZAfFNQo+pP8bhAh9/EUntucLG0PdjseoqaHN9GK4 B7vqU3mmh99mxQGA+auNxxXbGYTQj5YBpLOx+MxSRT+mTtCFsDKGTF8pQyHMV+vj 62KEiAB889FEd3Zji9ucWgK2GOVPZ2n9BCI+EZ9xw/UbFQLxPaa4Edjh8G73T7el J+alNt5tS2Z1Ty6dLvPjCFYPK4YuBRLmwO1aJghxjj9QwZOtP0rVuF4YKsDVHpTi nQAXfzzUkL3bpe3Fix6YdVvGfRWF1Tsg5doolzxCxRna+1HTK1JqHATvm4FBMmvg wIo5hzWc/6Oy3Jdv2aP+Rl0v2sCo8Ty3J9ZYyF0Dpbs4sHdEANwmL4ZS/fP8giOE uMoXtmzgLp/RPWNliszC1SX4HdbhMN+rjOO1r0rplRhhHDrpoYqPGApCSzSV64Sq Eof5m7XNkV/bkFkYflT4 =sQF/ -----END PGP SIGNATURE----- --nextPart1929894.2AoBxcdpxv--