From: Mark Huang Date: Wed, 27 Oct 2004 04:36:49 +0000 (+0000) Subject: Generates XML manifest of packages for X-Git-Tag: planetlab-3_0-branch-point~9 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0ca101b095512a30292e4d0061ef4de01e780e26;p=build.git Generates XML manifest of packages for http://www.planet-lab.org/Software/download.php --- diff --git a/packages.sh b/packages.sh new file mode 100755 index 00000000..1b909dad --- /dev/null +++ b/packages.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# +# Generates XML manifest of packages for +# http://www.planet-lab.org/Software/download.php +# +# Mark Huang +# Copyright (C) 2004 The Trustees of Princeton University +# +# $Id$ +# + +xml_escape_pcdata() { + # & to & + # " to \" + # ' to ' + # < to < + # > to > + sed \ + -e 's/\&/\&/g' | sed \ + -e 's/"/\"/g' \ + -e "s/'/\'/g" \ + -e 's//\>/g' +} + +xml_escape_cdata() { + # & to & + # \ to \\ + # " to \" + # ' to ' + # < to < + # > to > + sed \ + -e 's/\&/\&/g' \ + -e 's/\\/\\\\/g' | sed \ + -e 's/"/\\"/g' \ + -e "s/'/\'/g" \ + -e 's//\>/g' +} + +# All supported tags +TAGS=$(rpm --querytags) + +cat < + + + + + +]> + +EOF + +# For every RPM in the current directory +RPMS=$(find ${1-.} -name '*.rpm') +for rpm in $RPMS ; do + +cat < + $(basename $rpm | xml_escape_pcdata) + +EOF + +done + +cat < +EOF