loading checksums table from pre-checksum block?
René J.V. Bertin
rjvbertin at gmail.com
Sat Oct 27 07:16:42 UTC 2018
Hi,
I have a port with lots of subports for which I keep the checksums in a table-like structure in a dedicated file, so as to keep the Portfile a bit more manageable (and to be able to generate said table with a script when it's upgrade time).
Currently I have an explicit check that tests if the file exists in $filespath before sourcing it, to prevent errors when run from the registry.
Doing it from a pre-checksum block would be more elegant and more efficient, but I cannot seem to figure out how to get the `source` command to apply to the correct context.
How should I do that? I tried versions of the below with and without the quotes or the uplevel, none works:
{{{
pre-checksum {
ui_debug "Reading checksums from ${filespath}/${checksums.table}"
uplevel "source ${filespath}/${checksums.table}"
}
}}}
The checksums table file looks like this:
{{{
# checksums for foo family v5.47.0
array set checksumtable {
# http://download.foo.org/stable/foo/5.47/foo1-5.47.0.tar.xz
foo1 {
e3a2f4e62d7ff76ff87479b322f3e8054e8f1dd2
72a1962de852590d9494ebcfa9f98e1d394bad4680384b9a6937a7082140259e
}
# many more of those
}
}}}
(the Portfile contains a procedure called from each subport that gets and sets the checksums for that subport.)
I could change the include file if needed but I'd prefer not to, unless there's a simple way to turn it into a true, pure datafile
Thanks,
R.
More information about the macports-dev
mailing list