summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-26 11:07:27 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-26 11:07:27 +0900
commit3d791bd5fff82f0d0e31cebe1901c426d2bddeac (patch)
tree890934a0c6a7bd21d0adb3cb942bf3ae7d661257
parentb1b0ee5d6af26ab863d151408f140ee50db31c90 (diff)
marrakesh - add check and some more env vars
-rw-r--r--mrk-proto.h22
-rw-r--r--mrk.c62
2 files changed, 75 insertions, 9 deletions
diff --git a/mrk-proto.h b/mrk-proto.h
index 2c6f554..ce9399d 100644
--- a/mrk-proto.h
+++ b/mrk-proto.h
@@ -15,3 +15,25 @@
15#define M_ANS_START 31 15#define M_ANS_START 31
16#define M_ANS_DATA 32 16#define M_ANS_DATA 32
17#define M_ANS_END 33 17#define M_ANS_END 33
18
19#if defined(__x86_64__)
20# define ARCH "x86_64"
21#elif defined(__i386__)
22# define ARCH "ix86"
23#elif defined(__arm__)
24# define ARCH "arm"
25#elif defined(__ppc64__) || defined(__powerpc64__)
26# define ARCH "ppc64"
27#elif defined(__ppc__) || defined(__powerpc__)
28# define ARCH "ppc"
29#endif
30
31#if defined(__linux__)
32# define OS "linux"
33#elif defined(__MACH__)
34# define OS "osx"
35#elif defined(__FreeBSD__)
36# define OS "freebsd"
37#elif defined(_WIN32) || defined(_WIN64)
38# define OS "win"
39#endif
diff --git a/mrk.c b/mrk.c
index 8a221af..1cbedc9 100644
--- a/mrk.c
+++ b/mrk.c
@@ -105,6 +105,8 @@ static const char *sane_path_veto[] = {"../", "./", NULL};
105static const char *sane_path_ok = "01234567890-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. "; 105static const char *sane_path_ok = "01234567890-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. ";
106static char *server = "devs.enlightenment.org"; 106static char *server = "devs.enlightenment.org";
107static int server_port = 10077; 107static int server_port = 10077;
108static char *arch = ARCH;
109static char *os = OS;
108 110
109static void 111static void
110err(char *msg) 112err(char *msg)
@@ -683,6 +685,8 @@ pakage_bin(void)
683 WRTS("devrepo", build.devrepo); 685 WRTS("devrepo", build.devrepo);
684 WRTS("contact", build.contact); 686 WRTS("contact", build.contact);
685 WRTS("needs", build.needs); 687 WRTS("needs", build.needs);
688 snprintf(tmp, sizeof(tmp), "%s-%s", os, arch);
689 WRTS("arch", tmp);
686 i = 0; 690 i = 0;
687 EINA_LIST_FOREACH(build.tags, l, s) 691 EINA_LIST_FOREACH(build.tags, l, s)
688 { 692 {
@@ -1162,7 +1166,13 @@ _ipc2_cb_dat(void *data, int type, void *event)
1162 char tmp[4096]; 1166 char tmp[4096];
1163 1167
1164 down_file = file; 1168 down_file = file;
1165 snprintf(tmp, sizeof(tmp), "%s", down_file); 1169 snprintf(tmp, sizeof(tmp),
1170 "%s/Applications/.tmp",
1171 getenv("HOME"));
1172 ecore_file_mkpath(tmp);
1173 snprintf(tmp, sizeof(tmp),
1174 "%s/Applications/.tmp/%s",
1175 getenv("HOME"), down_file);
1166 if (ecore_file_exists(tmp)) 1176 if (ecore_file_exists(tmp))
1167 err("file already exists"); 1177 err("file already exists");
1168 down_f = fopen(file, "wb"); 1178 down_f = fopen(file, "wb");
@@ -1226,15 +1236,17 @@ main(int argc, char **argv)
1226 " src\n" 1236 " src\n"
1227 " bin\n" 1237 " bin\n"
1228 " extract FILE\n" 1238 " extract FILE\n"
1229 " install FILE\n" 1239 " inst FILE\n"
1230 " clean\n" 1240 " clean\n"
1231 " remove PKGNAME\n" 1241 " rm PKGNAME\n"
1232 " release [FILE]\n" 1242 " rel [FILE]\n"
1233 " down PKGNAME\n" 1243 " down PKGNAME\n"
1234 " get PKGNAME\n" 1244 " get PKGNAME\n"
1235// " list [CATEGORY]\n" 1245// " list [CATEGORY]\n"
1236// " search KEY1 [KEY2] [KEY3] [...]\n" 1246// " search KEY1 [KEY2] [KEY3] [...]\n"
1237// " new\n" 1247// " new\n"
1248// " getsrc\n"
1249 " check\n"
1238 "\n"); 1250 "\n");
1239 return -1; 1251 return -1;
1240 } 1252 }
@@ -1244,6 +1256,8 @@ main(int argc, char **argv)
1244 1256
1245 if (getenv("MRKHOST")) server = getenv("MRKHOST"); 1257 if (getenv("MRKHOST")) server = getenv("MRKHOST");
1246 if (getenv("MRKPORT")) server_port = atoi(getenv("MRKPORT")); 1258 if (getenv("MRKPORT")) server_port = atoi(getenv("MRKPORT"));
1259 if (getenv("MRKARCH")) arch = getenv("MRKARCH");
1260 if (getenv("MRKOS")) os = getenv("MRKOS");
1247 1261
1248 if (!strcmp(argv[1], "build")) 1262 if (!strcmp(argv[1], "build"))
1249 { 1263 {
@@ -1265,7 +1279,7 @@ main(int argc, char **argv)
1265 if (argc < 3) err("need file to extract"); 1279 if (argc < 3) err("need file to extract");
1266 if (!package_extract(argv[2])) return 1; 1280 if (!package_extract(argv[2])) return 1;
1267 } 1281 }
1268 else if (!strcmp(argv[1], "install")) 1282 else if (!strcmp(argv[1], "inst"))
1269 { 1283 {
1270 if (argc < 3) err("need file to install"); 1284 if (argc < 3) err("need file to install");
1271 package_clean(); 1285 package_clean();
@@ -1275,13 +1289,13 @@ main(int argc, char **argv)
1275 { 1289 {
1276 package_clean(); 1290 package_clean();
1277 } 1291 }
1278 else if (!strcmp(argv[1], "remove")) 1292 else if (!strcmp(argv[1], "rm"))
1279 { 1293 {
1280 if (argc < 3) err("need package to remove"); 1294 if (argc < 3) err("need package to remove");
1281 if (!package_remove(argv[2])) return 1; 1295 if (!package_remove(argv[2])) return 1;
1282 package_clean(); 1296 package_clean();
1283 } 1297 }
1284 else if (!strcmp(argv[1], "release")) 1298 else if (!strcmp(argv[1], "rel"))
1285 { 1299 {
1286 char tmp[4096]; 1300 char tmp[4096];
1287 char *pk; 1301 char *pk;
@@ -1313,6 +1327,36 @@ main(int argc, char **argv)
1313 if (!package_install(down_file)) return 1; 1327 if (!package_install(down_file)) return 1;
1314 ecore_file_unlink(down_file); 1328 ecore_file_unlink(down_file);
1315 } 1329 }
1330 else if (!strcmp(argv[1], "list"))
1331 {
1332 }
1333 else if (!strcmp(argv[1], "search"))
1334 {
1335 }
1336 else if (!strcmp(argv[1], "new"))
1337 {
1338 }
1339 else if (!strcmp(argv[1], "getsrc"))
1340 {
1341 }
1342 else if (!strcmp(argv[1], "check"))
1343 {
1344 char tmp[4096];
1345 ecore_file_recursive_rm("Marrakesh-Check");
1346 ecore_file_mkdir("Marrakesh-Check");
1347 if (!parse_bld("Marrakesh.mrk")) err("Parse build failed");
1348 if (!pakage_src("Marrakesh.mrk")) err("Source packaging failed");
1349 chdir("Marrakesh-Check");
1350 snprintf(tmp, sizeof(tmp), "../%s-%s.mks", build.name, build.version);
1351 if (!package_extract(tmp)) err("Source extract failed");
1352 memset(&build, 0, sizeof(Build));
1353 if (!parse_bld("Marrakesh.mrk")) err("Parse build 2 from source failed");
1354 if (!build_proj()) err("Build project failed");
1355 memset(&build, 0, sizeof(Build));
1356 if (!parse_bld("Marrakesh.mrk")) err("Parse build 3 failed");
1357 if (!pakage_bin()) err("Package binary failed");
1358 printf("OK\n");
1359 }
1316 else 1360 else
1317 { 1361 {
1318 err("unknown subcommand!"); 1362 err("unknown subcommand!");