summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-26 20:54:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-11-26 20:54:02 +0900
commitcd3922c8a98e6e21ed988b23f2704090d324381e (patch)
treed84486ef40d56fd3fde6b017001228ac0fc1db1b
parent9c3cb5a9f51a5ebafda287fefcb277e7051442f8 (diff)
mrk redo - make it work again ... another effort
-rw-r--r--mrk.c1
-rw-r--r--mrklib_buildfile.c27
-rw-r--r--mrklib_util.c2
3 files changed, 17 insertions, 13 deletions
diff --git a/mrk.c b/mrk.c
index 88c2d0d..1788177 100644
--- a/mrk.c
+++ b/mrk.c
@@ -193,6 +193,7 @@ main(int argc, char **argv)
193 Mrk_Build *bld = mrk_build_load("Marrakesh.mrk"); 193 Mrk_Build *bld = mrk_build_load("Marrakesh.mrk");
194 if (!bld) _mrk_err("Failed to load Marrakesh.mrk\n"); 194 if (!bld) _mrk_err("Failed to load Marrakesh.mrk\n");
195 snprintf(tmp, sizeof(tmp), "%s-%s.mkb", bld->name, bld->version); 195 snprintf(tmp, sizeof(tmp), "%s-%s.mkb", bld->name, bld->version);
196 if (!ecore_file_exists(build_tmpdir)) _mrk_err("No build dir!\n");
196 if (!mrk_build_package_bin(bld, tmp, build_tmpdir, os, arch)) 197 if (!mrk_build_package_bin(bld, tmp, build_tmpdir, os, arch))
197 { 198 {
198 mrk_build_free(bld); 199 mrk_build_free(bld);
diff --git a/mrklib_buildfile.c b/mrklib_buildfile.c
index fa0ebad..892bf21 100644
--- a/mrklib_buildfile.c
+++ b/mrklib_buildfile.c
@@ -103,11 +103,12 @@ parse_content(char *mem, size_t size)
103 char *p = mem; 103 char *p = mem;
104 int skipline = 0; 104 int skipline = 0;
105 int startline = 0; 105 int startline = 0;
106 int line = 1;
106 char *seg = NULL, *s; 107 char *seg = NULL, *s;
107 char *data1 = NULL, *data2 = NULL; 108 char *data1 = NULL, *data2 = NULL;
108 int i; 109 int i;
109 Tag_Mode mode = TMODE_TEXT; 110 Tag_Mode mode = TMODE_TEXT;
110#define err(reason) do { fprintf(stderr, "%s\n", reason); goto error; } while (0) 111#define err(reason...) do { fprintf(stderr, ##reason); goto error; } while (0)
111 112
112 bld = calloc(1, sizeof(Mrk_Build)); 113 bld = calloc(1, sizeof(Mrk_Build));
113 if (!bld) return NULL; 114 if (!bld) return NULL;
@@ -116,6 +117,7 @@ parse_content(char *mem, size_t size)
116 { 117 {
117 if (prevc == '\n') 118 if (prevc == '\n')
118 { 119 {
120 line++;
119 if (*p == '#') skipline = 1; 121 if (*p == '#') skipline = 1;
120 else skipline = 0; 122 else skipline = 0;
121 startline = 1; 123 startline = 1;
@@ -127,7 +129,7 @@ parse_content(char *mem, size_t size)
127 129
128 prevp = p; 130 prevp = p;
129 tok = parse_token(&p, end); 131 tok = parse_token(&p, end);
130 if (!tok) err("token parse error"); 132 if (!tok) err("%i: token parse error\n", line);
131 if (startline) 133 if (startline)
132 { 134 {
133 for (i = 0; tags[i].tag; i++) 135 for (i = 0; tags[i].tag; i++)
@@ -151,25 +153,25 @@ not_tag:
151 case TMODE_TEXT: 153 case TMODE_TEXT:
152 p = prevp; 154 p = prevp;
153 data1 = parse_eol(&p, end); 155 data1 = parse_eol(&p, end);
154 if (!data1) err("no content"); 156 if (!data1) err("%i: no content\n", line);
155 break; 157 break;
156 case TMODE_PATH: 158 case TMODE_PATH:
157 case TMODE_PATH_LIST: 159 case TMODE_PATH_LIST:
158 data1 = path_check(tok); 160 data1 = path_check(tok);
159 if (!data1) err("path invalid"); 161 if (!data1) err("%i: path invalid\n", line);
160 break; 162 break;
161 case TMODE_PATH_CP: 163 case TMODE_PATH_CP:
162 case TMODE_PATH_CP_LIST: 164 case TMODE_PATH_CP_LIST:
163 data1 = path_check(tok); 165 data1 = path_check(tok);
164 if (!data1) err("path invalid"); 166 if (!data1) err("%i: path invalid\n", line);
165 s = parse_token(&p, end); 167 s = parse_token(&p, end);
166 if (!s) err("missing > in path copy"); 168 if (!s) err("%i: missing > in path copy\n", line);
167 if (!(!strcmp(s, ">"))) err("copy token is not >"); 169 if (!(!strcmp(s, ">"))) err("%i: copy token is not >\n", line);
168 free(s); 170 free(s);
169 s = parse_token(&p, end); 171 s = parse_token(&p, end);
170 if (!s) err("missing destination path in path copy"); 172 if (!s) err("%i: missing destination path in path copy\n", line);
171 data2 = path_check(s); 173 data2 = path_check(s);
172 if (!data2) err("destination path not valid"); 174 if (!data2) err("%i: destination path not valid\n", line);
173 free(s); 175 free(s);
174 break; 176 break;
175 default: 177 default:
@@ -180,7 +182,7 @@ not_tag:
180 if (!strcmp(seg, "PROJ:")) 182 if (!strcmp(seg, "PROJ:"))
181 { 183 {
182 if (!_mrk_util_plain_file_check(data1)) 184 if (!_mrk_util_plain_file_check(data1))
183 err("name failed sanity check"); 185 err("%i: name failed sanity check\n", line);
184 eina_stringshare_del(bld->name); 186 eina_stringshare_del(bld->name);
185 bld->name = eina_stringshare_add(data1); 187 bld->name = eina_stringshare_add(data1);
186 } 188 }
@@ -337,6 +339,7 @@ not_tag:
337 } 339 }
338 free(tok); 340 free(tok);
339 prevc = *p; 341 prevc = *p;
342 p++;
340 } 343 }
341 else 344 else
342 { 345 {
@@ -530,9 +533,9 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd)
530 } 533 }
531 EINA_LIST_FOREACH(bin->deps, ll, s) 534 EINA_LIST_FOREACH(bin->deps, ll, s)
532 { 535 {
533 eina_strbuf_append(buf, " pkg-config --cflags --libs "); 536 eina_strbuf_append(buf, " `pkg-config --cflags --libs ");
534 eina_strbuf_append(buf, s); 537 eina_strbuf_append(buf, s);
535 eina_strbuf_append(buf, " "); 538 eina_strbuf_append(buf, "`");
536 } 539 }
537 EINA_LIST_FOREACH(bin->incs, ll, s) 540 EINA_LIST_FOREACH(bin->incs, ll, s)
538 { 541 {
diff --git a/mrklib_util.c b/mrklib_util.c
index 4b7b8e7..85befe5 100644
--- a/mrklib_util.c
+++ b/mrklib_util.c
@@ -7,7 +7,7 @@ static const char *sane_name_ok =
7static const char *sane_path_veto[] = 7static const char *sane_path_veto[] =
8{"../", "./", NULL}; 8{"../", "./", NULL};
9static const char *sane_path_ok = 9static const char *sane_path_ok =
10"01234567890-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. "; 10"/01234567890-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. ";
11 11
12static int 12static int
13_sane_forbidden_path(const char *file, const char **forbidden) 13_sane_forbidden_path(const char *file, const char **forbidden)