Re: [PATCH v1] [meson] add a default option prefix=/usr/local/pgsql - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [PATCH v1] [meson] add a default option prefix=/usr/local/pgsql
Date
Msg-id 20221001020721.rsvpd23jlkintmqp@awork3.anarazel.de
Whole thread Raw
In response to Re: [PATCH v1] [meson] add a default option prefix=/usr/local/pgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH v1] [meson] add a default option prefix=/usr/local/pgsql  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2022-09-30 21:19:03 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I see two potential ways of dealing with this reliably on windows: - error out
> > if a prefix is not drive-local, that's easy enough to check, something like:
> > normalized_prefix.startswith('/') and not normalized_prefix.startswith('//')
> > as the installation on windows is relocatable, that's not too bad a
> > restriction - if on windows call a small python helper to compute the path of
> > tmp_install + prefix, using the code that meson uses for the purpose
> 
> I'd be inclined to keep it simple for now.  This seems like something
> that could be improved later in a pretty localized way, and it's not
> like there's not tons of other things that need work.

Just not sure which of the two are simpler, particularly taking docs into
account...

The attached 0001 calls into a meson helper command to do this. Not
particularly pretty, but less code than before, and likely more reliable.


Alternatively, the code meson uses for this is trivial, we could just stash it
in a windows_tempinstall_helper.py as well:

import sys
from pathlib import PureWindowsPath as PurePath

def destdir_join(d1: str, d2: str) -> str:
    if not d1:
        return d2
    # c:\destdir + c:\prefix must produce c:\destdir\prefix
    return str(PurePath(d1, *PurePath(d2).parts[1:]))

print(destdir_join(sys.argv[1], sys.argv[2]))

Greetings,

Andres Freund

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: problems with making relfilenodes 56-bits
Next
From: Zhihong Yu
Date:
Subject: Re: Bloom filter Pushdown Optimization for Merge Join