flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

[Feature request]: Create a symlink to currently building module dir (`FLATPAK_BUILDER_BUILDDIR`)

Open tinywrkb opened this issue 3 years ago • 1 comments

Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Suggestion

The current building module dir, /run/build/ModuleName is unique and different for each module.
While FLATPAK_BUILDER_BUILDDIR environment variable is available in the building instance, it can't be used in the env property.
I suggest adding the symlink /run/build/.current that will point to /run/build/ModuleName.

This will help avoid having to set per-module environment variables, like these used for building Node.js modules, Golang, etc. Instead, it would be possible to set these variables globally or using a YAML alias, making the Flatpak manifest shorter, more concise, and require less maintenance.

tinywrkb avatar Aug 26 '22 16:08 tinywrkb

p.s. my current solution is to use eval.

x-golang-offline-build-options: &golang-offline-build-options
  env:
    GO111MODULE: off
    GOVARS: GOBIN=${FLATPAK_DEST}/bin GOPATH=${FLATPAK_BUILDER_BUILDDIR}
x-golang-online-build-options: &golang-online-build-options
  build-args:
    - --share=network
  env:
    GO111MODULE: off
    GOVARS: GOBIN=${FLATPAK_DEST}/bin GOPATH=${FLATPAK_BUILDER_BUILDDIR}
...
  - name: modname
    build-options: *golang-offline-build-options
   #build-options: *golang-online-build-options
    buildsystem: simple
    build-commands:
     #- eval ${GOVARS} go get; exit 1 # ONLINE-BUILD
      - eval ${GOVARS} go install # OFFLINE-BUILD
    sources:
      - type: archive
...
      - modname-go-sources.json # OFFLINE-BUILD, flatpak-go-get-generator.py -o modname-go-sources.json ./
...

tinywrkb avatar Aug 26 '22 20:08 tinywrkb