SF.net SVN: morphix: [2357] trunk/mmaker
[email protected] Thu, 13 Jul 2006 07:03:52 -0700
| Newsgroups | gmane.linux.morphix.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2357
Author: alextreme
Date: 2006-07-13 07:03:43 -0700 (Thu, 13 Jul 2006)
ViewCVS: http://svn.sourceforge.net/morphix/?rev=2357&view=rev
Log Message:
-----------
* adding experimental localdeb-tag, as yet untested...
Modified Paths:
--------------
trunk/mmaker/README.template
trunk/mmaker/libmorphix/makemodule.c
trunk/mmaker/libmorphix/parsemod.c
trunk/mmaker/libmorphix/parsemod.h
Modified: trunk/mmaker/README.template
===================================================================
--- trunk/mmaker/README.template 2006-07-13 13:36:12 UTC (rev 2356)
+++ trunk/mmaker/README.template 2006-07-13 14:03:43 UTC (rev 2357)
@@ -17,7 +17,7 @@
<description>possibly multiline description of module</description>
- <type>[mainmod|basemod|minimod]</type> (
+ <type>[mainmod|basemod|minimod]</type>
<!-- currently only main/basemod are useful -->
<suite>[sid|sarge|woody|unstable|testing|stable]</suite>
@@ -62,15 +62,21 @@
...
</packagelist>
+ <localdeblist>
+
+ <localdeb>/path/to/package.deb</localdeb>
+ <!-- this package from the host system is copied into the build directory and installed using dpkg -i. It is removed afterwards -->
+ </localdeblist>
+
<patchlist>
- <patch>path/to/shellscript.sh</patch> (
- <!-- shell script on host system, gets copied into the root of the build directory and is executed -->
+ <patch>path/to/shellscript.sh</patch>
+ <!-- shell script on host system, gets copied into the root of the build directory and is executed. It is removed afterwards -->
</patchlist>
<commandlist>
- <command>echo "Real Morphers idle on #morphix"</command> (
+ <command>echo "Real Morphers idle on #morphix"</command>
<!-- shell command run in the build chroot, just before compressing -->
</commandlist>
Modified: trunk/mmaker/libmorphix/makemodule.c
===================================================================
--- trunk/mmaker/libmorphix/makemodule.c 2006-07-13 13:36:12 UTC (rev 2356)
+++ trunk/mmaker/libmorphix/makemodule.c 2006-07-13 14:03:43 UTC (rev 2357)
@@ -565,15 +565,59 @@
}
/**
+ Copies one or more packages from the host system and installs these
+ using dpkg -i (ie. no dependancies are resolved!)
+
+ @param module mmodule*; module structure, initialised
+
+ return TRUE if successful, FALSE and message to stderr if an error occurred
+*/
+
+gboolean installLocalPackages(mmodule *module) {
+ GList *ptr = module->localdeblist;
+ while (ptr != NULL) {
+ gchar *cmdline = NULL;
+ gchar *basename = g_path_get_basename(ptr->data);
+
+ if (basename == NULL)
+ continue;
+
+ cmdline = g_strdup_printf("cp %s %s/%s",ptr->data,module->dirname,basename);
+ if (!ExecuteCommand(cmdline)) {
+ fprintf(stderr,"Warning: unable to copy package into build directory\n");
+ g_free(basename);
+ g_free(cmdline);
+ continue;
+ }
+ g_free(cmdline);
+
+ cmdline = g_strdup_printf("%s %s dpkg -i /%s",P_CHROOT,module->dirname,basename);
+ if (!ExecuteCommand(cmdline)) {
+ fprintf(stderr,"Warning: unable to install local package: %s\n",ptr->data);
+ }
+ g_free(cmdline);
+
+
+ cmdline = g_strdup_printf("%s %s rm /%s",P_CHROOT,module->dirname,basename);
+ if (!ExecuteCommand(cmdline)) {
+ fprintf(stderr,"Warning: unable to remove local package after installation: %s\n",ptr->data);
+ }
+
+ g_free(cmdline);
+ g_free(basename);
+ ptr = ptr->next;
+ }
+ return TRUE;
+}
+
+/**
Executes shell scripts, defined in the xml file.
- Gives the location of the uncompressed module as the script's first argument
+ For security reasons, the script is executed in the chroot
+ (it is copied into the root of the build directory before execution)
@param module mmodule*; module structure, initialised
@param dirname gchar*; location of the directory
- this needs fixing, as executing stuff as root from a file is evil...
- Gandalfar will slap me for this
-
return TRUE if successful, FALSE and message to stderr if an error occurred
*/
@@ -600,6 +644,12 @@
fprintf(stderr,"Warning: unable to execute patch: %s\n",ptr->data);
}
g_free(cmdline);
+
+ cmdline = g_strdup_printf("%s %s rm /%s",P_CHROOT,module->dirname,basename);
+ if (!ExecuteCommand(cmdline)) {
+ fprintf(stderr,"Warning: unable to remove patch script after executing it: %s\n",ptr->data);
+ }
+ g_free(cmdline);
g_free(basename);
ptr = ptr->next;
}
@@ -1211,6 +1261,9 @@
if (!addPackagesMainModule(module, extra_package_list)) {
return FALSE;
}
+ if (!installLocalPackages(module)) {
+ return FALSE;
+ }
if (!executeRetrieveFiles(module)) {
return FALSE;
}
@@ -1237,6 +1290,9 @@
if (!addPackagesBaseModule(module, extra_package_list)) {
return FALSE;
}
+ if (!installLocalPackages(module)) {
+ return FALSE;
+ }
if (!moveMorphixEtcFiles(module)) {
return FALSE;
}
Modified: trunk/mmaker/libmorphix/parsemod.c
===================================================================
--- trunk/mmaker/libmorphix/parsemod.c 2006-07-13 13:36:12 UTC (rev 2356)
+++ trunk/mmaker/libmorphix/parsemod.c 2006-07-13 14:03:43 UTC (rev 2357)
@@ -236,6 +236,21 @@
return module;
}
+mmodule* parseLocalDeblist(xmlDocPtr doc, xmlNodePtr cur, mmodule *module) {
+ xmlChar *key;
+ cur = cur->xmlChildrenNode;
+ module->localdeblist = NULL;
+ while (cur != NULL) {
+ if (!xmlStrcmp(cur->name, ((const xmlChar *)"localdeb"))) {
+ key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+ module->localdeblist = g_list_append(module->localdeblist,g_strdup(key));
+ xmlFree(key);
+ }
+ cur = cur->next;
+ }
+ return module;
+}
+
mmodule* parseCommandlist(xmlDocPtr doc, xmlNodePtr cur, mmodule *module) {
xmlChar *key;
cur = cur->xmlChildrenNode;
@@ -328,6 +343,9 @@
if (!xmlStrcmp(cur->name, ((const xmlChar *)"patchlist"))) {
parsePatchlist(doc,cur,module);
}
+ if (!xmlStrcmp(cur->name, ((const xmlChar *)"localdeblist"))) {
+ parseCommandlist(doc,cur,module);
+ }
if (!xmlStrcmp(cur->name, ((const xmlChar *)"commandlist"))) {
parseCommandlist(doc,cur,module);
}
@@ -418,6 +436,14 @@
}
g_list_free(module->commandlist);
}
+ if (module->localdeblist != NULL) {
+ GList *ptr = module->localdeblist;
+ while (ptr != NULL) {
+ g_free(ptr->data);
+ ptr = ptr->next;
+ }
+ g_list_free(module->localdeblist);
+ }
g_free(module);
}
Modified: trunk/mmaker/libmorphix/parsemod.h
===================================================================
--- trunk/mmaker/libmorphix/parsemod.h 2006-07-13 13:36:12 UTC (rev 2356)
+++ trunk/mmaker/libmorphix/parsemod.h 2006-07-13 14:03:43 UTC (rev 2357)
@@ -49,6 +49,7 @@
GList *packagedeletelist; // list of package structs
GList *patchlist; // list of names of patches for module
GList *commandlist; // list of commands for module
+ GList *localdeblist; // list of locations of packages on host
GList *retrievelist; // list of to/from combinations
gboolean verbose; // build verbosely
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642