the build scriptlet doesn't take into account the source-subdir

Bug #1676186 reported by Leo Arias
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I have a source in a subdir, and want to build and install it using scriptlets. Even if I declare the source-subdir tag, the scriptlets will run from the build dir. I think it would make more sense to run the scriptlets from the subdir instead.

Take a look at this part:

  source-subdir: FreeImage
  plugin: nil
  build-packages: [g++]
  build: |
    cd FreeImage
  install: |
    mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/
    cp FreeImage/Dist/* $SNAPCRAFT_PART_INSTALL/usr/lib/
    ln -s $SNAPCRAFT_PART_INSTALL/usr/lib/libfreeimage*.so $SNAPCRAFT_PART_INSTALL/usr/lib/

The subdir is FreeImage, and I still had to cd FreeImage during build, and during install I had to cp FreeImage/...

If we agree that the scriptlets should run from the subdir, a fix here is a little delicate because it will break the parts with subdir and scriptlets.

Leo Arias (elopio)
tags: added: sources
Leo Arias (elopio)
tags: added: scripts
removed: scriptlets
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Yes, I agree.

Changed in snapcraft:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Michał Sawicz (saviq) wrote :


What's more, the [`source-subdir` documentation]( states:

> A path within the source to set as the working directory when building. The build will not be able to access files outside of this location, such as one level up.

Which is false, because of this bug.

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.