r1647 - in dev/concept/moongoo: . libalfs syntax

neocool at linuxfromscratch.org neocool at linuxfromscratch.org
Sun Dec 12 17:01:25 PST 2004


Author: neocool
Date: 2004-12-12 18:01:23 -0700 (Sun, 12 Dec 2004)
New Revision: 1647

Modified:
   dev/concept/moongoo/Makefile
   dev/concept/moongoo/libalfs/alfs.c
   dev/concept/moongoo/libalfs/alfs.h
   dev/concept/moongoo/libalfs/gen.c
   dev/concept/moongoo/libalfs/parse.c
   dev/concept/moongoo/libalfs/parse.h
   dev/concept/moongoo/moongoo.c
   dev/concept/moongoo/syntax/blfs.c
   dev/concept/moongoo/syntax/book.c
   dev/concept/moongoo/syntax/nalfs.c
   dev/concept/moongoo/syntax/syn.c
   dev/concept/moongoo/url.c
Log:
Update.


Modified: dev/concept/moongoo/Makefile
===================================================================
--- dev/concept/moongoo/Makefile	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/Makefile	2004-12-13 01:01:23 UTC (rev 1647)
@@ -4,11 +4,11 @@
 OBJS=build.o moongoo.o plugin.o url.o
 
 ifeq ($(OPTS),)
-OPTS=-s nalfs
+OPTS=-s syn
 #OPTS+=~/projects/alfs/book/index.xml
-OPTS+=~/projects/alfs/lfs-profile/LFS.xml
+#OPTS+=~/projects/alfs/lfs-profile/LFS.xml
 #OPTS+=~/projects/alfs/ass/index.xml
-#OPTS+=~/projects/hive/unstable/profile.xml
+OPTS+=~/projects/hive/unstable/profile.xml
 #OPTS+=~/projects/alfs/blfs/index.xml
 #OPTS+=~/projects/alfs/hlfs/index.xml
 #OPTS+=~/projects/alfs/book-rng/index.xml

Modified: dev/concept/moongoo/libalfs/alfs.c
===================================================================
--- dev/concept/moongoo/libalfs/alfs.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/libalfs/alfs.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -2,6 +2,7 @@
 #include <unistd.h>
 
 #include <alfs.h>
+#include <gen.h>
 #include <util.h>
 
 bool colors = true;
@@ -491,3 +492,18 @@
 	
 	return NULL;
 }
+
+bool is_unpackable (char *url)
+{
+	int i;
+	char *ext = extonly(url);
+
+	for (i=0;i<NUM_COMPR;i++)
+	{
+		char *tst = strdog(".tar", (char *)compr[i]);
+		if (!strcmp(tst, ext))
+			return true;
+	}
+
+	return false;
+}

Modified: dev/concept/moongoo/libalfs/alfs.h
===================================================================
--- dev/concept/moongoo/libalfs/alfs.h	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/libalfs/alfs.h	2004-12-13 01:01:23 UTC (rev 1647)
@@ -119,5 +119,6 @@
 char *proto2str (protocol proto);
 role parse_role (xmlNodePtr node);
 protocol parse_proto (xmlNodePtr node);
+bool is_unpackable (char *url);
 	
 #endif

Modified: dev/concept/moongoo/libalfs/gen.c
===================================================================
--- dev/concept/moongoo/libalfs/gen.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/libalfs/gen.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -1,4 +1,4 @@
 #include <gen.h>
 
 const char *compr[NUM_COMPR] = { ".bz2", ".gz" };
-const char *unpck[NUM_COMPR] = { "tar xfz ", "tar xfj " };
+const char *unpck[NUM_COMPR] = { "tar xfj ", "tar xfz " };

Modified: dev/concept/moongoo/libalfs/parse.c
===================================================================
--- dev/concept/moongoo/libalfs/parse.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/libalfs/parse.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -5,6 +5,16 @@
 #include <parse.h>
 #include <util.h>
 
