Bug 95274 - freedesktop-sdk-base: Generate/subst metadata in makefile
Summary: freedesktop-sdk-base: Generate/subst metadata in makefile
Status: RESOLVED FIXED
Alias: None
Product: xdg-app
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Alexander Larsson
QA Contact: Alexander Larsson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-04 23:29 UTC by Tristan Van Berkom
Modified: 2016-05-12 06:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Generate/subst metadata in the makefile (2.99 KB, text/plain)
2016-05-04 23:29 UTC, Tristan Van Berkom
Details
Generate/subst metadata in the makefile [version 2] (2.97 KB, patch)
2016-05-06 22:10 UTC, Tristan Van Berkom
Details | Splinter Review
Generate metadata in the makefile [version 3] (3.98 KB, patch)
2016-05-11 20:16 UTC, Tristan Van Berkom
Details | Splinter Review
Generate metadata in the makefile [version 4] (3.98 KB, patch)
2016-05-11 21:56 UTC, Tristan Van Berkom
Details | Splinter Review

Description Tristan Van Berkom 2016-05-04 23:29:48 UTC
Created attachment 123481 [details]
Generate/subst metadata in the makefile

With this patch, one must always invoke make with:

   make ARCH=${arch} VERSION=${version}

...and the architecture and version (of base platform/sdk it produces) is not hard coded into the makefile.
Comment 1 Alexander Larsson 2016-05-06 09:39:50 UTC
I don't agree with having to specify VERSION. It is part of the state of the sources, not something you must know and specify from some external source. For instance, current master must be 1.5 and the 1.4 branch must have "1.4". If you let the user specify it you only risk getting things wrong.

I recently added "xdg-app --default-arch". We should probably use the value of this as the default value for arch.

Will the _FORCE thing really get the order right? Don't we need depencencies from all on the various metadata files?
Comment 2 Tristan Van Berkom 2016-05-06 16:02:48 UTC
(In reply to Alexander Larsson from comment #1)
> I don't agree with having to specify VERSION. It is part of the state of the
> sources, not something you must know and specify from some external source.
> For instance, current master must be 1.5 and the 1.4 branch must have "1.4".
> If you let the user specify it you only risk getting things wrong.
> 
> I recently added "xdg-app --default-arch". We should probably use the value
> of this as the default value for arch.

Sure I agree, lets just hard code the version in the top level makefile here ?

> Will the _FORCE thing really get the order right? Don't we need depencencies
> from all on the various metadata files?

Yes it does, metadata.platform is required when it's time to build ${FILE_REF_PLATFORM}, and as metadata.platform is one of the targets in ${METADATA_FILES}; it will be rebuilt unconditionally due to it's dependency on metadata_FORCE.
Comment 3 Tristan Van Berkom 2016-05-06 22:10:37 UTC
Created attachment 123528 [details] [review]
Generate/subst metadata in the makefile [version 2]

Here is another iteration of the said patch which does:

 a.) Keep the VERSION defined in one place in the toplevel Makefile

 b.) Defaults to `xdg-app --default-arch` for the ARCH, but can
     be overridden with make ARCH=
Comment 4 Alexander Larsson 2016-05-09 07:06:10 UTC
(In reply to Tristan Van Berkom from comment #2)
> (In reply to Alexander Larsson from comment #1)

> > Will the _FORCE thing really get the order right? Don't we need depencencies
> > from all on the various metadata files?
> 
> Yes it does, metadata.platform is required when it's time to build
> ${FILE_REF_PLATFORM}, and as metadata.platform is one of the targets in
> ${METADATA_FILES}; it will be rebuilt unconditionally due to it's dependency
> on metadata_FORCE.

This seems bad. The automatic build systems I've set up depends on "make" being a no-op if nothing changed, but with this setup the images will be rebuilt every time you run "make". Most stuff is cached, so the images will be mostly the same sans a time-stamp or two, but the difference will trigger a rebuild of the next runtime layer, etc.

So, I think the proper solution is to have the image make rules depend on metadata.sdk.in, and then do the seding inside the build rule for the image.
Comment 5 Tristan Van Berkom 2016-05-11 20:16:54 UTC
Created attachment 123628 [details] [review]
Generate metadata in the makefile [version 3]

This patch substitutes the metadata every time it's needed with a canned sequence.

Note that with this patch, the rename of metadata.sdk -> metadata.sdk.in is not really necessary - but I kept it in because:

  a.) Since it contains obvious substitutions it seems natural to use 
      the .in suffix

  b.) Because of how flatpak-builder sets up it's directories and manages
      it's metadata, we will have to use intermediate substituted metadata
      files anyway there, so it seems alright to repeat that here.
Comment 6 Tristan Van Berkom 2016-05-11 21:56:34 UTC
Created attachment 123632 [details] [review]
Generate metadata in the makefile [version 4]

Oops, last patch forgot to change xdg-app -> flatpak in one place.
Comment 7 Alexander Larsson 2016-05-12 06:36:16 UTC
pushed to master and 1.4


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.