summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2011-09-17 12:51:45 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2011-09-17 12:51:45 +0200
commit0170f2dff9200d6d9371f355c5eee956ccab2782 (patch)
tree7c33552eeccb625b528dcc2296d3259a7fcffaff /tools
parenta3864563d3ea1b6899c675c63ce11bc7d997bb31 (diff)
fix package rebuilds. broken since PKG_FLAVOURS are possible for subpackages
Diffstat (limited to 'tools')
-rw-r--r--tools/adk/pkgrebuild.c81
1 files changed, 42 insertions, 39 deletions
diff --git a/tools/adk/pkgrebuild.c b/tools/adk/pkgrebuild.c
index 0a91834e7..e7f037ae5 100644
--- a/tools/adk/pkgrebuild.c
+++ b/tools/adk/pkgrebuild.c
@@ -1,7 +1,7 @@
/*
* pkgrebuild - recognize required package rebuilds in OpenADK
*
- * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
+ * Copyright (C) 2010,2011 Waldemar Brodkorb <wbx@openadk.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
@@ -98,8 +98,8 @@ static char *toupperstr(char *string) {
int main() {
FILE *config, *configold, *pkg;
- char *key, *value, *string, *token;
- char *pkg_name, *keystr;
+ char *key, *value, *string, *token, *check;
+ char *pkg_name, *keystr, *realpkgname;
char buf[128];
char path[320];
char pbuf[320];
@@ -163,26 +163,48 @@ int main() {
keystr = NULL;
}
}
- string = strstr(pbuf, "PKG_FLAVOURS:=");
+ string = strstr(pbuf, "PKG_FLAVOURS_");
if (string != NULL) {
- string[strlen(string)-1] = '\0';
- key = strtok(string, ":=");
- value = strtok(NULL, "=\t");
- token = strtok(value, " ");
- while (token != NULL) {
- keystr = malloc(256);
- memset(keystr, 0, 256);
- strncat(keystr, "ADK_PACKAGE_", 12);
- strncat(keystr, toupperstr(pkg_name), strlen(pkg_name));
- strncat(keystr, "_", 1);
- strncat(keystr, token, strlen(token));
- strmap_put(pkgmap, keystr, pkgdirp->d_name);
- token = strtok(NULL, " ");
- free(keystr);
- keystr = NULL;
+ check = strstr(pbuf, ":=");
+ if (check != NULL) {
+ string[strlen(string)-1] = '\0';
+ key = strtok(string, ":=");
+ realpkgname = strdup(key+13);
+ value = strtok(NULL, "=\t");
+ token = strtok(value, " ");
+ while (token != NULL) {
+ keystr = malloc(256);
+ memset(keystr, 0, 256);
+ strncat(keystr, "ADK_PACKAGE_", 12);
+ strncat(keystr, realpkgname, strlen(realpkgname));
+ strncat(keystr, "_", 1);
+ strncat(keystr, token, strlen(token));
+ strmap_put(pkgmap, keystr, pkgdirp->d_name);
+ token = strtok(NULL, " ");
+ free(keystr);
+ keystr = NULL;
+ }
+ } else {
+ string[strlen(string)-1] = '\0';
+ key = strtok(string, "+=");
+ realpkgname = strdup(key+13);
+ value = strtok(NULL, "=\t");
+ token = strtok(value, " ");
+ while (token != NULL) {
+ keystr = malloc(256);
+ memset(keystr, 0, 256);
+ strncat(keystr, "ADK_PACKAGE_", 12);
+ strncat(keystr, realpkgname, strlen(realpkgname));
+ strncat(keystr, "_", 1);
+ strncat(keystr, token, strlen(token));
+ strmap_put(pkgmap, keystr, pkgdirp->d_name);
+ token = strtok(NULL, " ");
+ free(keystr);
+ keystr = NULL;
+ }
}
}
- string = strstr(pbuf, "PKG_CHOICES:=");
+ string = strstr(pbuf, "PKG_CHOICES_");
if (string != NULL) {
string[strlen(string)-1] = '\0';
key = strtok(string, ":=");
@@ -201,25 +223,6 @@ int main() {
keystr = NULL;
}
}
- string = strstr(pbuf, "PKG_FLAVOURS+=");
- if (string != NULL) {
- string[strlen(string)-1] = '\0';
- key = strtok(string, "+=");
- value = strtok(NULL, "=\t");
- token = strtok(value, " ");
- while (token != NULL) {
- keystr = malloc(256);
- memset(keystr, 0, 256);
- strncat(keystr, "ADK_PACKAGE_", 12);
- strncat(keystr, toupperstr(pkg_name), strlen(pkg_name));
- strncat(keystr, "_", 1);
- strncat(keystr, token, strlen(token));
- strmap_put(pkgmap, keystr, pkgdirp->d_name);
- token = strtok(NULL, " ");
- free(keystr);
- keystr = NULL;
- }
- }
}
}
fclose(pkg);