Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=f701cf32e6636a4d2171f4d57da3a49020a12385

commit f701cf32e6636a4d2171f4d57da3a49020a12385
Author: Miklos Vajna <vmik...@frugalware.org>
Date:   Wed Feb 23 01:02:25 2011 +0100

mkiso: introduce -g option

diff --git a/mkiso/mkiso.c b/mkiso/mkiso.c
index 7fc1798..26df65a 100644
--- a/mkiso/mkiso.c
+++ b/mkiso/mkiso.c
@@ -1,7 +1,7 @@
/*
*  mkiso.c
*
- *  Copyright (c) 2006, 2007, 2008, 2010 by Miklos Vajna 
<vmik...@frugalware.org>
+ *  Copyright (c) 2006, 2007, 2008, 2010, 2011 by Miklos Vajna 
<vmik...@frugalware.org>
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
@@ -474,7 +474,7 @@ int rmrf(char *path)
return(0);
}

-int prepare(volume_t *volume, char *tmproot, int countonly, int stable, int 
dryrun)
+int prepare(volume_t *volume, char *tmproot, int countonly, int stable, int 
dryrun, char *group)
{
PM_LIST *i, *junk;
PM_DB *db_local, *db_sync;
@@ -499,6 +499,8 @@ int prepare(volume_t *volume, char *tmproot, int countonly, 
int stable, int dryr
{
PM_PKG *pkg=pacman_list_getdata(i);
isopkg_t *isopkg;
+                       PM_LIST *i = pacman_pkg_getinfo(pkg, PM_PKG_GROUPS);
+                       char *grp = pacman_list_getdata(i);

if((isopkg = (isopkg_t *)malloc(sizeof(isopkg_t)))==NULL)
{
@@ -507,7 +509,8 @@ int prepare(volume_t *volume, char *tmproot, int countonly, 
int stable, int dryr
}
isopkg->pkg = pkg;
isopkg->priority = detect_priority(pkg);
-                       isopkgs = g_list_append(isopkgs, isopkg);
+                       if (!group || !strcmp(grp, group))
+                               isopkgs = g_list_append(isopkgs, isopkg);
}
}

@@ -553,6 +556,7 @@ int main(int argc, char **argv)
{
char tmproot[] = "/tmp/mkiso_XXXXXX";
char *xmlfile = strdup("volumes.xml");
+       char *group = NULL;
int i, countonly=0, stable=0, dryrun=0;
char *ptr;
int opt;
@@ -564,12 +568,13 @@ int main(int argc, char **argv)
{"dry-run",     no_argument,       0, 'n'},
{"stable",      no_argument,       0, 's'},
{"file",        required_argument, 0, 'f'},
+               {"group",       required_argument, 0, 'g'},
{0, 0, 0, 0}
};

if(argc >= 2)
{
-               while((opt = getopt_long(argc, argv, "hcsf:n", opts, 
&option_index)))
+               while((opt = getopt_long(argc, argv, "hcsf:g:n", opts, 
&option_index)))
{
if(opt < 0)
break;
@@ -582,6 +587,7 @@ int main(int argc, char **argv)
printf("       -h | --help    this help\n");
printf("       -n | --dry-run do not generate an iso, just print a filelist\n");
printf("       -s | --stable  indicate that the source repo is a -stable 
one\n");
+                                       printf("       -g | --group   include 
packages from a single group only\n");
free(xmlfile);
return(0);
break;
@@ -592,6 +598,9 @@ int main(int argc, char **argv)
free(xmlfile);
xmlfile = strdup(optarg);
break;
+                               case 'g':
+                                       group = strdup(optarg);
+                               break;
}
}
}
@@ -610,7 +619,7 @@ int main(int argc, char **argv)
free(ptr);

for(i=0;i<g_list_length(volumes);i++)
-               if(prepare(g_list_nth_data(volumes, i), tmproot, countonly, 
stable, dryrun))
+               if(prepare(g_list_nth_data(volumes, i), tmproot, countonly, 
stable, dryrun, group))
break;

PRINTF("cleaning up...");
diff --git a/mkiso/mkiso.txt b/mkiso/mkiso.txt
index 6c2ccc6..364869d 100644
--- a/mkiso/mkiso.txt
+++ b/mkiso/mkiso.txt
@@ -100,6 +100,10 @@ Probably the most changing part is the initrd and the 
kernel. You can generate t
By default, 'mkiso' searches for the file named 'volumes.xml'. If you
want a different one, then just specify it.

+-g, --group <group>::
+       'mkiso' includes all groups from the repo by default. If you
+       want to include a single group only, use this option.
+
== REPORTING BUGS

Please report bugs to http://bugs.frugalware.org/.
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to