diff --git a/build.sh b/build.sh index 90bde3d..be98bd8 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,2 @@ #!/bin/sh -gcc mrklib*.c mrk.c -o mrk `pkg-config --cflags --libs eina ecore ecore-file ecore-ipc eet` +gcc -g $CFLAGS mrklib*.c mrk.c -o mrk `pkg-config --cflags --libs eina ecore ecore-file ecore-ipc eet` diff --git a/mrk.c b/mrk.c index 4237395..5c31fab 100644 --- a/mrk.c +++ b/mrk.c @@ -22,12 +22,12 @@ static Eina_Bool move_to_cwd = EINA_FALSE; static Eina_Bool install_bin = EINA_FALSE; static void -_cb_connect(void *data, Mrk *server) +_cb_connect(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { } static void -_cb_disconnect(void *data, Mrk *server) +_cb_disconnect(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { _mrk_err("Disconnect\n"); } @@ -45,21 +45,21 @@ status(double pos) } static void -_cb_upload_begin(void *data, Mrk *server) +_cb_upload_begin(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { status(0.0); fflush(stdout); } static void -_cb_upload_progress(void *data, Mrk *server, double pos) +_cb_upload_progress(void *data EINA_UNUSED, Mrk *server EINA_UNUSED, double pos) { status(pos); fflush(stdout); } static void -_cb_upload_end(void *data, Mrk *server) +_cb_upload_end(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { status(1.0); printf("\n"); @@ -67,28 +67,28 @@ _cb_upload_end(void *data, Mrk *server) } static void -_cb_upload_success(void *data, Mrk *server, Eina_Bool success) +_cb_upload_success(void *data EINA_UNUSED, Mrk *server EINA_UNUSED, Eina_Bool success) { if (!success) _mrk_err("Upload Failed\n"); ecore_main_loop_quit(); } static void -_cb_download_begin(void *data, Mrk *server) +_cb_download_begin(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { status(0.0); fflush(stdout); } static void -_cb_download_progress(void *data, Mrk *server, double pos) +_cb_download_progress(void *data EINA_UNUSED, Mrk *server EINA_UNUSED, double pos) { status(pos); fflush(stdout); } static void -_cb_download_end(void *data, Mrk *server) +_cb_download_end(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { status(1.0); printf("\n"); @@ -96,7 +96,7 @@ _cb_download_end(void *data, Mrk *server) } static void -_cb_download_success(void *data, Mrk *server, const char *file) +_cb_download_success(void *data EINA_UNUSED, Mrk *server EINA_UNUSED, const char *file) { if (!file) _mrk_err("Download Failed\n"); if (move_to_cwd) @@ -125,18 +125,18 @@ _cb_download_success(void *data, Mrk *server, const char *file) } static void -_cb_answer_begin(void *data, Mrk *server) +_cb_answer_begin(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { } static void -_cb_answer_progress(void *data, Mrk *server, const char *result) +_cb_answer_progress(void *data EINA_UNUSED, Mrk *server EINA_UNUSED, const char *result) { printf("%s\n", result); } static void -_cb_answer_end(void *data, Mrk *server) +_cb_answer_end(void *data EINA_UNUSED, Mrk *server EINA_UNUSED) { ecore_main_loop_quit(); } diff --git a/mrklib.h b/mrklib.h index 570ae58..78281e0 100644 --- a/mrklib.h +++ b/mrklib.h @@ -129,7 +129,7 @@ struct _Mrk_Build EAPI Mrk_Build *mrk_build_load(const char *file); EAPI void mrk_build_free(Mrk_Build *bld); EAPI Eina_Bool mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd); -EAPI Eina_Bool mrk_build_pakage_bin(Mrk_Build *bld, const char *file, const char *tmpd, const char *os, const char *arch); +EAPI Eina_Bool mrk_build_package_bin(Mrk_Build *bld, const char *file, const char *tmpd, const char *os, const char *arch); EAPI Eina_Bool mrk_build_package_src(Mrk_Build *bld, const char *buildfile, const char *file); EAPI Eina_Bool mrk_package_src_extract(const char *file, const char *dst); diff --git a/mrklib_buildfile.c b/mrklib_buildfile.c index 2894d99..c7f8036 100644 --- a/mrklib_buildfile.c +++ b/mrklib_buildfile.c @@ -367,7 +367,6 @@ mrk_build_load(const char *file) Eina_File *ef; char *mem; size_t size; - int ret; ef = eina_file_open(file, EINA_FALSE); if (!ef) return NULL; @@ -435,9 +434,17 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) char tmp[4096]; char tmp2[4096]; const char *ss, *cc; - int res; + int res, total, current; #define err(reason) do { fprintf(stderr, "%s\n", reason); goto error; } while (0) + total = + eina_list_count(bld->po) + + eina_list_count(bld->data) + + eina_list_count(bld->desktops) + + eina_list_count(bld->icons) + + eina_list_count(bld->copying); + if (total < 1) total = 1; + current = 0; if (!(buf = eina_strbuf_new())) goto error; snprintf(tmp, sizeof(tmp), "%s", tmpd); ecore_file_mkpath(tmp); @@ -445,6 +452,7 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) ecore_file_mkpath(tmp); EINA_LIST_FOREACH(bld->po, l, s) { + current++; snprintf(tmp, sizeof(tmp), "%s/share/locale/%s/LC_MESSAGES/", tmpd, s); ecore_file_mkpath(tmp); snprintf(tmp2, sizeof(tmp2), "po/%s.gmo", s); @@ -452,12 +460,16 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) if ((!ecore_file_exists(tmp)) || (ecore_file_mod_time(tmp2) >= ecore_file_mod_time(tmp))) { - printf("%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", 27, tmp2, 27, 27, 27, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + "%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, tmp2, 27, 27, 27, 27); ecore_file_cp(tmp2, tmp); } } EINA_LIST_FOREACH(bld->data, l, data) { + current++; s = ecore_file_dir_get(data->dest); if (s) { @@ -469,7 +481,10 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) if ((!ecore_file_exists(tmp)) || (ecore_file_mod_time(data->src) >= ecore_file_mod_time(tmp))) { - printf("%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", 27, data->src, 27, 27, 27, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + "%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, data->src, 27, 27, 27, 27); ecore_file_cp(data->src, tmp); } } @@ -477,6 +492,7 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) ecore_file_mkpath(tmp); EINA_LIST_FOREACH(bld->desktops, l, s) { + current++; ss = ecore_file_file_get(s); if (!(!strncmp(ss, bld->domain, strlen(bld->domain)))) err("destkop file wrong domain"); @@ -484,7 +500,10 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) if ((!ecore_file_exists(tmp)) || (ecore_file_mod_time(s) >= ecore_file_mod_time(tmp))) { - printf("%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", 27, s, 27, 27, 27, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + "%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, s, 27, 27, 27, 27); ecore_file_cp(s, tmp); } } @@ -492,6 +511,7 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) ecore_file_mkpath(tmp); EINA_LIST_FOREACH(bld->icons, l, s) { + current++; ss = ecore_file_file_get(s); if (!(!strncmp(ss, bld->domain, strlen(bld->domain)))) err("icon file wrong domain"); @@ -499,12 +519,16 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) if ((!ecore_file_exists(tmp)) || (ecore_file_mod_time(s) >= ecore_file_mod_time(tmp))) { - printf("%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", 27, s, 27, 27, 27, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + "%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, s, 27, 27, 27, 27); ecore_file_cp(s, tmp); } } EINA_LIST_FOREACH(bld->copying, l, s) { + current++; if (strchr(s, '/')) { s2 = ecore_file_dir_get(s); @@ -518,7 +542,10 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) if ((!ecore_file_exists(tmp)) || (ecore_file_mod_time(s) >= ecore_file_mod_time(tmp))) { - printf("%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", 27, s, 27, 27, 27, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + "%c[36;01m%s%c[0m%c[35m -%c[1m>%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, s, 27, 27, 27, 27); ecore_file_cp(s, tmp); } } @@ -526,6 +553,13 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) cc = getenv("CC"); if (!cc) cc = "gcc"; + total = 0; + EINA_LIST_FOREACH(bld->bins, l, bin) + { + total++; + total += eina_list_count(bin->srcs); + } + current = 0; EINA_LIST_FOREACH(bld->bins, l, bin) { Eina_Bool rebuild, rebuild2, touchme; @@ -569,6 +603,7 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) } EINA_LIST_FOREACH(bin->srcs, ll, s) { + current++; touchme = EINA_FALSE; rebuild2 = EINA_FALSE; snprintf(tmp, sizeof(tmp), "%s-%s", bin->bin, s); @@ -629,7 +664,10 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) s2 = (char *)eina_strbuf_string_get(buf); if (s2) { - printf(" %c[31mCC%c[33m %s%c[0m\n", 27, 27, s, 27); + printf("%c[32m%3i%c[37;01m%%%c[0m " + " %c[31mCC%c[33m %s%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, 27, s, 27); if (getenv("V")) printf("%s\n", s2); printf("%c[34m", 27); fflush(stdout); @@ -651,6 +689,7 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) fclose(f); } } + current++; eina_strbuf_reset(buf); eina_strbuf_append(buf, cc); eina_strbuf_append(buf, " -lm -o "); @@ -685,8 +724,11 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) s = (char *)eina_strbuf_string_get(buf); if (s) { - printf(" %c[1;31mLD%c[1;33m %s%c[0m\n", 27, 27, bin->bin, 27); - if (getenv("V")) printf("%s\n", s2); + printf("%c[32m%3i%c[37;01m%%%c[0m " + " %c[1;31mLD%c[1;33m %s%c[0m\n", + 27, (current * 100) / total, 27, 27, + 27, 27, bin->bin, 27); + if (getenv("V")) printf("%s\n", s); printf("%c[34m", 27); fflush(stdout); res = system(s); @@ -698,6 +740,8 @@ mrk_build_do(Mrk_Build *bld, const char *tmpd, const char *objd) } } } + else + current += 1 + eina_list_count(bin->srcs); } eina_strbuf_free(buf); return EINA_TRUE; @@ -727,7 +771,6 @@ static void package_bin_iter(Eet_File *ef, const char *dir, const char *key) { Eina_List *files; - Eina_File *enf; char *s; char tmp[4096]; char tmp2[4096]; @@ -763,12 +806,11 @@ mrk_build_package_bin(Mrk_Build *bld, const char *file, const char *tmpd, const char *s; int i; -// snprintf(tmp, sizeof(tmp), "%s-%s.mkb", bld->name, bld->version); ef = eet_open(file, EET_FILE_MODE_WRITE); if (ef) { -#define WRTS(key, var) \ - if (var) eet_write(ef, key, var, strlen(var), EET_COMPRESSION_VERYFAST) +#define WRTA(key, var) eet_write(ef, key, var, strlen(var), EET_COMPRESSION_VERYFAST) +#define WRTS(key, var) if (var) WRTA(key, var) WRTS("name", bld->name); if (bld->icon) package_file(ef, bld->icon, "icon"); if (bld->splash) package_file(ef, bld->splash, "splash"); @@ -780,7 +822,7 @@ mrk_build_package_bin(Mrk_Build *bld, const char *file, const char *tmpd, const WRTS("contact", bld->contact); WRTS("needs", bld->needs); snprintf(tmp, sizeof(tmp), "%s-%s", os, arch); - WRTS("arch", tmp); + WRTA("arch", tmp); i = 0; EINA_LIST_FOREACH(bld->tags, l, s) { @@ -807,7 +849,7 @@ mrk_build_package_src(Mrk_Build *bld, const char *buildfile, const char *file) char tmp[4096]; char tmp2[4096]; -// snprintf(tmp, sizeof(tmp), "%s-%s.mks", bld->name, bld->version); +#define err(reason) do { fprintf(stderr, "%s\n", reason); goto error; } while (0) ef = eet_open(file, EET_FILE_MODE_WRITE); if (ef) { @@ -864,5 +906,8 @@ mrk_build_package_src(Mrk_Build *bld, const char *buildfile, const char *file) eet_close(ef); return EINA_TRUE; } +#undef err +error: + if (ef) eet_close(ef); return EINA_FALSE; } diff --git a/mrklib_index.c b/mrklib_index.c index 2f249b2..e14a9d6 100644 --- a/mrklib_index.c +++ b/mrklib_index.c @@ -46,7 +46,7 @@ typedef struct } Inf; static Eina_Bool -key_enter_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) +key_enter_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Inf *inf = fdata; key_register(inf->master, key, inf->entry); @@ -84,7 +84,7 @@ static void key_str_add(Eina_Hash *hash, const char *str) { char *ts = strdup(str); - char *p, *pe; + char *p, *pe = ts; if (!ts) return; for (p = ts; *p; p++) { @@ -106,7 +106,7 @@ key_str_add(Eina_Hash *hash, const char *str) } static Eina_Bool -key_merge_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) +key_merge_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { key_add(fdata, key); return EINA_TRUE; @@ -194,7 +194,7 @@ index_file(Mdb *db, const char *file, const char *fname) } static Eina_Bool -index_out_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) +index_out_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata) { FILE *f = fdata; const char *s; diff --git a/mrklib_priv.h b/mrklib_priv.h index 7c0095c..a20b012 100644 --- a/mrklib_priv.h +++ b/mrklib_priv.h @@ -13,6 +13,7 @@ #include #include #include +#include #define MRK_SERVER_HOST "devs.enlightenment.org" #define MRK_SERVER_PORT 10077 diff --git a/mrklib_repodb.c b/mrklib_repodb.c index 0ac1652..a555b15 100644 --- a/mrklib_repodb.c +++ b/mrklib_repodb.c @@ -58,7 +58,7 @@ db_load_hash(Eina_Hash *hash, FILE *f) } static Eina_Bool -db_clear_hash_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) +db_clear_hash_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) { const char *s; @@ -210,8 +210,7 @@ db_search(Eina_Hash *hash, const char *search) Eina_List *list = NULL, *tl, *l; const char *s; char *ts = strdup(search); - char *p, *end; - int i; + char *p, *end = ts; if (!ts) return NULL; for (p = ts; *p; p++) @@ -239,7 +238,7 @@ db_search(Eina_Hash *hash, const char *search) } static Eina_Bool -_mrk_cb_exe_del(void *data, int type, void *event) +_mrk_cb_exe_del(void *data, int type EINA_UNUSED, void *event) { Ecore_Exe_Event_Del *e = event; Mrk_Repodb *rdb = data; @@ -321,7 +320,6 @@ EAPI const Eina_List * mrk_repodb_category_list(Mrk_Repodb *rdb, const char *arch, const char *category) { Db *db = db_arch_find(rdb, arch); - Eina_List *list; if (!db) return NULL; if (!category) category = "@"; // @ is the "everything" category and list diff --git a/mrklib_serv.c b/mrklib_serv.c index 69e191c..9cb7fbf 100644 --- a/mrklib_serv.c +++ b/mrklib_serv.c @@ -133,7 +133,7 @@ client_send(Client *c, const char *subrepo, const char *name, int op_start, int } static Eina_Bool -_mrk_id_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) +_mrk_id_data(Mrk_Serve *server EINA_UNUSED, Client *c, Ecore_Ipc_Event_Client_Data *e) { if (e->minor == M_ID_UUID) { @@ -170,7 +170,7 @@ _mrk_id_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) } static Eina_Bool -_mrk_upload_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) +_mrk_upload_data(Mrk_Serve *server EINA_UNUSED, Client *c, Ecore_Ipc_Event_Client_Data *e) { if ((!c->uuid) || (!c->version) || (!c->arch)) return EINA_FALSE; if (e->minor == M_UP_START) @@ -199,7 +199,7 @@ _mrk_upload_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) } static Eina_Bool -_mrk_query_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) +_mrk_query_data(Mrk_Serve *server EINA_UNUSED, Client *c, Ecore_Ipc_Event_Client_Data *e) { if ((!c->uuid) || (!c->version) || (!c->arch)) return EINA_FALSE; if (e->minor == M_QRY_LIST) @@ -286,7 +286,7 @@ _mrk_query_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) } static Eina_Bool -_mrk_inf_data(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) +_mrk_inf_data(Mrk_Serve *server EINA_UNUSED, Client *c, Ecore_Ipc_Event_Client_Data *e) { if ((!c->uuid) || (!c->version) || (!c->arch)) return EINA_FALSE; if (e->minor == M_INF_GET_IC) @@ -328,7 +328,7 @@ _mrk_data_handle(Mrk_Serve *server, Client *c, Ecore_Ipc_Event_Client_Data *e) } static Eina_Bool -_mrk_cb_add(void *data, int type, void *event) +_mrk_cb_add(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Client_Add *e = event; Mrk_Serve *server = data; @@ -344,7 +344,7 @@ _mrk_cb_add(void *data, int type, void *event) } static Eina_Bool -_mrk_cb_del(void *data, int type, void *event) +_mrk_cb_del(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Client_Del *e = event; Mrk_Serve *server = data; @@ -367,7 +367,7 @@ _mrk_cb_del(void *data, int type, void *event) } static Eina_Bool -_mrk_cb_data(void *data, int type, void *event) +_mrk_cb_data(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Client_Data *e = event; Mrk_Serve *server = data; @@ -382,7 +382,7 @@ _mrk_cb_data(void *data, int type, void *event) } static Eina_Bool -_mrk_cb_exe_del(void *data, int type, void *event) +_mrk_cb_exe_del(void *data, int type EINA_UNUSED, void *event) { Ecore_Exe_Event_Del *e = event; Mrk_Serve *server = data; diff --git a/mrklib_svc.c b/mrklib_svc.c index 0532e3d..45daab8 100644 --- a/mrklib_svc.c +++ b/mrklib_svc.c @@ -85,7 +85,7 @@ _mrk_upload(Mrk *server, const char *file) if ((server->f) || (server->query)) return EINA_FALSE; // XXX: adjust protocol so we get ack's for each buf f = fopen(file, "rb"); - if (!f) return; + if (!f) return EINA_FALSE; server->f = f; fname = ecore_file_file_get(file); if (!fname) goto done; @@ -304,7 +304,7 @@ _mrk_data_handle(Mrk *server, Ecore_Ipc_Event_Server_Data *e) } static Eina_Bool -_mrk_cb_add(void *data, int type, void *event) +_mrk_cb_add(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Server_Add *e = event; Mrk *server = data; @@ -316,7 +316,7 @@ _mrk_cb_add(void *data, int type, void *event) } static Eina_Bool -_mrk_cb_del(void *data, int type, void *event) +_mrk_cb_del(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Server_Del *e = event; Mrk *server = data; @@ -328,7 +328,7 @@ _mrk_cb_del(void *data, int type, void *event) } static Eina_Bool -_mrk_cb_data(void *data, int type, void *event) +_mrk_cb_data(void *data, int type EINA_UNUSED, void *event) { Ecore_Ipc_Event_Server_Data *e = event; Mrk *server = data;