+package *cur_pkg (profile *prof)
+{
+	int i, j;
+
+	i = prof->n-1;
+	j = prof->ch[i].n-1;
+
+	return &prof->ch[i].pkg[j];
+}
+
 chapter *next_chpt (profile *prof)
 {
 	chapter *ch;
@@ -154,6 +164,9 @@
 	line = strkill(line, "\\\n");
 	line = strkill(line, "&&");
 
+	if (line[0]=='\n')
+		line++;
+
 	if (strcnt(line, "\n"))
 	{
 		char *tmp;
@@ -166,7 +179,8 @@
 				
 				if (!t)
 				{
-					fprintf(stderr, "Unterminated cat command.\n");
+					fprintf(stderr, "Unterminated cat command in %s.\n",
+						cur_pkg(prof)->name);
 					parse_cmd(prof, line, node);
 				}
 				else
@@ -212,7 +226,7 @@
 	
 	if (!ret)
 	{
-		// TODO: Add support for missing archive types
+		// XXX: Add support for missing archive types
 		//fprintf(stderr, "Archive extension '%s' is unknown.\n", ext);
 		return;
 	}

Modified: dev/concept/moongoo/libalfs/parse.h
===================================================================
--- dev/concept/moongoo/libalfs/parse.h	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/libalfs/parse.h	2004-12-13 01:01:23 UTC (rev 1647)
@@ -3,6 +3,8 @@
 
 #include <alfs.h>
 
+package *cur_pkg (profile *prof);
+
 chapter *next_chpt (profile *prof);
 command *next_cmd (profile *prof);
 dep *next_dep (profile *prof);

Modified: dev/concept/moongoo/moongoo.c
===================================================================
--- dev/concept/moongoo/moongoo.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/moongoo.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -129,14 +129,16 @@
 
 	if (!quiet)
 	{
-		/*package *glibc = search_pkg(prof, "glibc", 
-			"chapter-building-system");*/
+		//package *glibc = search_pkg(prof, "glibc", "chapter-building-system");
 		//package *gtk = search_pkg(prof, "gtk+", "x-lib");
 		//package *glib = search_pkg(prof, "glib", "general-genlib");
+		//package *gcc = search_pkg(prof, "gcc", "phase 2");
 		
 		sed_paralell (prof, paralell_filter, popt_pkg, popt_cmd);
 		set_filter(default_filter);
 	
+		/*if (gcc)
+			print_urls(*gcc);*/
 		/*if (glib)
 			//print_pkg(*glib);
 			print_urls(*glib);*/

Modified: dev/concept/moongoo/syntax/blfs.c
===================================================================
--- dev/concept/moongoo/syntax/blfs.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/syntax/blfs.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -27,7 +27,7 @@
 
 static void t_userinput (xmlNodePtr node, void *data)
 {
-	// TODO: Add all possible replaceables to moo.xml
+	// XXX: Add all possible replaceables to moo.xml
 	/*replaceable *r = (replaceable *)data;
 	foreach(node->children, "replaceable", (xml_handler_t)t_repl, r);*/
 	foreach(node->children, "command", (xml_handler_t)t_command, NULL);

Modified: dev/concept/moongoo/syntax/book.c
===================================================================
--- dev/concept/moongoo/syntax/book.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/syntax/book.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -25,7 +25,7 @@
 
 static void t_userinput (xmlNodePtr node, void *data)
 {
-	// TODO: <replaceable> problems w/ the RNG book
+	// XXX: <replaceable> problems w/ the RNG book
 	foreach(node->children, "replaceable", (xml_handler_t)t_repl, r);
 	parse_cmdblock(prof, node); 
 }

Modified: dev/concept/moongoo/syntax/nalfs.c
===================================================================
--- dev/concept/moongoo/syntax/nalfs.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/syntax/nalfs.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -5,7 +5,8 @@
 #include <util.h>
 #include <plugin.h>
 
-#define BUF_LEN		4096	// Needs to be big enough to hold parsed cats
+// Needs to be big enough to hold parsed cats
+#define BUF_LEN		4096
 
 profile *prof;
 char commando[BUF_LEN];

Modified: dev/concept/moongoo/syntax/syn.c
===================================================================
--- dev/concept/moongoo/syntax/syn.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/syntax/syn.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include <libalfs.h>
 #include <plugin.h>
 
@@ -17,19 +19,66 @@
 	return &syn_plugin;
 }
 
-// TODO: Complete syn support
-void t_shell (xmlNodePtr node, void *data)
+static void t_shell (xmlNodePtr node, void *data)
 {
 	parse_cmdblock(prof, node);
 }
 
+static void t_dl (xmlNodePtr node, void *data)
+{
+	download *dl = (download *)data;
+	
+	if (!strcmp(node->name, "http"))
+		dl->proto = HTTP;
+	else
+	if (!strcmp(node->name, "ftp"))
+		dl->proto = FTP;
+	else
+		fprintf(stderr, "Unknown protocol '%s'.\n", node->name);
+
+	dl->url = xmlNodeGetContent(node);
+
+	if (is_unpackable(dl->url))
+		parse_unpck(prof, dl->url, node);
+}
+
+static void t_item (xmlNodePtr node, void *data)
+{
+	download *dl = next_dl(prof);
+
+	dl->algo = SHA1;
+	dl->sum = xmlGetProp(node, "sha");
+	
+	foreach(node->children, "ftp", (xml_handler_t)t_dl, dl);
+	if (!dl->url)
+		foreach(node->children, "http", (xml_handler_t)t_dl, dl);
+}
+
+static void t_download (xmlNodePtr node, void *data)
+{
+	foreach(node->children, "item", (xml_handler_t)t_item, NULL);
+}
+
+static void t_dir (xmlNodePtr node, void *data)
+{
+	char *cwd = xmlGetProp(node, "cwd");
+
+	if ((cwd) && (!strcmp(cwd, "false")))
+		return;
+
+	parse_cmd(prof, strdog("__cd  ", xmlGetProp(node, "name")), NULL);
+}
+
 static void t_pkg (xmlNodePtr node, void *data)
 {
-	char *tmp = find_value(node, "title");
+	char *tmp = find_value(node->children, "title");
 	package *pkg = next_pkg(prof);
 
 	pkg->name = strcut(tmp, 0, whereis(tmp, ' '));
 	pkg->vers = find_value(node, "version");
+
+	foreach(node->children, "download", (xml_handler_t)t_download, NULL);
+	foreach(node->children, "directory", (xml_handler_t)t_dir, NULL);
 	foreach(node->children, "shell", (xml_handler_t)t_shell, NULL);
 
 	if (!pkg->n)

Modified: dev/concept/moongoo/url.c
===================================================================
--- dev/concept/moongoo/url.c	2004-12-12 22:42:49 UTC (rev 1646)
+++ dev/concept/moongoo/url.c	2004-12-13 01:01:23 UTC (rev 1647)
@@ -2,9 +2,8 @@
 
 #include <url.h>
 
-// TODO: No splitout GCC tarballs
-// TODO: Tcl URL is not yet found (tcl8.4.7-src.tar.gz)
-// TODO: Vim-lang will not be downloaded atm.
+// XXX: Tcl URL is not yet found (tcl8.4.7-src.tar.gz)
+// XXX: Vim-lang will not be downloaded atm.
 static void t_url (xmlNodePtr cur, void *data)
 {
 	profile *prof = (profile *)data;
@@ -35,10 +34,6 @@
 		snprintf(base, 512, "%s%s%s-%s.tar", xmlNodeGetContent(cur), vurl,
 			lower_case(pkg->name), pkg->vers);
 
-		// TODO: Remove this when the shadow-site is more responsive again
-		if (!strcmp(pkg->name, "Shadow"))
-			return;
-
 		for (i=0;i<NUM_COMPR;i++)
 		{
 			snprintf(url, 512, "%s%s", base, compr[i]);




More information about the alfs-log mailing list