r604 - /scripts/supported_platforms.php

fst-guest at users.alioth.debian.org fst-guest at users.alioth.debian.org
Mon Mar 19 11:43:13 CET 2007


Author: fst-guest
Date: Mon Mar 19 10:43:13 2007
New Revision: 604

URL: http://svn.debian.org/wsvn/pkg-boinc/?sc=1&rev=604
Log:
Added script that creates the overview table for
http://wiki.debian.org/BOINC/Projects. This needs PHP 5.

Added:
    scripts/supported_platforms.php   (with props)

Added: scripts/supported_platforms.php
URL: http://svn.debian.org/wsvn/pkg-boinc/scripts/supported_platforms.php?rev=604&op=file
==============================================================================
--- scripts/supported_platforms.php (added)
+++ scripts/supported_platforms.php Mon Mar 19 10:43:13 2007
@@ -1,0 +1,155 @@
+<?php
+/* $Id$ */
+
+$debian_platforms = array(
+    'alpha' => 'alpha-unknown-linux-gnu',
+    'amd64' => 'x86_64-pc-linux-gnu',
+    'arm' => 'arm-unknown-linux-gnu',
+    'hppa' => 'hppa-unknown-linux-gnu',
+    'i386' => 'i686-pc-linux-gnu',
+    'ia64' => 'ia64-unknown-linux-gnu',
+    'kfreebsd-amd64' => 'x86_64-pc-kfreebsd-gnu',
+    'kfreebsd-i386' => 'i486-pc-kfreebsd-gnu',
+    'm68k' => 'm68k-unknown-linux-gnu',
+    'mips' => 'mips-unknown-linux-gnu',
+    'mipsel' => 'mipsel-unknown-linux-gnu',
+    'powerpc' => 'powerpc-unknown-linux-gnu',
+    's390' => 's390-ibm-linux-gnu',
+    'sparc' => 'sparc-unknown-linux-gnu'
+);
+
+$projects = array(
+    'abc' => array('http://abcathome.com/', 'ABC at home'),
+    'bbc_cpdn' => array('http://bbc.cpdn.org/', 'BBC Climate Change'),
+    'boinc_alpha' => array('http://isaac.ssl.berkeley.edu/alpha/', 'BOINC alpha test'),
+    'burp' => array('http://burp.boinc.dk/', 'BURP'),
+    'chess960' => array('http://www.chess960athome.org/alpha/', 'Chess960 at Home'),
+    'cpdn' => array('http://climateprediction.net/', 'CPDN'),
+    'depspid' => array('http://www.depspid.net/', 'DepSpid'),
+    'docking' => array('http://docking.utep.edu/', 'Docking at Home'),
+    'einstein' => array('http://einstein.phys.uwm.edu/', 'Einstein at Home'),
+    'leiden' => array('http://boinc.gorlaeus.net/', 'Leiden Classical'),
+    'lhc' => array('http://lhcathome.cern.ch/', 'LHC at home'),
+    'malaria' => array('http://www.malariacontrol.net/', 'malaricontrol.net'),
+    'nano' => array('http://www.nanohive-1.org/atHome/', 'NanoHive at Home'),
+    'pirates' => array('http://pirates.spy-hill.net/', 'Pirates at Home'),
+    'predictor' => array('http://predictor.scripps.edu/', 'Predictor at Home'),
+    'prime' => array('http://www.primegrid.com/', 'PrimeGrid'),
+    'neuron' => array('http://neuron.mine.nu/neuron/', 'Project Neuron'),
+    'proteins' => array('http://biology.polytechnique.fr/proteinsathome/', 'proteins at home'),
+    'qmc' => array('http://qah.uni-muenster.de/', 'QMC at HOME'),
+    'ralph' => array('http://ralph.bakerlab.org/', 'RALPH at home'),
+    'rcn' => array('http://dist.ist.tugraz.at/cape5/', 'Rectilinear Crossing No.'),
+    'render' => array('http://server2.povaddict.com.ar/pov/', 'RenderFarm at Home'),
+    'riesel' => array('http://boinc.rieselsieve.com/', 'RieselSieve'),
+    'rosetta' => array('http://boinc.bakerlab.org/rosetta/', 'Rosetta at home'),
+    'seasonal' => array('http://attribution.cpdn.org/', 'Seasonal Attribution'),
+    'seti' => array('http://setiathome.berkeley.edu/', 'SETI at home'),
+    'seti_beta' => array('http://setiweb.ssl.berkeley.edu/beta/', 'SETI at home'),
+    'simap' => array('http://boinc.bio.wzw.tum.de/boincsimap/', 'SIMAP'),
+    'spinhenge' => array('http://spin.fh-bielefeld.de/', 'Spinhenge at home'),
+    'sztaki' => array('http://szdg.lpds.sztaki.hu/szdg/', 'SZTAKI Desktop Grid'),
+    'tanpaku' => array('http://issofty17.is.noda.tus.ac.jp/', 'TANPAKU'),
+    'drtg' => array('http://hashbreaker.com:8700/tmrldrtg/', 'TMRL DRTG'),
+    'ufludis' => array('http://www.ufluids.net/', 'uFluids'),
+    'vtu' => array('http://boinc.vtu.lt/vtuathome/', 'vtu at home'),
+    'wcg' => array('http://www.worldcommunitygrid.org/', 'World Community Grid'),
+    'xtrem' => array('http://xw01.lri.fr:4320/', 'XtremLab')
+);
+
+$cfg_dir = 'projects_cfg';
+
+function cfg_file($project) {
+    global $cfg_dir;
+    return $cfg_dir.'/'.$project.'_config.xml';
+}
+
+function get_project_configs($projects, $force_update = false) {
+    global $cfg_dir;
+    if (! is_dir($cfg_dir))
+        mkdir($cfg_dir);
+
+    // Only update project configs if $cfg_dir was last accessed more
+    // than 12h ago.
+    if ((time() - fileatime($cfg_dir)) < 12*3600 and !$force_update)
+        return;
+
+    foreach ($projects as $key => $project) {
+        copy($project[0].'/get_project_config.php', cfg_file($key));
+    }
+}
+
+function get_supported_platforms($projects) {
+    $supported_platforms = array();
+
+    foreach ($projects as $key => $project) {
+        $cfg_file = cfg_file($key);
+        if (! file_exists($cfg_file) or filesize($cfg_file) < 64)
+            continue;
+
+        $supported_platforms[$key] = array();
+
+        $cfg_xml = simplexml_load_file($cfg_file);
+
+        // Continue if the config file does not contain the platforms element.
+        if (! $cfg_xml->platforms)
+            continue;
+
+        $platforms = array();
+        foreach ($cfg_xml->platforms[0] as $platform) {
+            array_push($platforms, (string) $platform);
+        }
+        $supported_platforms[$key] = $platforms;
+    }
+    return $supported_platforms;
+}
+
+function get_supported_debian_platforms($supported_platforms, $debian_platforms) {
+    $supported_debian_platforms = array();
+    foreach ($supported_platforms as $project => $platforms) {
+        $supported_debian_platforms[$project] = array_intersect_key(
+            array_flip($debian_platforms), array_flip($platforms));
+    }
+    return $supported_debian_platforms;
+}
+
+function print_debian_wiki_table($projects, $supported_debian_platforms) {
+    global $debian_platforms;
+
+    // Create table headline with all Debian architectures.
+    $out = '|| ||';
+    foreach ($debian_platforms as $arch => $platform)
+        $out .= ' '.$arch.' ||';
+    $out .= "\n";
+
+    // Create a row for each project.
+    foreach ($supported_debian_platforms as $project => $platforms) {
+        $out .= sprintf('|| [%s %s] ||', $projects[$project][0],
+            $projects[$project][1]);
+
+        foreach ($debian_platforms as $arch => $platform) {
+            if (in_array($arch, $platforms))
+                $out .= '<style="background-color: #80FF80; '
+                     .  'text-align: center;">x||';
+            else
+                $out .= ' ||';
+        }
+        $out .= "\n";
+    }
+    print $out;
+}
+
+// main program logic
+
+get_project_configs($projects);
+
+$supported_platforms = get_supported_platforms($projects);
+
+$supported_debian_platforms = get_supported_debian_platforms(
+    $supported_platforms, $debian_platforms);
+
+print "<pre>\n";
+print_debian_wiki_table($projects, $supported_debian_platforms);
+print "</pre>\n";
+
+?>

Propchange: scripts/supported_platforms.php
------------------------------------------------------------------------------
    svn:keywords = Id




More information about the pkg-boinc-commits mailing list