Expander: also read rules from data directories

* ExpanderSettings: Use a settings directory "expander" and rename
  settings file to "settings".
* ExpanderRules: Read expander rules from "rules" files in the settings
  directory, then from files in expander/rules subdirectories of the
  installation location data directories, and finally add the built-in
  rules. This allows packages to provide expander rules (as already
  done by the p7zip package).
* OptionalPackages: Remove AddExpanderRuleToHaikuImage invocations.
* ImageRules: Remove Expander rule file related rules.
This commit is contained in:
Ingo Weinhold
2013-06-30 13:29:48 +02:00
parent 2cf916cbe2
commit 301f4b463a
6 changed files with 149 additions and 162 deletions
-37
View File
@@ -1098,43 +1098,6 @@ rule AddGroupToHaikuImage group : gid : members
AddEntryToHaikuImageUserGroupFile <haiku-image>group : $(entry) ;
}
rule AddEntryToHaikuImageExpanderRuleFile file : entry
{
local allEntries
= [ on $(file) return $(HAIKU_IMAGE_EXPANDER_RULES_ENTRIES) ] ;
if $(allEntries) {
allEntries = $(allEntries)!$(entry) ;
} else {
allEntries = $(entry) ;
Always $(file) ;
MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
BuildHaikuImageExpanderRules $(file) ;
AddFilesToHaikuImage common data : $(file) ;
}
HAIKU_IMAGE_EXPANDER_RULES_ENTRIES on $(file) = $(allEntries) ;
}
actions BuildHaikuImageExpanderRules
{
echo -e "$(HAIKU_IMAGE_EXPANDER_RULES_ENTRIES)" | tr '!' '\n' > $(1)
}
rule AddExpanderRuleToHaikuImage mimetype : extension : list : extract
{
#AddExpanderRuleToHaikuImage <mimetype> : <extension> : <list> : <extract>
if ! $(mimetype) || ! $(extension) || ! $(list) || ! $(extract) {
Exit "Invalid expander rule specification passed to AddExpanderRule." ;
}
local entry
= "\\\"$(mimetype)\\\"\\\t$(extension)\\\t\\\"$(list)\\\"\\\t\\\"$(extract)\\\"" ;
AddEntryToHaikuImageExpanderRuleFile <haiku-image>expander.rules
: $(entry) ;
}
rule AddOptionalPackageDescriptionToHaikuImage file : searchPath
{
-19
View File
@@ -1597,11 +1597,6 @@ if [ IsOptionalHaikuImagePackageAdded P7zip ] {
InstallOptionalHaikuImagePackage
$(baseURL)/p7zip-9.20.1-x86_64-2012-12-08.zip ;
}
AddExpanderRuleToHaikuImage "application/x-7z-compressed" : .7z
: "7za l \\0045s"
: "7za x -y \\0045s"
;
} else {
Echo "No optional package P7zip available for $(TARGET_ARCH)" ;
}
@@ -2160,20 +2155,6 @@ if [ IsOptionalHaikuImagePackageAdded XZ-Utils ] {
Echo "No optional package XZ-Utils available for gcc"
$(HAIKU_GCC_VERSION[1]) ;
}
# TODO: Move rules into package!
# AddExpanderRuleToHaikuImage "application/x-xz" : .tar.xz
# : "tar -Jtvf \\0045s"
# : "tar -Jxvf \\0045s"
# ;
# AddExpanderRuleToHaikuImage "application/x-xz" : .txz
# : "tar -Jtvf \\0045s"
# : "tar -Jxvf \\0045s"
# ;
# AddExpanderRuleToHaikuImage "application/x-xz" : .xz
# : "echo \\0045s | sed 's/.xz\\\$//g'"
# : "xz -df \\0045s"
# ;
} else {
Echo "No optional package XZ-Utils available for $(TARGET_ARCH)" ;
}