[MacPorts] #60051: gildas @202002a: sort: invalid option -- V
MacPorts
noreply at macports.org
Tue Jun 16 18:32:07 UTC 2020
#60051: gildas @202002a: sort: invalid option -- V
-------------------------+----------------------
Reporter: ryandesign | Owner: bardeau
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.6.2
Resolution: | Keywords:
Port: gildas |
-------------------------+----------------------
Comment (by ryandesign):
Replying to [comment:3 bardeau]:
> Replying to [comment:2 ryandesign]:
> > If you don't care about portability, you can add a dependency on
port:coreutils and use `${prefix}/bin/gsort` instead of `sort`. It does
support `-V`.
>
> What is the proper way to to invoke gsort from my shell script? Is
${prefix} supposed to be a valid environment variable? It does not seem:
> {{{
> /opt/local/var/macports/build/_opt_local_var_macports_sources_github
.com_macports_macports-ports_science_gildas/gildas/work/gildas-src-
jun20b/admin/define-system.sh: line 28: /bin/gsort: No such file or
directory
> }}}
> Isn't there a configure.* keyword I could use for reinplacement?
`prefix` is a Tcl variable. If you need it outside of Tcl, for example in
a source code file, you add a patchfile that puts a `@PREFIX@` placeholder
into the file in the right place, and then you replace the placeholder
with the variable's value like this:
{{{
post-patch {
reinplace -W ${worksrcpath} "s|@PREFIX@|${prefix}|g" somefile.sh
someotherfile.sh
}
}}}
> > [https://stackoverflow.com/questions/4023830/how-to-compare-two-
strings-in-dot-separated-version-format-in-bash There are many other
potential solutions to this problem] of varying portability and
correctness. I haven't tried them myself but maybe you'll see a method in
there that you like.
> I precisely used one of the method proposed on this page (verle-verlt).
A lot of methods contain bashisms which are not portable (in particular to
dash or zsh). The verlt-verle is the softest solution I could find, at the
cost of depending on a sort -V implementation.
As I said, the proposals are of varying portability. :) `sort -V` isn't
portable.
--
Ticket URL: <https://trac.macports.org/ticket/60051#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list