Environment variable customization should be possible with scriptlet+snapcraftctl

Bug #1778174 reported by 林博仁(Buo-ren, Lin)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Wishlist
Kyle Fazzari

Bug Description

Currently, snapcraftctl doesn't honor environment variable customization like setting a new command search PATH, bug #1600035 mentions `build-environment` key that should have this functionality but it doesn't seems to be implemented.

Revision history for this message
Matt Pekar (sloofgrum) wrote :

We have a snap project where multiple binaries depend on a single custom library. With environment variables we could build the library part, then have the binary parts reference the lib output.

   override-build: |
      export LD_LIBRARY_PATH=$SNAPCRAFT_PRIME/opt/myproject/lib
      export PKG_CONFIG_PATH=$SNAPCRAFT_PRIME/opt/myproject/lib/pkgconfig
      # ^ environment settings above are discarded by snapcraftctl
      snapcraftctl -d build

Alternatively if perhaps the cmake module had an option to pass environment variables in addition to "configflags", that'd be another way to resolve our issue.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

The proposed solution for this issue is here: https://github.com/snapcore/snapcraft/pull/2322

Changed in snapcraft:
status: New → In Progress
importance: Undecided → Wishlist
assignee: nobody → Kyle Fazzari (kyrofa)
Changed in snapcraft:
milestone: none → 3.0
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
Revision history for this message
林博仁(Buo-ren, Lin) (buo-ren-lin) wrote :

Just drop by and want to say thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.