public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Chris Reffett <creffett@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	[thread overview]
Message-ID: <201401190417.41690.vapier@gentoo.org> (raw)
In-Reply-To: <1390096848-28010-1-git-send-email-creffett@gentoo.org>

[-- Attachment #1: Type: Text/Plain, Size: 1442 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-01-19  9:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-11  3:07 [gentoo-portage-dev] [PATCH] Check for and report read-only filesystems Chris Reffett
2014-01-11  5:09 ` Brian Dolbec
2014-01-11 14:22   ` Chris Reffett
2014-01-13 23:24 ` Mike Frysinger
2014-01-17  0:39   ` [gentoo-portage-dev] [PATCH v2] 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 Chris Reffett
2014-01-19  2:00     ` [gentoo-portage-dev] [PATCH v3] " Chris Reffett
2014-01-19  9:17       ` Mike Frysinger [this message]
2014-01-19 10:39         ` Alexander Berntsen
2014-01-19 21:43           ` Alec Warner
2014-01-21  3:28           ` Mike Frysinger
2014-01-21  3:53             ` Gordon Pettey
2014-01-21 22:44               ` Mike Frysinger
2014-01-21  0:50         ` [gentoo-portage-dev] [PATCH v4] " Chris Reffett
2014-01-21  3:32           ` Mike Frysinger
2014-01-21  4:00             ` [gentoo-portage-dev] [PATCH v5] " Chris Reffett
2014-01-22  5:24               ` Mike Frysinger
2014-01-22 18:33                 ` [gentoo-portage-dev] [PATCH v6] " Chris Reffett

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=201401190417.41690.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=creffett@gentoo.org \
    --cc=gentoo-portage-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