shithub: news2atom

Download patch

ref: ae153891bc9365a47b3c74cd314dd12762e96aae
parent: fb5ab9787a06b5ab0002147c94957a65782607f9
author: sirjofri <[email protected]>
date: Fri Apr 30 11:02:07 EDT 2021

adds git2news and readme

--- /dev/null
+++ b/README
@@ -1,0 +1,11 @@
+news2atom
+
+...generates a atom feed file from /lib/news
+
+news2html
+
+...generates a simple html file from /lib/news
+
+git2news
+
+...generates a /lib/news directory for each branch in the current /mnt/git (ori's gitfs)
--- /dev/null
+++ b/git2news
@@ -1,0 +1,41 @@
+#!/bin/rc
+
+rfork en
+
+fn fatal{
+	echo $* >[1=2]
+	exit $"*
+}
+
+fn printlog{
+	br=$1
+	mkdir -p $dir/$br
+	hash=`{cat /mnt/git/branch/heads/$br/hash}
+	while(~ $#hash 1){
+		echo $hash
+		msg=`{cat /mnt/git/object/$hash/msg}
+		author=`{cat /mnt/git/object/$hash/author}
+		parent=`{cat /mnt/git/object/$hash/parent}
+		date=`{mtime /mnt/git/object/$hash/msg | awk '{print $1}'}
+		cdate=`{date $date}
+		>$dir/$br/$hash {
+			echo 'author:   ' $author
+			echo 'parent:   ' $parent
+			echo 'date:     ' $cdate
+			echo 'msg:      ' $msg
+		}
+		touch -t $date $dir/$br/$hash
+		hash=$parent
+	}
+}
+
+test -r /mnt/git/ctl || fatal no gitfs running
+
+dir=/lib/news
+~ $#1 0 || dir=$1
+
+branches=`{ls -p /mnt/git/branch/heads}
+
+~ $#branches 0 && fatal no branches found
+
+for(branch in $branches) printlog $branch