Closed sil2100 closed 5 years ago
@mvo5 maybe you know: CI seems to be failing for this branch, and when building it locally it also fails for me (cosmic) - does this work when you build it locally? I originally thought there's something wrong with my system only, as I didn't see anything wrong with the change I proposed.
It's hard for me to understand how we are actually tainting the snapcraft environment that the version script doesn't work (it works fine on any other snapcraft project). Should we pull in someone from the snapcraft team to help?
@sil2100 I poked at this a bit last night but had some network issues (was on a slow link for unrelated reasons). I poke at it again today, I suspect its snapcraft.internal.common - it has a "env = []" list that is probably not cleaned.
I filed https://bugs.launchpad.net/snapcraft/+bug/1822988 - that hopefully explains why it crashes. I don't know any workarounds right now.
Two options here, try and use the replacement for the deprecated version-script which is documented here https://docs.snapcraft.io/scriptlets/4892 and do it early enough in the process, like
Extract:
# Comment version as it takes precedence
# version: foo
adopt-info: core
parts:
core:
...
override-pull: |
snapcraftctl set-version $(/bin/date ...)
snapcraftctl pull
Or to run bin/date with LD_LIBRARY_PATH set to "", such that version script looks like
version-script: echo "$(LD_LIBRARY_PATH="" /bin/date +%Y%M%d)"
Wow, that's something. Thanks Sergio, Michael! Didn't know version-script was being deprecated, geh. I actually tried the version-script: echo "$(LD_LIBRARY_PATH="" /bin/date +%Y%M%d)"
and it didn't work, so I'm glad there's something else like this. All good to go, let me merge this!
Thanks mvo for force-pushing!
@sergiusens Thanks a bunch for your suggestions! it does no longer crash with set-version. But apparently it also does not work :/ Any ideas.
Yes, the adopt-info
part is key into making this be picked up.
El miércoles, 3 de abril de 2019 13:57:14 -03 Łukasz Zemczak escribió:
Wow, that's something. Thanks Sergio, Michael! Didn't know version-script was being deprecated, geh. I actually tried the
version-script: echo "$(LD_LIBRARY_PATH="" /bin/date +%Y%M%d)"
and it didn't work, so I'm glad there's something else like this. All good to go, let me merge this!
This is because I might have gotten it wrong and the env var needs to be set even for echo. Thinking a bit more, you do not even need the echo, all you need is to output to stdout which calling date already does! :-)
Seems to have done the trick Snapped core18_20194603_amd64.snap
Thanks again Sergio! Yes, it seems to work like a charm now ;)
Pushing this as a PR since for unknown reasons the version-script fails here locally. Based on mvo's earlier PR.