|
From: <ale...@us...> - 2008-04-15 21:55:31
|
Revision: 2629
http://morphix.svn.sourceforge.net/morphix/?rev=2629&view=rev
Author: alextreme
Date: 2008-04-15 14:55:24 -0700 (Tue, 15 Apr 2008)
Log Message:
-----------
* fixed -s option for mmaker, added -s to isomaker (retrieve source packages after a module has been built, for all packages present in a module)
Modified Paths:
--------------
trunk/mmaker/debian/changelog
trunk/mmaker/libmorphix/makemodule.c
trunk/mmaker/libmorphix/makemodule.h
trunk/mmaker/src/isomaker.c
Modified: trunk/mmaker/debian/changelog
===================================================================
--- trunk/mmaker/debian/changelog 2008-04-15 16:09:46 UTC (rev 2628)
+++ trunk/mmaker/debian/changelog 2008-04-15 21:55:24 UTC (rev 2629)
@@ -1,3 +1,9 @@
+morphix-mmaker (0.4-44) unstable; urgency=low
+
+ * Fixes for -s (source retrieval option), added to isomaker. Confirmed it might actually work this time!
+
+ -- Alex de Landgraaf <al...@de...> Tue, 15 Apr 2008 18:57:24 +0200
+
morphix-mmaker (0.4-43) unstable; urgency=low
* Bug fix from Michael Bunk to correctly parse localdeb option.
Modified: trunk/mmaker/libmorphix/makemodule.c
===================================================================
--- trunk/mmaker/libmorphix/makemodule.c 2008-04-15 16:09:46 UTC (rev 2628)
+++ trunk/mmaker/libmorphix/makemodule.c 2008-04-15 21:55:24 UTC (rev 2629)
@@ -875,56 +875,7 @@
return TRUE;
}
-/**
- Compresses the directory using the default cloop compression
- @param dirname gchar*; Directory to compress
- @param filename gchar *; resulting compressed image
-
- return TRUE if successful, FALSE and message to stderr if an error occurred
-*/
-
-gboolean compressModuleCloop(gchar *dirname, gchar *filename) {
- int ret;
- gchar *cmdline;
- gchar *tmpisofile;
- gboolean exists = FALSE;
- if (!g_file_test(P_CREATE_COMPRESSED_FS,G_FILE_TEST_EXISTS)) {
- fprintf(stderr,"Error: couldn't locale create_compressed_fs on %s",P_CREATE_COMPRESSED_FS);
- return FALSE;
- }
- tmpisofile = g_strdup_printf("%s/%s",getTempRoot(),"libmorphix-tmpiso-XXXXXX");
- ret = mkstemp(tmpisofile);
- cmdline = g_strdup_printf("%s -R -U -m /proc/* -o %s -hide-rr-moved -cache-inodes -no-bak -pad %s",P_MKISOFS,tmpisofile,dirname);
- if (ExecuteCommand(cmdline) == TRUE) {
- g_free(cmdline);
- // nice -5 create_compressed_fs file.iso 65536 > output.mod
- cmdline = g_strdup_printf("/bin/sh -c \"%s -5 %s %s 65536 > %s\"",P_NICE,P_CREATE_COMPRESSED_FS,tmpisofile,filename);
- if (!ExecuteCommand(cmdline)) {
- fprintf(stderr,"Error: unable to compress temporary iso file: %s\n",tmpisofile);
- }
- else {
- unlink(tmpisofile);
- }
- g_free(cmdline);
- }
- else {
- fprintf(stderr,"Error: unable to build temporary iso file from directory %s\n",dirname);
- g_free(cmdline);
- }
-
- fprintf(stderr,"Info: Compression complete\n");
- exists = g_file_test(filename,G_FILE_TEST_EXISTS);
- if (exists == TRUE) {
- fprintf(stderr,"Info: Compression successful\n");
- }
- else {
- fprintf(stderr,"Info: Compression failed\n");
- }
- g_free(tmpisofile);
- return exists;
-}
-
/**
Fires up apt-get, after optionally making debconf non-interactive
optionally executes depmod afterwards. Uses the module->interactive setting
@@ -960,8 +911,6 @@
installPackages(module,module->dirname);
- deletePackages(module,module->dirname);
-
if (extra_package_list != NULL) {
GList * ptr = extra_package_list;
@@ -997,6 +946,7 @@
return FALSE;
}
+ deletePackages(module,module->dirname);
deleteCruft(module->dirname);
if (!cleanApt(module,module->dirname)) {
@@ -1230,6 +1180,12 @@
gint count = 5; // skip first 5 lines of dpkg -l
fprintf(stderr,"Info: In getAptPackageSources\n");
+
+ // Store for future usage, do this regardless of any source being downloaded
+ cmdline = g_strdup_printf("%s %s sh -c \"COLUMNS=160 dpkg -l > /morphix/packages.gz\"",P_CHROOT,module->dirname);
+ ExecuteCommand(cmdline);
+ g_free(cmdline);
+
if (sources_location == NULL) { // no sources wanted
return TRUE;
}
@@ -1248,8 +1204,7 @@
simply isn't enough...
*/
- cmdline = g_strdup_printf("%s %s sh -c \"COLUMNS=160 dpkg -l | gzip > /morphix/packages.gz\"",P_CHROOT,module->dirname);
-
+ cmdline = g_strdup_printf("%s %s sh -c \"COLUMNS=160 dpkg -l\"",P_CHROOT,module->dirname);
stdinput = ExecuteCommandReturnStdin(cmdline);
g_free(cmdline);
buf_array = g_strsplit(stdinput,"\n",0);
@@ -1278,8 +1233,7 @@
g_free(cmdline);
cmdline = g_strdup_printf("rm -rf %s/sources", module->dirname);
- // Enable this after everything works...
- // ExecuteCommand(cmdline);
+ ExecuteCommand(cmdline);
g_free(cmdline);
return TRUE;
Modified: trunk/mmaker/libmorphix/makemodule.h
===================================================================
--- trunk/mmaker/libmorphix/makemodule.h 2008-04-15 16:09:46 UTC (rev 2628)
+++ trunk/mmaker/libmorphix/makemodule.h 2008-04-15 21:55:24 UTC (rev 2629)
@@ -27,7 +27,6 @@
gboolean updatePackages(mmodule *module, gchar *dirname);
gboolean installPackages(mmodule *module, gchar *dirname);
gboolean cleanApt(mmodule *module, gchar *dirname);
-gboolean compressModuleCloop(gchar *dirname, gchar *filename);
gboolean executePatches(mmodule *module, gchar *dirname);
gboolean addRepositories(mmodule *module,gchar *dirname);
gboolean setupDebootstrap(mmodule *module);
Modified: trunk/mmaker/src/isomaker.c
===================================================================
--- trunk/mmaker/src/isomaker.c 2008-04-15 16:09:46 UTC (rev 2628)
+++ trunk/mmaker/src/isomaker.c 2008-04-15 21:55:24 UTC (rev 2629)
@@ -31,17 +31,18 @@
#define MAKEISO_PATH "/usr/bin/make-iso"
void usage(gchar *filename) {
- printf("Usage: %s -b basemod.xml [-g debootstrap.tar.gz] [-t tarball.tar.gz] [-m mainmod.xml] [-m mainmod2.xml] [-n minimod1.xml] [-n minimod2.xml] [-c] [-v] [-r repository [-p package1] [-p package2]] [-R image.png] output.iso\n",filename);
+ printf("Usage: %s -b basemod.xml [-g debootstrap.tar.gz] [-t tarball.tar.gz] [-m mainmod.xml] [-m mainmod2.xml] [-n minimod1.xml] [-n minimod2.xml] [-c] [-v] [-r repository [-p package1] [-p package2]] [-R image.png] [-s /path/to/sources.gz] output.iso\n",filename);
printf("\t-b:\tBase module template to build output.iso with\n");
+ printf("\t-c:\tClean temporary directories\n");
+ printf("\t-g:\tTarball which contains a complete debootstrapped Debian\n\t\tsystem for building the base module (and any main modules)\n");
printf("\t-m:\tMain module template to include in output.iso\n");
printf("\t-n:\tMini module template to include in output.iso (needs morphmini)\n");
+ printf("\t-p:\tPackages to be included on iso\n");
printf("\t-r:\tSpecify Repository for deb/udeb packages to include on iso\n");
- printf("\t-p:\tPackages to be included on iso\n");
+ printf("\t-R:\tCall morphix-rebrand on the resulting iso using this image-file\n");
+ printf("\t-s:\tDownload and store all source packages in this tarball\n");
printf("\t-t:\tTarball to be included on iso\n");
- printf("\t-g:\tTarball which contains a complete debootstrapped Debian\n\t\tsystem for building the base module (and any main modules)\n");
- printf("\t-c:\tClean temporary directories\n");
- printf("\t-R:\tCall morphix-rebrand on the resulting iso using this image-file\n");
printf("\t-v:\tverbose mode\n");
printf("\nThis tool uses mmaker to generate a Morphix iso from scratch,\n");
printf("using one basemodule template, and arbitrary number of mainmodule and minimodule templates,\nand optionally extra dpkg-deb-extracted deb/udeb packages\n\n");
@@ -79,16 +80,23 @@
}
}
-void do_mainmodules(gchar *workdir, GList *mainmodxmllist,gchar *debtarball) {
+void do_mainmodules(gchar *workdir, GList *mainmodxmllist,gchar *debtarball, gchar *source_directory) {
gint count = 0;
GList *ptr = NULL;
gchar *cmdline = NULL;
ptr = mainmodxmllist;
while (ptr != NULL) {
gchar *xmltemplate = (gchar *)ptr->data;
+ gchar *mmaker_sourcefile = NULL;
count++;
- cmdline = g_strdup_printf("%s -c %s %s %s/mainmod/%s.mod",
+
+ if (source_directory != NULL) {
+ mmaker_sourcefile = g_strdup_printf(" -s %s/main-%s-%d.tar.gz", source_directory, xmltemplate, count);
+ }
+
+ cmdline = g_strdup_printf("%s %s -c %s %s %s/mainmod/%s.mod",
MMAKER_PATH,
+ (source_directory ? mmaker_sourcefile : ""),
debtarball,
xmltemplate,
workdir,
@@ -97,6 +105,10 @@
printf("Warning: mmaker returned an error when building mainmodule, continuing...\n");
}
g_free(cmdline);
+ if (mmaker_sourcefile != NULL) {
+ g_free(mmaker_sourcefile);
+ mmaker_sourcefile = NULL;
+ }
ptr = ptr->next;
}
}
@@ -209,6 +221,10 @@
gchar *debtarball = NULL;
gchar *morphixrebrand = NULL;
+ gchar *retrieve_source = NULL;
+ gchar *source_directory = NULL;
+ gchar *mmaker_sourcefile = NULL;
+
GList *mainmodxmllist = NULL;
GList *minimodxmllist = NULL;
GList *packagelist = NULL;
@@ -225,7 +241,7 @@
return(EXIT_FAILURE);
}
- while ((optchar = getopt(argc,argv,"b:m:n:r:g:t:p:R:cv")) != -1) {
+ while ((optchar = getopt(argc,argv,"b:m:n:r:g:s:t:p:R:cv")) != -1) {
switch (optchar) {
case 'b':
// set temporary directory
@@ -276,6 +292,10 @@
opts+=1;
verbose = TRUE;
break;
+ case 's':
+ opts+=2;
+ retrieve_source = (char *) g_strdup(optarg);
+ break;
case '?':
printf("Error: Unknown command line option...\n");
usage(argv[0]);
@@ -343,6 +363,15 @@
use_debget = FALSE;
}
+ if (retrieve_source != NULL) {
+ source_directory = getTempdir();
+ if (source_directory == NULL) {
+ printf("Error: Unable to create temporary directory in %s for storing the source packages...\n",getTempRoot());
+ return(EXIT_FAILURE);
+ }
+ mmaker_sourcefile = g_strdup_printf(" -s %s/base.tar.gz ", source_directory);
+ }
+
/* everything should be okay now, start making that iso */
/* set up default directories */
@@ -355,9 +384,10 @@
/* build and add basemodule files */
- cmdline = g_strdup_printf("%s%s -t %s -m %s/boot/miniroot.gz -k %s/boot/vmlinuz %s %s %s/base/morphix",
+ cmdline = g_strdup_printf("%s%s %s -t %s -m %s/boot/miniroot.gz -k %s/boot/vmlinuz %s %s %s/base/morphix",
MMAKER_PATH,
- (verbose ? " -v" : ""),
+ (verbose ? " -v" : ""),
+ (retrieve_source ? mmaker_sourcefile : ""),
tempdir,
workdir,
workdir,
@@ -372,7 +402,7 @@
/* build and add mainmodules */
- do_mainmodules(workdir,mainmodxmllist,debtarball);
+ do_mainmodules(workdir,mainmodxmllist,debtarball, source_directory);
/* build and add minimodules */
@@ -415,6 +445,18 @@
printf("Info: Your live CD should be available as %s\n",outputiso);
+ /* Bundle all the source tarballs into a single tarball */
+
+ if (retrieve_source != NULL) {
+ cmdline = g_strdup_printf("tar zcvf %s %s", retrieve_source,source_directory);
+ ExecuteCommand(cmdline);
+ g_free(cmdline);
+
+ cmdline = g_strdup_printf("rm -rf %s", source_directory);
+ ExecuteCommand(cmdline);
+ g_free(cmdline);
+ }
+
/* clean everything up... */
if(clean){
printf("Info: Cleaning up base module build directory %s\n",tempdir);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|