portindex ignores (filters out) unchanged port

Rainer Müller raimue at macports.org
Tue Dec 29 08:59:07 PST 2015


On 2015-12-29 15:06, René J.V. Bertin wrote:
> My proposition is to parse a Portfile only when
> 
> 1 its mtime is newer (or just different)

Different from what? Do you propose to store the mtime of the Portfile
when it was last indexed? Where and how would we look that information up?

> 2 it lives in a portdir not yet known

As I told earlier, it is not possible to look up a port by portdir with
the current PortIndex format. The only key to find a port in the
PortIndex is by its name.

Looking up a port by portsdir requires either an additional portsdir map
for the PortIndex (similar to PortIndex.quick for the port name) or a
complete redesign of the format.

> 3 its hash is different from the one stored in one or both of the
> PortIndex files (or none is stored, but that should already be caught by 2)

What would that solve? Hashing the Portfile just needs more time. Maybe
we could only hash if it has the same mtime, but that would address a
hypothetical case.

> 1) is mostly a simple way to force a reindexing, 2) should catch most
> new Ports and 3) catches anything else. Any Portfile that doesn't trip
> one of the conditions shouldn't require indexing AFAICS, regardless of
> whether the port and portdir names match or not.
>
> Am I missing something?

Your proposal would make the generation of PortIndex more robust, but
also requires a redesign of the PortIndex format to make it possible to
look up ports by either portsdir or by port name.

Anyway, using the name of the port for the ports dir is a reasonable
convention in my opinion. We should just keep it that way, regardless of
the current technical requirement.

Rainer


More information about the macports-dev mailing list