[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFC: Output files for netboot-xen flavour



On Tue, Jul 22, 2008 at 08:42:33AM +0100, Ian Campbell wrote:
> +# install-installer: where to obtain the Debian Installer bits, by
> +#   default these are located under install-mirror. To use a nightly
> +#   snapshot: http://people.debian.org/~joeyh/d-i/images/daily/

How do you check the integrity of this files?

> +disk = [ 'phy:hda1,hda1,w' ]

hdXY will not work with new kernels.

> +global var_check_boot_with_default

Where did you read this?

> +def var_check_bool_with_default(default,var,val):

Please read PEP-8[1].

> +   if type(val) == bool:

"isinstance"

> +      return val
> +   elif type(val) == str:
> +      if val.lower in ["t", "tr", "tru", "true"]:

val.lower is a method, no string.

> +xm_vars.var('install', use='Install Debian, default: false',
> +            check=lambda var, val: var_check_bool_with_default(False, var, val))

A reason why you don't use something like this?

| def check_bool(name, value):
|     value = str(value).lower()
|     if value in ('t', 'tr', 'tru', 'true')
|         return True
|     return False
| 
| xm_vars.var('install', 'Install Debian, default: false', check_bool)
| 
| if xm_vars.env.get('install'):
|     pass

> +   else:
> +      installer = os.path.join(xm_vars.env['install-mirror'],"dists",xm_vars.env['install-suite'],"main","installer-"+xm_vars.env['install-arch'],
> +                               "current","images")

os.path.join is not applicable for an URI.

> +   import urllib
> +   (kernel,_) = urllib.urlretrieve(os.path.join(installer, "netboot", "xen", "debian-installer", xm_vars.env['install-arch'], "linux"))

kernel, _ = bla
os.path.join again and unreadable long lines.

There are some more style things ...

Bastian

[1]: http://www.python.org/dev/peps/pep-0008/

-- 
It is undignified for a woman to play servant to a man who is not hers.
		-- Spock, "Amok Time", stardate 3372.7


Reply to: