[haiku-commits] r35906 - haiku/trunk/data/bin

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 18 Mar 2010 18:14:19 +0100 (CET)

Author: mmadia
Date: 2010-03-18 18:14:19 +0100 (Thu, 18 Mar 2010)
New Revision: 35906
Changeset: http://dev.haiku-os.org/changeset/35906/haiku

Modified:
   haiku/trunk/data/bin/installoptionalpackage
Log:
Implemented support for AddExpanderRuleToHaikuImage. Now P7zip and XZ-Utils can
be installed properly.


Modified: haiku/trunk/data/bin/installoptionalpackage
===================================================================
--- haiku/trunk/data/bin/installoptionalpackage 2010-03-18 16:58:19 UTC (rev 
35905)
+++ haiku/trunk/data/bin/installoptionalpackage 2010-03-18 17:14:19 UTC (rev 
35906)
@@ -30,7 +30,7 @@
 # Some Packages cannot be installed,
 # as they require either the source code or compiled binaries
 declare packageIgnoreList='Bluetooth Development DevelopmentMin \
-DevelopmentBase P7zip UserlandFS Welcome Wifi-ipw2100+fw Wifi-iprowifi2200+fw \
+DevelopmentBase UserlandFS Welcome Wifi-ipw2100+fw Wifi-iprowifi2200+fw \
 WifiFirmwareScriptData'
 
 
@@ -52,6 +52,10 @@
 $sslPkgLine
 $sslUrlLine
 declare -a functionArgs
+expanderRulesFile=`finddir B_COMMON_DATA_DIRECTORY`/expander.rules
+if [ -f \${expanderRulesFile} ] ; then
+       expanderRulesFileExists=1
+fi
 
 
 function ParseFunctionArguments()
@@ -233,6 +237,49 @@
 }
 
 
+function AddExpanderRuleToHaikuImage()
+{
+       # AddExpanderRuleToHaikuImage <mimetype> : <extension> : <list> : 
<extract>
+       # Wrapper for Jam rule  
+       ParseFunctionArguments "\$@"
+       
+       local mimetype=\${functionArgs[0]}
+       local extension=\${functionArgs[1]}
+       local list=\${functionArgs[2]}
+       local extract=\${functionArgs[3]}
+
+       # clean up the variables        
+       TrimLeadingSpace mimetype
+       TrimEndingSpace mimetype
+       TrimLeadingSpace extension
+       TrimEndingSpace extension
+       TrimLeadingSpace list
+       TrimEndingSpace list
+       TrimLeadingSpace extract
+       TrimEndingSpace extract
+       local rule_raw="\${mimetype}\\t\${extension}\\t\${list}\\t\${extract}"
+       
+       # reset this at every invocation
+       ruleFound=
+               
+       if [ \${expanderRulesFileExists} ] ; then
+               # Check if a rule for the mimetype & extension exists.
+               while read line ; do 
+                       existing_rule=`echo \$line | awk '{ print \$1\$2 }'`
+                       if [ "\${mimetype}\${extension}" == "\${existing_rule}" 
] ; then
+                               ruleFound=1
+                               break
+                       fi      
+               done < "\${expanderRulesFile}"
+       fi
+       if ! [ \${expanderRulesFileExists} ] || ! [ \${ruleFound} ] ; then
+               # Either expander.rules does not exist or a rule for mimetype & 
+               # extension does not exist. Output the new rule directly to it.
+               echo -e \${rule_raw} >> \${expanderRulesFile}
+       fi
+}
+
+
 EOF
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cat ${tmpDir}/optpkg.stage2 >> ${tmpDir}/install-optpkg.sh
@@ -531,6 +578,11 @@
                        if($0~/\;/) ORS="\n"; 
                        else ORS=" "; print 
                }
+               /AddExpanderRuleToHaikuImage/,/\;/{
+                       isRule=1; 
+                       if($0~/\;/) ORS="\n"; 
+                       else ORS=" "; print                     
+               }
                /Exit/,/\;/{
                        isRule=1;
                        if($0~/\;/) ORS="\n"; 


Other related posts:

  • » [haiku-commits] r35906 - haiku/trunk/data/bin - mattmadia