[BuildStream] Element's variables in sources declarations



Hey,

TLDR: I'm proposing to give sources access to their element's variables

I have been playing a bit more with BuildStream and encountered a few cases
where I would have the same variable repeated in multiple places.
It would be useful for users to be able to use element's variables in their
sources to remove that need. Moreover, as the 'variables' and the 'sources'
often live in the same file, it is natural to try using those variables.

Example use case:

Let's assume I want to build OpenJDK 8. A BST element currently would be like:

-------------
kind: manual
sources:
  - kind: tar
    url: openjdk:jdk8u/jdk8u/archive/jdk8u232-b05.tar.bz2
    ref: ed87467e24c623396eae0bb2057bc2a8b8fd0ed30843e9413e578c7b3e5c689f
  - kind: tar
    url: openjdk:jdk8u/jdk8u/langtools/archive/jdk8u232-b05.tar.bz2
    ref: 812c70931157f5ba41e178b6e394a8552f15f53d0171d2f1b66537c9a76d5cc9
    directory: langtools
  - kind: tar
    url: openjdk:jdk8u/jdk8u/hotspot/archive/jdk8u232-b05.tar.bz2
    directory: hotspot
    ref: 820da1b5dcfece8f249395b45983984c6c82886d78cbd1183faa98ad5497e8b8

< snip: 8 more sources with the same pattern are needed>
--------------

Notice the '232' and the '05' in each source. They represent the version and
build number of the java runtime you want to build. It is also needed in the
configure step.

Modifying the version or build number becomes annoying, whereas, if we could
define a 'version' and 'build' variable, updating would be a single line
change.

Does someone see any problem with allowing sources to access the element's
variable? Or did the use case never came up before?

Cheers,

Ben



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]