Opened 15 years ago
Closed 15 years ago
#5110 closed enhancement (fixed)
[patch] Configure option to install OptionalPackage's sources
Reported by: | mmadia | Owned by: | bonefish |
---|---|---|---|
Priority: | normal | Milestone: | R1/alpha2 |
Component: | Build System | Version: | R1/alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
This implements the build system aspect of optionally including source archives inside pre-built image, as per this mailing list suggestion.
It is activated via a configure flag "--include-sources" and sets a Jam variable "INCLUDE_SOURCES". For CD's the destination folder is "_packages_/". For all other image types, it is "develop/sources/".
As mentioned in the above mailing list thread, this patch will facilitate in the distribution of OptionalPackages' sources, which is particularly useful to ensure compliance with the various GPL licenses, especially when distributing on physical media.
A second patch is include to display functionality with respect to build/jam/OptionalPackages. For now, the source code resides in the root folder of Haiku-Files. If this patch is adopted, a path similar to http://haiku-files.org/files/optional-packages/sources/<year> could be used.
Attachments (3)
Change History (9)
follow-up: 2 comment:1 by , 15 years ago
comment:2 by , 15 years ago
Replying to bonefish:
Since DownloadSourceArchive is an exact copy of DownloadOptionalPackage save for not adding the file extension, I'd rather use a common base rule for both, respectively have one rule that doesn't add a file extension and let DownloadOptionalPackage just use it.
Is this along what you're thinking?
rule DownloadFileWIP file : url : directory { Echo "rule DownloadFileWIP: Being implemented..." ; # Request the download only once. if [ on $(file) return $(directory) ] { return $(file) ; } # TODO: how do i abstract this: # HAIKU_SOURCE_DOWNLOAD on $(file) = 1 ; # HAIKU_OPTIONAL_PACKAGE_DOWNLOAD on $(file) = 1 ; MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ; DownloadFile $(file) : $(url) ; return $(file) ; } rule DownloadSourceArchive file : url { # download archive local archiveFile = $(file:G=download) ; return [ DownloadFileWIP $(archiveFile) $(url) $(HAIKU_SOURCE_DOWNLOAD) ] ; } rule DownloadOptionalPackage package : url { # download zip file local zipFile = $(package:G=download).zip ; return [ DownloadFileWIP $(zipFile) $(url) $(HAIKU_OPTIONAL_PACKAGE_DOWNLOAD) ] ; }
comment:3 by , 15 years ago
More like (untested):
rule DownloadFile file : url { file = $(file:G=download) ; # Request the download only once. if [ on $(file) return $(HAIKU_FILE_DOWNLOAD) ] { return $(file) ; } HAIKU_FILE_DOWNLOAD on $(file) = 1 ; MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ; DownloadLocatedFile $(file) : $(url) ; return $(file) ; } rule DownloadOptionalPackage package : url { return [ DownloadFile $(package).zip : $(url) ] ; }
DownloadSourceArchive becomes superfluous, as it is equivalent to DownloadFile. I would even consider getting rid of DownloadOptionalPackage and use DownloadFile instead.
comment:4 by , 15 years ago
Two more things I would change:
- The build system variable INCLUDE_SOURCES should have the prefix "HAIKU_".
- For convenience I would rather check [HAIKU_]INCLUDE_SOURCES in the InstallSourceArchive rule, so it doesn't have to be done for each invocation of the rule.
If you want to, feel free to update the patch, otherwise I'll do that myself in the next days.
by , 15 years ago
Attachment: | IncludeSourcesOptionalPackageExample.patch added |
---|
updates for HAIKU_INCLUDE_SOURCES
comment:5 by , 15 years ago
To note, one thing this patch doesn't account for is the ability to automatically adjust the size of the image.
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch applied in hrev35617 with minor changes. Thanks!
Since DownloadSourceArchive is an exact copy of DownloadOptionalPackage save for not adding the file extension, I'd rather use a common base rule for both, respectively have one rule that doesn't add a file extension and let DownloadOptionalPackage just use it. Maybe name that rule DownloadFile and rename the current DownloadFile to DownloadTarget, DownloadLocatedFile, or something fitting.
InstallSourceArchive is incorrect. The source archives shouldn't be treated as packages when installing from CD. Wouldn't work anyway, if they aren't zip files.
In OptionalPackages: In the first hunk the file extension is missing from the first InstallSourceArchive parameter.