anaconda/comps.awk
glen
cvs at pld-linux.org
Thu May 25 01:51:59 CEST 2006
Author: glen
Date: Thu May 25 01:51:57 2006
New Revision: 7438
Added:
anaconda/comps.awk (contents, props changed)
Log:
- preliminiary installer->comps.xml converter
Added: anaconda/comps.awk
==============================================================================
--- (empty file)
+++ anaconda/comps.awk Thu May 25 01:51:57 2006
@@ -0,0 +1,92 @@
+#!/bin/awk -f
+# parse comps.xml from pld-bootdisk/batch-installer/ui/data/groups
+# glen at pld-linux.org, 2006-05-25
+
+BEGIN {
+ print "<?xml version=\"1.0\"?>"
+ print "<!DOCTYPE comps PUBLIC \"-//Red Hat, Inc.//DTD Comps info//EN\" \"comps.dtd\">"
+ print "<comps>"
+
+ groupname = ""
+}
+
+END {
+ print "</comps>"
+}
+
+/^#/ {
+ next
+}
+
+#* 1 base `nls "Base packages"`
+/^\*/ {
+ # process pri=\d+
+ if (match($0, /"(.+)"/)) {
+ groupname = substr($0, RSTART + 1, RLENGTH - 2);
+ } else {
+ groupname = $0
+ }
+ default = $2
+ groupid = $3
+
+ print "\t<group>"
+ printf "\t\t<id>%s</id>\n", groupid
+ printf "\t\t<name>%s</name>\n", groupname
+ printf "\t\t<default>%s</default>\n", default ? "true" : "false"
+ print "\t\t<uservisible>true</uservisible>"
+ printf "\t\t<description>%s</description>\n", groupname
+ print "\t\t<packagelist>"
+ next
+}
+
+# empty line means end of group
+/^$/ {
+ if (groupname) {
+ print "\t\t</packagelist>"
+ print "\t</group>\n"
+ groupname = ""
+ }
+}
+
+# basearchonly desc:
+# http://www.redhat.com/archives/fedora-devel-list/2004-January/msg01214.html
+
+#@syslogdaemon syslog-ng syslog
+#@bootloader lilo grub
+#@crond vixie-cron hc-cron anacron
+#@rdate rdate rdate-bsd ntp-client
+/^@/ {
+ if (groupname) {
+ virtual = substr($0, 2);
+ pkgs = substr($0, 2 + length($1));
+
+ # no idea what to do with @virtuals so just split the components
+ # maybe subgroup them?
+
+ type = "default"
+ if (match(virtual, /^!/)) {
+ virtual = substr($0, 2);
+ type = "optional"
+ }
+
+ n = split(pkgs, pkga, / /);
+ for (i = 1; i <= n; i++) {
+ printf "\t\t\t<packagereq type=\"%s\">%s</packagereq>\n", type, pkga[i]
+ }
+
+ }
+ next
+}
+
+{
+ if (groupname) {
+ pkg = $0
+ type = "default"
+ type = "default"
+ if (match(pkg, /^!/)) {
+ pkg = substr($0, 2);
+ type = "optional"
+ }
+ printf "\t\t\t<packagereq type=\"%s\">%s</packagereq>\n", type, pkg
+ }
+}
More information about the pld-cvs-commit
mailing list