r1642 - in dev/concept/moongoo: . syntax

neocool at linuxfromscratch.org neocool at linuxfromscratch.org
Sat Dec 11 08:26:36 PST 2004


Author: neocool
Date: 2004-12-11 09:26:35 -0700 (Sat, 11 Dec 2004)
New Revision: 1642

Added:
   dev/concept/moongoo/syntax/blfs.c
Modified:
   dev/concept/moongoo/Makefile
   dev/concept/moongoo/moongoo.c
   dev/concept/moongoo/syntax/Makefile
   dev/concept/moongoo/syntax/book.c
   dev/concept/moongoo/syntax/sample.c
Log:
Update.


Modified: dev/concept/moongoo/Makefile
===================================================================
--- dev/concept/moongoo/Makefile	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/Makefile	2004-12-11 16:26:35 UTC (rev 1642)
@@ -4,11 +4,12 @@
 OBJS=build.o moongoo.o plugin.o url.o
 
 ifeq ($(OPTS),)
-OPTS=-q
-OPTS+=~/projects/alfs/book/index.xml
+OPTS=-s blfs
+#OPTS+=~/projects/alfs/book/index.xml
 #OPTS+=~/projects/alfs/lfs-profile/LFS.xml
 #OPTS+=~/projects/alfs/ass/index.xml
 #OPTS+=~/projects/hive/unstable/profile.xml
+OPTS+=~/projects/alfs/blfs/index.xml
 endif
 
 SUBDIRS=libalfs syntax

Modified: dev/concept/moongoo/moongoo.c
===================================================================
--- dev/concept/moongoo/moongoo.c	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/moongoo.c	2004-12-11 16:26:35 UTC (rev 1642)
@@ -123,14 +123,14 @@
 
 	if (!quiet)
 	{
-		package *glibc = search_pkg(prof, "glibc", 
-			"chapter-building-system");
+		/*package *glibc = search_pkg(prof, "glibc", 
+			"chapter-building-system");*/
 		sed_paralell (prof, paralell_filter, popt_pkg, popt_cmd);
 		set_filter(default_filter);
 		
-		if (glibc)
-			print_pkg(*glibc);
-		//print_profile(*prof);
+		/*if (glibc)
+			print_pkg(*glibc);*/
+		print_profile(*prof);
 		//print_links(*prof);
 	}
 

Modified: dev/concept/moongoo/syntax/Makefile
===================================================================
--- dev/concept/moongoo/syntax/Makefile	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/syntax/Makefile	2004-12-11 16:26:35 UTC (rev 1642)
@@ -1,12 +1,14 @@
 CFLAGS=-I../libalfs -I..
 
-LIBS=ass.so book.so nalfs.so syn.so
+LIBS=ass.so blfs.so book.so nalfs.so syn.so
+#LIBS+=sample.so
 
 all: $(LIBS)
 
 include ../inc.mak
 
 ass.so: ../libalfs/libalfs.a
+blfs.so: ../libalfs/libalfs.a
 book.so: ../libalfs/libalfs.a
 nalfs.so: ../libalfs/libalfs.a
 syn.so: ../libalfs/libalfs.a

