[php-apt-parser-maint] r18 - /branches/des/examples/packages.cgi

php-apt-parser-maint at lists.alioth.debian.org php-apt-parser-maint at lists.alioth.debian.org
Sun Jul 2 20:33:17 UTC 2006


Author: des-guest
Date: Sun Jul  2 20:33:16 2006
New Revision: 18

URL: http://svn.debian.org/wsvn/php-apt-parser/?sc=1&rev=18
Log:
Add support for a configuration file

Modified:
    branches/des/examples/packages.cgi

Modified: branches/des/examples/packages.cgi
URL: http://svn.debian.org/wsvn/php-apt-parser/branches/des/examples/packages.cgi?rev=18&op=diff
==============================================================================
--- branches/des/examples/packages.cgi (original)
+++ branches/des/examples/packages.cgi Sun Jul  2 20:33:16 2006
@@ -15,8 +15,11 @@
 <?
       include_once("parse-apt-files.inc");
 
-      $debarchiver_destdir= "/home/user/public_html/debian/dists";
-      $base_url= "http://example.com/~user/debian/";
+			$config = parse_ini_file("/etc/php-apt-parser/config.ini", TRUE);
+      $base_url= $config["base_url"];
+      unset($config["base_url"]);
+      $base_path= $config["base_path"];
+      unset($config["base_path"]);
 
 ?>
     <p>
@@ -30,43 +33,28 @@
       deb-src <?= $base_url ?> unstable main non-free contrib
     </pre>
     <p>
-      Of course you may need to s/unstable/testing/ or s/unstable/stable/ accordingly. Distribution names also work (i.e. sarge, etch, sid).
+      Of course you may need to change unstable to fit your distribution. Distribution names also work (i.e. sarge, etch, sid).
     </p>
-    <h2>Packages in unstable</h2>
-<?
-      parse_and_list(
-                     Array("$debarchiver_destdir/unstable/main/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/unstable/contrib/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/unstable/non-free/binary-i386/Packages.gz"),
-                     Array("$debarchiver_destdir/unstable/main/source/Sources.gz",
-                           "$debarchiver_destdir/unstable/contrib/source/Sources.gz",
-                           "$debarchiver_destdir/unstable/non-free/source/Sources.gz"),
-                           "$debarchiver_destdir/unstable/installed",
-                           "$debarchiver_destdir/../build_logs");
-?>
-    <h2>Packages in testing</h2>
-<?
-      parse_and_list(
-                     Array("$debarchiver_destdir/testing/main/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/testing/contrib/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/testing/non-free/binary-i386/Packages.gz"),
-                     Array("$debarchiver_destdir/testing/main/source/Sources.gz",
-                           "$debarchiver_destdir/testing/contrib/source/Sources.gz",
-                           "$debarchiver_destdir/testing/non-free/source/Sources.gz"),
-                           "$debarchiver_destdir/testing/installed",
-                           "$debarchiver_destdir/../build_logs");
-?>
-    <h2>Packages in stable</h2>
-<?
-      parse_and_list(
-                     Array("$debarchiver_destdir/stable/main/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/stable/contrib/binary-i386/Packages.gz",
-                           "$debarchiver_destdir/stable/non-free/binary-i386/Packages.gz"),
-                     Array("$debarchiver_destdir/stable/main/source/Sources.gz",
-                           "$debarchiver_destdir/stable/contrib/source/Sources.gz",
-                           "$debarchiver_destdir/stable/non-free/source/Sources.gz"),
-                           "$debarchiver_destdir/stable/installed",
-                           "$debarchiver_destdir/../build_logs");
-?>
+		<?
+		foreach($config as $distribution => $keys) {
+		 $path = $base_path . $keys["packages_dir"];
+		 $arch = $keys["arch"] ? $keys["arch"] : "i386";
+		 $sections = explode(",", $keys["sections"]);
+		 $changes = $base_path . $keys["changes_dir"];
+		 $logs = $base_path . $keys["buildlogs_dir"];
+		 $packages = Array();
+		 $sources = Array();
+		  foreach($sections as $section) {
+			 array_push($packages , $path . "/" . $section . "/binary-" . $arch . "/Packages.gz");
+			 array_push($sources , $path . "/" . $section . "/source/" . "Sources.gz");
+			}
+		?>
+			<h2>Packages in <?= $distribution ?></h2>
+			<?
+				parse_and_list($packages, $sources, $changes, $logs);
+			?>
+		<?
+		}
+		?>
   </body>
 </html>




More information about the php-apt-parser-maint mailing list