Re: [PATCH] Allow % as wildcard in the end of PREFERRED_VERSION_pkg

Phil Blundell <philb@...>

On Mon, 2009-09-14 at 00:43 +0200, Martin Jansa wrote:
+def isPreferredVersion(pe, pv, pr, preferred_e, preferred_v, preferred_r):
+ """
+ Check if the version pe,pv,pr is the preferred one.
+ If there is preferred version defined and ends with '%', then pv has to start with that version after removing the '%' in the end,
+ """

+ if (pv == preferred_v or (preferred_v != None and preferred_v.endswith('%') and pv.startswith(preferred_v[:len(preferred_v)-1]))):
+ if (pr == preferred_r or preferred_r == None):
+ if (pe == preferred_e or preferred_e == None):
+ return true
+ return false
I'm not totally comfortable that this patch is semantically well-formed.
If you start allowing wildcards then the idea of "the preferred version"
becomes somewhat ill-defined since, obviously, the wildcard might match
any number of files. I'm not quite sure what the problem is that you
are trying to solve, but my initial reaction is that (whatever the
problem is) it would probably be better solved another way.


Join to automatically receive all group messages.