Page MenuHomeFreeBSD

Uses/pgsql.mk: PostgreSQL option to install a version between an interval
ClosedPublic

Authored by lbartoletti_tuxfamily.org on Jan 11 2019, 9:00 AM.

Details

Summary

As a postgis maintainer and other tools relying on postgresql, I need to define an interval for postgresql. This allows you to avoid errors like this one at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234813

I had proposed this patch in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213038 but it was not followed.

I propose this patch independently.

Once approved, I will modify my ports requiring intervals and update the documentation.

Thank you.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

crees requested changes to this revision.Jan 11 2019, 12:18 PM

I think this should work-- how have you tested this?

Uses/pgsql.mk
10 ↗(On Diff #52760)

Please would you document it too? I'll deal with the Porter's Handbook bit.

84 ↗(On Diff #52760)

_MIN=${pgsql_ARGS:M?*-?*:C,-.*,,}

Should work, but please test. Use ?* because * matches the empty string, which isn't a problem because of the elif but the test is incorrect; would match *- as well.

This revision now requires changes to proceed.Jan 11 2019, 12:18 PM
lbartoletti_tuxfamily.org marked an inline comment as done.Jan 11 2019, 5:57 PM

I think this should work-- how have you tested this?

Yes, with some test on a fake port. However, I didn't try to compile all the ports using pgsql.mk

For example with pgsql9.5 installed and a port with

USES= pgsql:9.3-9.4

I get

version 9.3 9.4 and you have version 9.5 installed.
*** Error code 1

Stop.
USES= pgsql:9.6-11

The result is:

version 9.6 10 11 and you have version 9.5 installed.
*** Error code 1

Stop.

If I write:

USES= pgsql:9.6-9.3

I get:

The minimum version must be higher than the maximum version wanted.
*** Error code 1

Stop.

And if no pgsql is installed

USES= pgsql:9.6-11

installs postgresql9.6

lbartoletti_tuxfamily.org retitled this revision from PostgreSQL option to install a version between an interval to PostgreSQL option to install a version between an interval.

Rewriting documentation on version options. Application of the @crees suggestion for MIN

lbartoletti_tuxfamily.org marked an inline comment as done.Jan 11 2019, 6:13 PM
crees accepted this revision.Jan 11 2019, 6:22 PM

Please get the MAX fixed too and it's great.

Uses/pgsql.mk
93 ↗(On Diff #52774)

If you do this one too I'll commit it :)

This revision is now accepted and ready to land.Jan 11 2019, 6:22 PM

Change substitution also for MAX

This revision now requires review to proceed.Jan 11 2019, 7:43 PM
lbartoletti_tuxfamily.org marked an inline comment as done.Jan 11 2019, 7:45 PM
lbartoletti_tuxfamily.org added inline comments.
Uses/pgsql.mk
93 ↗(On Diff #52774)

Oh yes, sorry!
Thank you :)

lbartoletti_tuxfamily.org marked an inline comment as done.Jan 11 2019, 7:45 PM
linimon retitled this revision from PostgreSQL option to install a version between an interval to Uses/pgsql.mk: PostgreSQL option to install a version between an interval.Jan 15 2019, 4:22 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 15 2019, 9:51 PM
This revision was automatically updated to reflect the committed changes.
crees added a comment.Jan 15 2019, 9:53 PM

Committed, thanks!

Uses/pgsql.mk
98 ↗(On Diff #52779)

Point of curiosity, in former versions of make it had to be written as ${_MIN} <= ${version}

If you're ever writing portable code that's worth remembering:

https://www.freebsd.org/cgi/man.cgi?query=make&apropos=0&sektion=1&manpath=FreeBSD+8.3-RELEASE&arch=default&format=html#end