combine 'vala-packages' and 'packages' variables

Bug #1166181 reported by Adam Dingle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bake
Fix Committed
Medium
Unassigned

Bug Description

When I write a recipe for a Vala program or library, it's irksome that I have to specify each package in both the 'vala-packages' and 'packages' variables. I think 99% of the time these will be the same. It would be nice to combine these somehow so that in the typical case I only have to write each package name once. For example, we could say that 'vala-packages' are used both in the Vala and C compilation stages, and that another variable 'c-packages' lists extra packages to be used only in the C stage.

Related branches

Revision history for this message
shuerhaaken (shkn) wrote :

This needs to be reworked as there are more problems.
See my last comment in #1165439 (https://bugs.launchpad.net/bake/+bug/1165439)

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Agreed - originally there was just 'packages' and the Vala module interpreted these differently. This changed because it couldn't handle .girs correctly. But moving back to one variable seems like the right goal.

Changed in bake:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

My $0.02 on the topic of C dependencies:
We actually had a case in elementary when you had to forcibly specify an additional C dependency because of glib's deprecation of threading API to build absolutely anything with the current (at the time) Vala version. So specifying C packages is actually required sometimes, athough in theory it shouldn't be. Technically you can consider that a workaround or a hack and state that it should be fixed on a different level than the build system.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Ack on the sometimes need for C dependencies. I originally was going for the "build system knows best" design but there are always exceptions in real code :) So I'd like Bake to support the 99% case is easy with one variable, and it's possible to override this if necessary. Now we can tag variable values (for the optional support) we should probably allow the user to override values in the package list, i.e. something like:

programs.foo {
   sources = foo.vala
   packages = normal-package \
                        special-package (pkg-config-name=bar)
}

Changed in bake:
milestone: none → 0.1.48
status: Triaged → Fix Committed
Revision history for this message
Robert Ancell (robert-ancell) wrote :

The solution is that Bake checks vala-packages and adds these to the packages variable if they are not already defined.

e.g.

programs.foo {
    sources = foo.vala
    vala-packages = gtk+-3.0
}

Will automatically set programs.foo.packages to gtk+-3.0.

If you need to set the version of gtk+-3.0 then you can manually set programs.foo.packages - Bake will detect this and not modify it.

e.g.

programs.foo {
    sources = foo.vala
    vala-packages = gtk+-3.0
    packages = gtk+-3.0 >= 3.12
}

As a future enhancement we should make it possible to define versions in vala-packages (bug 1346171)

Revision history for this message
Robert Ancell (robert-ancell) wrote :

GIR packages do not currently automatically update programs.foo.packages (bug 1346167)

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.