Sometimes the actual source url must be determined at build time (e.g. The latest tarball from an apache file listing page parsed in override-pull), it would be great if Snapcraft supports setting the source property using snapcraftctl
so that we can directly snapcraftctl pull
after setting the proper source url.
parts:
links:
# source: determined-in-override-pull
override-pull: |
latest_release="$(
wget \
--output-document=- \
http://links.twibright.com/download \
2>/dev/null \
| grep \
--only-matching \
--extended-regexp \
'href="links-.*.tar.bz2"' \
| cut --delimiter='"' --fields=2 \
| sort --version-sort --reverse \
| head --lines=1 \
| cut --characters=7- \
| sed 's/.tar.bz2//'
)"
snapcraftctl set-version \
"$latest_release"
snapcraftctl set-source \
"http://links.twibright.com/download/links-$latest_release.tar.bz2"
snapcraftctl pull