Added: dev/concept/moongoo/syntax/blfs.c
===================================================================
--- dev/concept/moongoo/syntax/blfs.c	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/syntax/blfs.c	2004-12-11 16:26:35 UTC (rev 1642)
@@ -0,0 +1,144 @@
+#include <ctype.h>
+#include <string.h>
+
+#include <plugin.h>
+
+profile *prof;
+
+profile *parse_blfs (xmlNodePtr node, replaceable *r);
+
+static t_plug sample_plugin =
+{
+	name:	"BLFS book as profile",
+	vers:	PLUG_VER,
+	parse:	parse_blfs
+};
+
+t_plug *getplug ()
+{
+	return &sample_plugin;
+}
+
+static void process_cmd (char *line)
+{
+	int i, j, k;
+
+	i = prof->n-1;
+	j = prof->ch[i].n-1;
+	prof->ch[i].pkg[j].build = realloc(prof->ch[i].pkg[j].build,
+			(++prof->ch[i].pkg[j].n)*sizeof(command));
+	k = prof->ch[i].pkg[j].n-1;
+
+	prof->ch[i].pkg[j].build[k].role = ROLE_NONE;
+
+	
+	if (strcnt(line, " "))
+	{
+		prof->ch[i].pkg[j].build[k].cmd = strcut(line, 0, whereis(line, ' '));
+		prof->ch[i].pkg[j].build[k].arg = tokenize(notrail(strstr(line, " "), 
+				" "), " ", &prof->ch[i].pkg[j].build[k].n);
+	}
+	else
+	{
+		prof->ch[i].pkg[j].build[k].cmd = line;
+		prof->ch[i].pkg[j].build[k].arg = NULL;
+		prof->ch[i].pkg[j].build[k].n = 0;
+	}
+}
+
+static void t_command (xmlNodePtr node, void *data)
+{
+	char *line = squeeze(xmlNodeGetContent(node));
+	line = strkill(line, "\\\n");
+
+	if (strcnt(line, "\n"))
+	{
+		char *tmp;
+
+		while ((line) && (strlen(line)))
+		{
+			tmp = strsep(&line, "\n");
+			process_cmd(tmp);
+		}
+	}
+	else
+		process_cmd(line);
+}
+
+static void t_userinput (xmlNodePtr node, void *data)
+{
+	foreach(node->children, "command", (xml_handler_t)t_command, NULL);
+}
+
+static void t_sect1 (xmlNodePtr node, void *data)
+{
+	int i, j;
+	char *title, *tmp;
+
+	title = find_value(node->children, "title");
+
+	if (!title)
+	{
+		fprintf(stderr, "%s: No title found.\n", node->name);
+		return;
+	}
+
+	i = prof->n-1;
+	prof->ch[i].pkg = realloc(prof->ch[i].pkg, 
+			(++prof->ch[i].n)*sizeof(package));
+	j = prof->ch[i].n-1;
+
+	tmp = strrchr(title, '-');
+	if (tmp)
+	{
+		char *t = strnrchr(title, '-', 2);
+		if ((t) && (isdigit(t[1])))
+			tmp = strdog(t, tmp); 
+	}
+	tmp = chrep(tmp, ' ', '\0');
+	prof->ch[i].pkg[j].vers = tmp ? strcut(tmp, 1, strlen(tmp)) : NULL;
+	prof->ch[i].pkg[j].name = tmp ? strcut(title, 0, 
+		strlen(title)-strlen(tmp)) : title;
+	prof->ch[i].pkg[j].build = NULL;
+	prof->ch[i].pkg[j].n = 0;
+	foreach(node->children, "userinput", (xml_handler_t)t_userinput, NULL);
+
+	if (!prof->ch[i].pkg[j].n)
+		prof->ch[i].n--;
+}
+
+static void t_chapter (xmlNodePtr node, void *data)
+{
+	prof->ch = realloc(prof->ch, (++prof->n)*sizeof(chapter));
+	prof->ch[prof->n-1].name = find_value(node->children, "title");
+	prof->ch[prof->n-1].ref = xmlGetProp(node, "id");
+	prof->ch[prof->n-1].pkg = NULL;
+	prof->ch[prof->n-1].n = 0;
+	foreach(node->children, "sect1", (xml_handler_t)t_sect1, NULL);
+}
+
+static void t_part (xmlNodePtr node, void *data)
+{
+	foreach(node->children, "chapter", (xml_handler_t)t_chapter, NULL);
+}
+
+profile *parse_blfs (xmlNodePtr node, replaceable *r)
+{
+	xmlNodePtr info = find_node(node->children, "bookinfo");
+
+	if (strcmp(node->name, "book"))
+	{
+		fprintf(stderr, "XML document is not a valid BLFS profile.\n");
+		return NULL;
+	}
+
+	prof = (profile *)malloc(sizeof(profile));
+	prof->name = find_value(info->children, "title");
+	prof->vers = find_value(info->children, "subtitle");
+	prof->vers = strstr(prof->vers, " ");
+	prof->vers++;
+	prof->ch = NULL;
+	prof->n = 0;
+	foreach(node->children, "part", (xml_handler_t)t_part, NULL);
+	return prof;
+}

Modified: dev/concept/moongoo/syntax/book.c
===================================================================
--- dev/concept/moongoo/syntax/book.c	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/syntax/book.c	2004-12-11 16:26:35 UTC (rev 1642)
@@ -13,7 +13,7 @@
 
 static t_plug book_plugin =
 {
-	name:	"Book as profile",
+	name:	"LFS book as profile",
 	vers:	PLUG_VER,
 	parse:	bookasprofile
 };

Modified: dev/concept/moongoo/syntax/sample.c
===================================================================
--- dev/concept/moongoo/syntax/sample.c	2004-12-10 21:30:00 UTC (rev 1641)
+++ dev/concept/moongoo/syntax/sample.c	2004-12-11 16:26:35 UTC (rev 1642)
@@ -10,7 +10,7 @@
 
 #include <plugin.h>
 
-profile *parse_example (xmlNodePtr node);
+profile *parse_example (xmlNodePtr node, replaceable *r);
 
 static t_plug sample_plugin =
 {
@@ -24,7 +24,7 @@
 	return &sample_plugin;
 }
 
-profile *parse_example (xmlNodePtr node)
+profile *parse_example (xmlNodePtr node, replaceable *r)
 {
 	return NULL;
 }




More information about the alfs-log mailing list