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

Re: Extending libdebian-installer's API to include certainty on subarch detection



On Tue, Aug 24, 2010 at 11:02:53PM +0800, Michael Casadevall wrote:
> I've recently been doing some work on improving sub-architecture detection
> support to be more generic. I currently have several ARM platforms (Marvell
> Dove, and TI OMAP3 + OMAP4) which have common kernels which work across
> multiple boards. I have found the explicit whitelist/board name to subarch
> we currently use for subarch detection on armel to be insufficent for my
> needs, and I'd like to propose extending the libdebian-installer API with
> the following function to the API:
> 
> const char *di_system_subarch_analyze_with_certainity(int * certainity)

Let's ensure that new interfaces are spelled correctly!  It's
"certainty".

> This function behaves just like the existing di_system_subarch_analyze()
> function, expect the passed pointer returns a subarch specific level of
> certainity. This certianity is availability by the API, or returned as the
> exit code of archdetect (and thus available to base-insatller and
> flash-kernel-installer).

The problem with using archdetect's exit code is that Unix exit codes
are either success or failure, and there's only one success code.  "We
think we have a reasonable guess" is sort of successful, and making it a
failure is confusing.  I think it would be better to have archdetect
fail if the board isn't fully-supported, and have something like
'archdetect --guess' to ask it to make a best guess.

(Yes, this would require all callers to be changed, but any 'set -e'
caller would need to be changed anyway.)

This would flow through into the libd-i ABI, so instead of
di_system_subarch_analyze_with_certainty you might have:

  /**
   * As di_system_subarch_analyze, but tries to make a reasonable guess
   * if the system isn't explicitly supported.
   */
  const char *di_system_subarch_analyze_guess (void);

Does that make sense?

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: