[oe-commits] org.oe.angstrom-2007.12-stable contrib feed-rss.php: php script that converts output from the feedsorter into rss

koen commit openembedded-commits at lists.openembedded.org
Mon Feb 25 19:49:12 UTC 2008


contrib feed-rss.php: php script that converts output from the feedsorter into rss
* see http://www.angstrom-distribution.org/feeds/2007/ipk/glibc/feed-rss.php for a demo

Author: koen at openembedded.org
Branch: org.openembedded.angstrom-2007.12-stable
Revision: e613c47425b665e04c730470f07577d43275464d
ViewMTN: http://monotone.openembedded.org/revision/info/e613c47425b665e04c730470f07577d43275464d
Files:
1
contrib/angstrom/feed-rss.php
Diffs:

#
# mt diff -r9e20bb1ea10584fc619d9e181acaedc9f29e8e49 -re613c47425b665e04c730470f07577d43275464d
#
# 
# 
# add_file "contrib/angstrom/feed-rss.php"
#  content [c39c1dc2a41598998a841fd28aec5b1e52f6529b]
# 
============================================================
--- contrib/angstrom/feed-rss.php	c39c1dc2a41598998a841fd28aec5b1e52f6529b
+++ contrib/angstrom/feed-rss.php	c39c1dc2a41598998a841fd28aec5b1e52f6529b
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This generator expects only log from the feed sorter in a simple format:
+ * TIME FILENAME <LIBC TYPE> 
+ *
+ * where TIME_OF_BUILD is epoch
+ *
+ * All what it does is parsing log and output it in reverse order (new packages 
+ * first) in RSS 2.0 format.
+ *
+ * (C) 2007 Marcin Juszkiewicz
+ * (C) 2008 Koen Kooi
+ *
+ * License: MIT
+ *
+ */
+
+$build_link_base = 'http://www.angstrom-distribution.org/repo/';
+
+$builder_log_date = file('upload.txt');
+
+if(empty($builder_log_date))
+	die("No logs\n");
+
+$builder_log_date = array_reverse($builder_log_date);
+
+$rss_xml = new xmlWriter();
+
+if(!$rss_xml)
+	die("Unable to create XML Writer\n");
+
+$rss_xml->openMemory();
+
+$rss_xml->startDocument('1.0','utf-8');
+$rss_xml->startElement('rss');
+$rss_xml->writeAttribute('version', '2.0');
+
+$rss_xml->startElement('channel');
+
+$rss_xml->writeElement('title', 'Ångström package repository updates');
+$rss_xml->writeElement('link', $build_link_base);
+$rss_xml->writeElement('description', 'Ångström feed updates list');
+
+foreach($builder_log_date as $build)
+{
+	$build = str_replace("\n", "", $build);
+	$data = explode(' ', $build);
+	# $date[1] is in the form of: angstrom-feed-configs-dbg_1.0-r3_palmz72.ipk
+        $pkgdata = explode('_', $data[1]);
+
+	$rss_xml->startElement('item');
+	$rss_xml->writeElement('title', "{$pkgdata[0]} {$pkgdata[1]} for {$pkgdata[2]}");
+	$rss_xml->writeElement('link', "{$build_link_base}?action=details&pnm={$pkgdata[0]}");
+	$rss_xml->writeElement('pubDate', date('r', $data[0]));
+
+	$rss_xml->endElement();
+}
+
+$rss_xml->endElement();
+$rss_xml->endElement();
+
+echo $rss_xml->outputMemory(true);   
+
+echo "\n";
+?>






More information about the Openembedded-commits mailing list