[svn-commits] kpfleming: trunk r520 - in /trunk: menuselect.c menuselect.h
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jun 2 18:21:51 CDT 2009
Author: kpfleming
Date: Tue Jun 2 18:21:48 2009
New Revision: 520
URL: http://svn.asterisk.org/svn-view/menuselect?view=rev&rev=520
Log:
* Eliminate the global 'dep_file' variable.
* When creating the makdeps file, only output optional packages that were actually found, and only output *external* (non-member) dependencies/packages (members aren't linked, so there is no need for them to be included in the makedeps file).
Modified:
trunk/menuselect.c
trunk/menuselect.h
Modified: trunk/menuselect.c
URL: http://svn.asterisk.org/svn-view/menuselect/trunk/menuselect.c?view=diff&rev=520&r1=519&r2=520
==============================================================================
--- trunk/menuselect.c (original)
+++ trunk/menuselect.c Tue Jun 2 18:21:48 2009
@@ -90,7 +90,7 @@
enum dep_file_state met;
enum dep_file_state previously_met;
AST_LIST_ENTRY(dep_file) list;
-} *dep_file;
+};
AST_LIST_HEAD_NOLOCK_STATIC(deps_file, dep_file);
#if !defined(ast_strdupa) && defined(__GNUC__)
@@ -371,6 +371,7 @@
struct category *cat;
struct member *mem;
struct depend *dep;
+ struct dep_file *dep_file;
unsigned int changed, old_failure;
AST_LIST_TRAVERSE(&categories, cat, list) {
@@ -383,8 +384,9 @@
mem->depsfailed = HARD_FAILURE;
AST_LIST_TRAVERSE(&deps_file, dep_file, list) {
if (!strcasecmp(dep_file->name, dep->name)) {
- if (dep_file->met == DEP_FILE_MET)
+ if (dep_file->met == DEP_FILE_MET) {
mem->depsfailed = NO_FAILURE;
+ }
break;
}
}
@@ -456,6 +458,7 @@
struct category *cat;
struct member *mem;
struct conflict *cnf;
+ struct dep_file *dep_file;
unsigned int changed, old_failure;
AST_LIST_TRAVERSE(&categories, cat, list) {
@@ -538,6 +541,7 @@
FILE *f;
char buf[80];
int res = 0;
+ struct dep_file *dep_file;
if (!(f = fopen(MENUSELECT_DEPS, "r"))) {
fprintf(stderr, "Unable to open '%s' for reading! Did you run ./configure ?\n", MENUSELECT_DEPS);
@@ -612,6 +616,8 @@
static void free_deps_file(void)
{
+ struct dep_file *dep_file;
+
/* Free the dependency list we built from the file */
while ((dep_file = AST_LIST_REMOVE_HEAD(&deps_file, list)))
free(dep_file);
@@ -1009,21 +1015,51 @@
struct member *mem;
struct depend *dep;
struct use *use;
+ struct dep_file *dep_file;
if (!(f = fopen(output_makedeps, "w"))) {
fprintf(stderr, "Unable to open dependencies file (%s) for writing!\n", output_makedeps);
return -1;
}
+ /* Traverse all categories and members and mark which used packages were found,
+ * skipping other members
+ */
+ AST_LIST_TRAVERSE(&categories, cat, list) {
+ AST_LIST_TRAVERSE(&cat->members, mem, list) {
+ AST_LIST_TRAVERSE(&mem->uses, use, list) {
+ if (use->member) {
+ use->met = 0;
+ continue;
+ }
+ AST_LIST_TRAVERSE(&deps_file, dep_file, list) {
+ if ((use->met = !strcasecmp(use->name, dep_file->name))) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
/* Traverse all categories and members and output dependencies for each member */
AST_LIST_TRAVERSE(&categories, cat, list) {
AST_LIST_TRAVERSE(&cat->members, mem, list) {
+ unsigned char header_printed = 0;
+
if (AST_LIST_EMPTY(&mem->deps) && AST_LIST_EMPTY(&mem->uses))
continue;
- fprintf(f, "MENUSELECT_DEPENDS_%s=", mem->name);
AST_LIST_TRAVERSE(&mem->deps, dep, list) {
const char *c;
+
+ if (dep->member) {
+ continue;
+ }
+
+ if (!header_printed) {
+ fprintf(f, "MENUSELECT_DEPENDS_%s=", mem->name);
+ header_printed = 1;
+ }
for (c = dep->name; *c; c++)
fputc(toupper(*c), f);
@@ -1032,11 +1068,23 @@
AST_LIST_TRAVERSE(&mem->uses, use, list) {
const char *c;
+ if (!use->met) {
+ continue;
+ }
+
+ if (!header_printed) {
+ fprintf(f, "MENUSELECT_DEPENDS_%s=", mem->name);
+ header_printed = 1;
+ }
+
for (c = use->name; *c; c++)
fputc(toupper(*c), f);
fputc(' ', f);
}
- fprintf(f, "\n");
+
+ if (header_printed) {
+ fprintf(f, "\n");
+ }
}
}
@@ -1272,7 +1320,7 @@
return count;
}
-static void print_sanity_dep_header(unsigned int *flag)
+static void print_sanity_dep_header(struct dep_file *dep_file, unsigned int *flag)
{
fprintf(stderr, "\n"
"***********************************************************\n"
@@ -1290,6 +1338,7 @@
struct member *mem;
struct depend *dep;
struct use *use;
+ struct dep_file *dep_file;
unsigned int dep_header_printed;
unsigned int group_header_printed;
@@ -1317,7 +1366,7 @@
}
if (!group_header_printed) {
if (!dep_header_printed) {
- print_sanity_dep_header(&dep_header_printed);
+ print_sanity_dep_header(dep_file, &dep_header_printed);
}
fprintf(stderr, "\n"
" The following modules will no longer be available:\n");
@@ -1341,7 +1390,7 @@
}
if (!group_header_printed) {
if (!dep_header_printed) {
- print_sanity_dep_header(&dep_header_printed);
+ print_sanity_dep_header(dep_file, &dep_header_printed);
}
fprintf(stderr, "\n"
" The functionality of the following modules will\n"
Modified: trunk/menuselect.h
URL: http://svn.asterisk.org/svn-view/menuselect/trunk/menuselect.h?view=diff&rev=520&r1=519&r2=520
==============================================================================
--- trunk/menuselect.h (original)
+++ trunk/menuselect.h Tue Jun 2 18:21:48 2009
@@ -61,8 +61,10 @@
const char *name;
/*! the display name of the used package */
const char *displayname;
- /*! if this dependency is a member, not an external object */
+ /*! if this used package is a member, not an external object */
struct member *member;
+ /*! if this used package was found */
+ unsigned char met;
/*! for linking */
AST_LIST_ENTRY(use) list;
};
More information about the svn-commits
mailing list