GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
actions.c
Go to the documentation of this file.
1 
2 /***************************************************************************
3  * actions.c
4  *
5  * Mon Apr 18 15:25:54 2005
6  * Copyright 2005 Benjamin Ducke
7  ****************************************************************************/
8 
9 /*
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #include "globals.h"
26 #include <fcntl.h>
27 
28 
29 void check_extension(char *package, char *name, int *major, int *minor,
30  int *revision)
31 {
32  int error;
33  char tmp[MAXSTR] = "";
34  FILE *f;
35 
36  fprintf(stdout, "Checking extension ...");
37 
38  sprintf(tmp, "%s", package);
39  error = chdir(tmp);
40  if (error < 0) {
41  print_error(ERR_NO_ACCESS_EXT, "extension '%s' not accessible: %s\n",
42  package, strerror(errno));
43  }
44 
45  /* get file id */
46  f = fopen("id", "r");
47  if (f == NULL) {
48  print_error(ERR_INVALID_EXT, "'id' file not readable.\n");
49  }
50  else {
51  fscanf(f, "%[<GRASS extension package>] ", tmp);
52  if (strcmp("<GRASS extension package>", tmp)) {
53  fclose(f);
54  print_error(ERR_INVALID_EXT, "unknown file identifier.\n");
55  }
56  }
57  fclose(f);
58 
59  get_package_name(".", name);
60 
61  /* get extension version */
62  f = fopen("version", "r");
63  if (f == NULL) {
64  print_error(ERR_INVALID_EXT, "'version' file not readable.\n");
65  }
66  else {
67  nc_fgets_nb(tmp, MAXSTR, f);
68  *minor = 0;
69  *revision = 0;
70  error = sscanf(tmp, "%i.%i.%i", major, minor, revision);
71  if (error < 1) {
72  fclose(f);
74  "invalid or missing version information.\n");
75  }
76  }
77 
78  print_done();
79  chdir("..");
80  fclose(f);
81 }
82 
83 
84 /*
85  decompresses extension file and returns path to the temporary directory where the
86  extension has been stored.
87  */
88 void unpack_extension(char *package)
89 {
90  int error;
91  int fd;
92  char tmp[MAXSTR];
93  int ftype;
94 
95  fprintf(stdout, "Uncompressing files...");
96 
97  /* TODO: Do not hardcode temp paths */
98  strcpy(TMPDIR, "/tmp/grass.extension.XXXXXX"); /* tmpdir is a global variable */
99  mkstemp(TMPDIR);
100  fd = open(TMPDIR, O_CREAT, 0777);
101  if (fd == -1) {
103  "could not create temp directory name: %s",
104  strerror(errno));
105  exit(ERR_UNPACK_EXT);
106  }
107 
108  if (VERBOSE) {
109  fprintf(stdout, "\nUncompressing to: %s.\n", TMPDIR);
110  }
111 
112  /* remove tmp file and create a dir with the same name */
113  close(fd);
114  remove(TMPDIR);
115  mkdir_s(TMPDIR, "0700");
116 
117  atexit(&exit_tmp); /* now need to register an at exit func to remove tmpdir automatically! */
118 
119  /* uncompress extension to TMPDIR */
120  /* 1. copy file */
121  sprintf(tmp, "cp %s %s", package, TMPDIR);
122  error = system(tmp);
123  if (error < 0) {
125  "could not copy extension files to temp dir.\n");
126  exit(ERR_UNPACK_EXT);
127  }
128 
129  /* see what type of archive it is */
130  ftype = check_filetype(package);
131  if (ftype == TYPE_UNKNOWN) {
133  ("file name not '.tar.gz', '.tgz', '.tar.bz2', '.tbz' or '.zip'. Assuming '.tgz'.\n");
134  ftype = TAR_GZIP;
135  }
136  if (ftype == TAR_GZIP) {
137  if (VERBOSE) {
138  sprintf(tmp, "tar -xzvf %s/%s -C %s", TMPDIR, basename(package),
139  TMPDIR);
140  }
141  else {
142  sprintf(tmp, "tar -xzf %s/%s -C %s", TMPDIR, basename(package),
143  TMPDIR);
144  }
145  }
146  if (ftype == TAR_BZIP2) {
147  if (VERBOSE) {
148  sprintf(tmp, "tar -xjvf %s/%s -C %s", TMPDIR, basename(package),
149  TMPDIR);
150  }
151  else {
152  sprintf(tmp, "tar -xjvf %s/%s -C %s", TMPDIR, basename(package),
153  TMPDIR);
154  }
155  }
156  if (ftype == ZIP) {
157  if (VERBOSE) {
158  sprintf(tmp, "unzip %s/%s -d %s", TMPDIR, basename(package),
159  TMPDIR);
160  }
161  else {
162  sprintf(tmp, "unzip -qq %s/%s -d %s", TMPDIR, basename(package),
163  TMPDIR);
164  }
165  }
166  if (ftype == TAR) {
167  if (VERBOSE) {
168  sprintf(tmp, "tar -xvf %s/%s -C %s", TMPDIR, basename(package),
169  TMPDIR);
170  }
171  else {
172  sprintf(tmp, "tar -xf %s/%s -C %s", TMPDIR, basename(package),
173  TMPDIR);
174  }
175  }
176 
177  error = system(tmp);
178  if (error < 0) {
179  if (ftype == TAR_GZIP) {
181  "could not extract files using 'tar' and 'gzip'. \n \
182  Extract manually using 'tar -xzvf %s'.\n", package);
183  }
184  if (ftype == TAR_BZIP2) {
185  print_error(ERR_UNPACK_EXT, "could not extract files using 'tar' and 'bunzip2'.\n \
186  Extract manually using 'tar -xjvf %s'.\n",
187  package);
188  }
189  if (ftype == ZIP) {
190  print_error(ERR_UNPACK_EXT, "could not extract files using 'unzip'.\n \
191  Extract manually using 'unzip %s'.\n",
192  package);
193  }
194  exit(ERR_UNPACK_EXT);
195  }
196 
197  print_done();
198 }
199 
200 
201 void query_extension(char *package, char *name, int major, int minor,
202  int revision, char *short_name, char *invocation,
203  char *org_name)
204 {
205  int error;
206  char tmp[MAXSTR];
207 
208  sprintf(tmp, "%s", basename(package));
209  error = chdir(tmp);
210  if (error < 0) {
211  print_error(ERR_NO_ACCESS_EXT, "extension '%s' not accessible: %s\n",
212  package, strerror(errno));
213  }
214 
215  fprintf(stdout, "\nExtension '%s', version %i.%i.%i\n\n", name, major,
216  minor, revision);
217  dump_ascii("description", "Description");
218  dump_ascii("commands", "Commands provided");
219  dump_ascii("libs", "Libraries provided");
220  dump_ascii("headers", "Header files provided");
221  dump_ascii("depends", "Dependencies");
222  dump_ascii("bugs", "Bugs");
223  sprintf(tmp, "../%s", package);
224  list_binaries(tmp);
225  dump_ascii("authors", "Author(s)");
226 
227  fprintf(stdout, "Type '%s -d %s' to see more detailed information.\n",
228  invocation, org_name);
229  fprintf(stdout, "Type '%s -l %s' to see copyright information.\n",
230  invocation, org_name);
231 
232  /* run post action script */
233  system("sh post");
234 
235  exit(0);
236 
237 }
238 
239 /*
240  Dump contents of config.msg to screen
241  */
242 void print_cfg(void)
243 {
244  FILE *fp;
245  char line[MAXSTR];
246 
247  fp = fopen("config.msg", "r");
248  if (fp != NULL) {
249  fprintf(stdout, "\nResult of configuration: \n");
250  while (fgets(line, MAXSTR, fp) != NULL) {
251  fprintf(stdout, "%s", line);
252  }
253  fprintf(stdout, "\n");
254  }
255 
256  /* remove file afterward */
257  remove("config.msg");
258 }
259 
260 
261 /*
262  */
263 void source_install(char *package, char *gisbase, char *pkg_short_name,
264  int pkg_major, int pkg_minor, int pkg_revision,
265  char *grass_version)
266 {
267  char tmp[MAXSTR];
268  char dir[MAXSTR];
269  char install_cmd[MAXSTR];
270  char post_cmd[MAXSTR];
271  char sysstr[MAXSTR];
272  int error;
273  struct stat buf;
274  FILE *f;
275 
276  char *verstr;
277  char *grass_major;
278  char *grass_minor;
279  char *grass_revision;
280  int major, minor, revision;
281 
282  /* check for valid install directory */
283  error = stat(gisbase, &buf);
284  if (error < 0) {
285  print_error(ERR_INSTALL_EXT, "installation directory invalid: %s\n",
286  strerror(errno));
287  }
288 
289  /* export environment variables for GRASS 6 build system */
290  /* target dir for installation */
291  sprintf(GINSTALL_DST, "GINSTALL_DST=%s", gisbase);
292  putenv(GINSTALL_DST);
293  /*external include path */
294  sprintf(tmp, "%s/include", gisbase);
295  sprintf(GINSTALL_INC, "GINSTALL_INC=%s", tmp);
296  putenv(GINSTALL_INC);
297  /* external linker path */
298  sprintf(tmp, "%s/lib", gisbase);
299  sprintf(GINSTALL_LIB, "GINSTALL_LIB=%s", tmp);
300  putenv(GINSTALL_LIB);
301  /* path to install files */
302  sprintf(GEM_GRASS_DIR, "GEM_GRASS_DIR=%s", gisbase);
303  putenv(GEM_GRASS_DIR);
304 
305  /* extract GRASS major and minor version numbers */
306  verstr = strdup(grass_version);
307  grass_major = strtok(verstr, ".");
308  grass_minor = strtok(NULL, ".");
309  grass_revision = strtok(NULL, ".");
310  major = strtol(grass_major, NULL, 10);
311  minor = strtol(grass_minor, NULL, 10);
312  revision = strtol(grass_revision, NULL, 10);
313  free(verstr);
314 
315 
316  /* now need to register an exit function that unsets these env vars on termination! */
317  atexit(&exit_tmp);
318 
319  /* step into target directory and execute configure script */
320  sprintf(dir, "%s/src", basename(package));
321  error = chdir(dir);
322  if (error < 0) {
324  "extension files in '%s' not accessible: %s\n", package,
325  strerror(errno));
326  }
327 
328  if (!SKIP_CFG) {
329  if (VERBOSE) {
330  fprintf(stdout, "Running configure script:\n");
331  sprintf(sysstr, "sh %s %s", CONFIG_CMD, CONFIG_OPTS);
332  error = system(sysstr);
333  }
334  else {
335  fprintf(stdout, "Configuring...");
336  sprintf(sysstr, "sh %s %s --quiet &> %s", CONFIG_CMD, CONFIG_OPTS,
337  TMP_NULL);
338  error = system(sysstr);
339  }
340  if (error == -1) {
341  print_error(ERR_MISSING_CFG, "could not run configure script.\n");
342  }
343  if (error > 0) {
344  print_error(ERR_CONFIGURE_EXT, "system configuration failed.\n");
345  }
346  print_done();
347  print_cfg();
348  }
349 
350  /* export environment variables for generation of HTML documentation directories */
351  /* by include/Make/Rules.make */
352  sprintf(GEM_EXT_NAME, "GEM_EXT_NAME=%s", pkg_short_name);
353  putenv(GEM_EXT_NAME);
354  sprintf(tmp, "%i.%i.%i", pkg_major, pkg_minor, pkg_revision);
355  sprintf(GEM_EXT_VERSION, "GEM_EXT_VERSION=%s", tmp);
356  putenv(GEM_EXT_VERSION);
357  /* dump extension info text into two plain ASCII files for inclusion in HTML man page */
358  dump_html("../description", TMP_DESCR);
359  dump_html("../info", TMP_INFO);
360  dump_html("../depends", TMP_DEPS);
361  dump_html("../bugs", TMP_BUGS);
362  dump_html("../authors", TMP_AUTHORS);
363  sprintf(GEM_EXT_DESCR, "GEM_EXT_DESCR=%s", TMP_DESCR);
364  putenv(GEM_EXT_DESCR);
365  sprintf(GEM_EXT_INFO, "GEM_EXT_INFO=%s", TMP_INFO);
366  putenv(GEM_EXT_INFO);
367  sprintf(GEM_EXT_DEPS, "GEM_EXT_DEPS=%s", TMP_DEPS);
368  putenv(GEM_EXT_DEPS);
369  sprintf(GEM_EXT_BUGS, "GEM_EXT_BUGS=%s", TMP_BUGS);
370  putenv(GEM_EXT_BUGS);
371  sprintf(GEM_EXT_AUTHORS, "GEM_EXT_AUTHORS=%s", TMP_AUTHORS);
372  putenv(GEM_EXT_AUTHORS);
373 
374  /* now need to register an exit function that unsets these env vars on termination! */
375  atexit(&exit_tmp);
376 
377  /* check dependencies before compiling everything ... */
378  check_dependencies(package, gisbase, grass_version);
379 
380  /* now execute Makefile in top-level directory */
381  if (VERBOSE) {
382  fprintf(stdout, "Running '%s':\n", MAKE_CMD);
383  sprintf(sysstr, "%s -f Makefile", MAKE_CMD);
384  error = system(sysstr);
385  }
386  else {
387  fprintf(stdout, "Compiling...");
388  sprintf(sysstr, "%s -f Makefile &> %s", MAKE_CMD, TMP_NULL);
389  error = system(sysstr);
390  }
391  if (error == -1) {
392  if (!VERBOSE) {
394  "could not run '%s' do you have make tools installed?\n",
395  MAKE_CMD);
396  }
397  }
398  if (error > 0) {
399  print_error(ERR_COMPILE_EXT, "source code could not be compiled.\n \
400  Run again with option -v to see what is causing trouble.\n");
401  }
402  print_done();
403 
404  fprintf(stdout, "Installing...");
405 
406  /* check if an uninstall script exists */
407  f = fopen("../uninstall", "r");
408  if (f == NULL) {
409  print_warning("error checking for uninstall script: %s\n \
410  Uninstalling this extension may leave orphaned files on your system", strerror(errno));
411  }
412  else {
413  /* it does: create a shell command to copy it upon installation */
414  if (VERBOSE) {
415  sprintf(tmp, "cp -vf ../uninstall %s/etc/uninstall.%s ;", gisbase,
416  pkg_short_name);
417  strcpy(UNINSTALL_CMD, tmp);
418  }
419  else {
420  sprintf(tmp, "cp -f ../uninstall %s/etc/uninstall.%s &> %s ;",
421  gisbase, pkg_short_name, TMP_NULL);
422  strcpy(UNINSTALL_CMD, tmp);
423  }
424  fclose(f);
425  }
426 
427  register_extension(gisbase, "src", pkg_short_name, pkg_major, pkg_minor,
428  pkg_revision);
429 
430  check_dependencies(package, gisbase, grass_version);
431 
432  /* starting with GRASS 6.1.cvs, d.m uses the same menu system as gis.m */
433  if ((major == 6) && (minor < 1)) {
434  register_entries_gisman(pkg_short_name, gisbase);
435  }
436 
437  register_entries_gisman2(pkg_short_name, gisbase);
438 
439  register_html(pkg_short_name, gisbase, pkg_major, pkg_minor,
440  pkg_revision);
441 
442  /* create a shell command for the make install process and installation of extension.db */
443  if (VERBOSE) {
444  fprintf(stdout, "Running '%s install':\n", MAKE_CMD);
445  sprintf(install_cmd, "%s -f Makefile install ; \
446  cp -vf %s %s/etc/extensions.db ; chmod -v a+r %s/etc/extensions.db ;", MAKE_CMD, TMPDB, gisbase, gisbase);
447  }
448  else {
449  sprintf(install_cmd, "%s -f Makefile -s install &> %s ; \
450  cp -f %s %s/etc/extensions.db &> %s ; chmod a+r %s/etc/extensions.db &> %s ;", MAKE_CMD, TMP_NULL, TMPDB, gisbase, TMP_NULL, gisbase, TMP_NULL);
451  }
452 
453 
454  /* command to run post action script */
455  if (VERBOSE) {
456  sprintf(post_cmd, "sh ../post");
457  }
458  else {
459  sprintf(post_cmd, "sh ../post &> %s", TMP_NULL);
460  }
461 
462  /* make install */
463  sprintf(tmp, "%s %s %s %s %s %s", install_cmd, UNINSTALL_CMD, GISMAN_CMD,
464  GISMAN2_CMD, HTML_CMD, post_cmd);
465 
466  su(gisbase, tmp);
467 
468  print_done();
469 }
470 
471 
472 /*
473  Install everything from a directory with pre-compiled binaries.
474  */
475 void bin_install(char *package, char *gisbase, char *bins,
476  char *pkg_short_name, int pkg_major, int pkg_minor,
477  int pkg_revision, char *grass_version)
478 {
479  char tmp[MAXSTR];
480  char dir[MAXSTR];
481  char install_cmd[MAXSTR];
482  char post_cmd[MAXSTR];
483  int error;
484  struct stat buf;
485  FILE *f;
486 
487  char *verstr;
488  char *grass_major;
489  char *grass_minor;
490  char *grass_revision;
491  int major, minor, revision;
492 
493  /* check for valid install directory */
494  error = stat(gisbase, &buf);
495  if (error < 0) {
496  print_error(ERR_INSTALL_EXT, "installation directory invalid: %s\n",
497  strerror(errno));
498  }
499 
500  /* export environment variables for GRASS 6 build system */
501  /* target dir for installation */
502  sprintf(GINSTALL_DST, "GINSTALL_DST=%s", gisbase);
503  putenv(GINSTALL_DST);
504  /*external include path */
505  sprintf(tmp, "%s/include", gisbase);
506  sprintf(GINSTALL_INC, "GINSTALL_INC=%s", tmp);
507  putenv(GINSTALL_INC);
508  /* external linker path */
509  sprintf(tmp, "%s/lib", gisbase);
510  sprintf(GINSTALL_LIB, "GINSTALL_LIB=%s", tmp);
511  putenv(GINSTALL_LIB);
512  /* path to install files */
513  sprintf(GEM_GRASS_DIR, "GEM_GRASS_DIR=%s", gisbase);
514  putenv(GEM_GRASS_DIR);
515 
516  /* extract GRASS major and minor version numbers */
517  verstr = strdup(grass_version);
518  grass_major = strtok(verstr, ".");
519  grass_minor = strtok(NULL, ".");
520  grass_revision = strtok(NULL, ".");
521  major = strtol(grass_major, NULL, 10);
522  minor = strtol(grass_minor, NULL, 10);
523  revision = strtol(grass_revision, NULL, 10);
524  free(verstr);
525 
526 
527  /* now need to register an exit function that unsets these env vars on termination! */
528  atexit(&exit_tmp);
529 
530  /* step into target directory and execute configure script */
531  sprintf(dir, "%s/%s", basename(package), bins);
532  error = chdir(dir);
533  if (error < 0) {
535  "extension file binaries in '%s' not accessible: %s\n",
536  package, strerror(errno));
537  }
538 
539  /* export environment variables for generation of HTML documentation directories */
540  /* by include/Make/Rules.make */
541  sprintf(GEM_EXT_NAME, "GEM_EXT_NAME=%s", pkg_short_name);
542  putenv(GEM_EXT_NAME);
543  sprintf(tmp, "%i.%i.%i", pkg_major, pkg_minor, pkg_revision);
544  sprintf(GEM_EXT_VERSION, "GEM_EXT_VERSION=%s", tmp);
545  putenv(GEM_EXT_VERSION);
546  /* dump extension info text into two plain ASCII files for inclusion in HTML man page */
547  dump_html("../description", TMP_DESCR);
548  dump_html("../info", TMP_INFO);
549  dump_html("../depends", TMP_DEPS);
550  dump_html("../bugs", TMP_BUGS);
551  dump_html("../authors", TMP_AUTHORS);
552  sprintf(GEM_EXT_DESCR, "GEM_EXT_DESCR=%s", TMP_DESCR);
553  putenv(GEM_EXT_DESCR);
554  sprintf(GEM_EXT_INFO, "GEM_EXT_INFO=%s", TMP_INFO);
555  putenv(GEM_EXT_INFO);
556  sprintf(GEM_EXT_DEPS, "GEM_EXT_DEPS=%s", TMP_DEPS);
557  putenv(GEM_EXT_DEPS);
558  sprintf(GEM_EXT_BUGS, "GEM_EXT_BUGS=%s", TMP_BUGS);
559  putenv(GEM_EXT_BUGS);
560  sprintf(GEM_EXT_AUTHORS, "GEM_EXT_AUTHORS=%s", TMP_AUTHORS);
561  putenv(GEM_EXT_AUTHORS);
562 
563  /* now need to register an exit function that unsets these env vars on termination! */
564  atexit(&exit_tmp);
565 
566  /* check dependencies before installing ... */
567  check_dependencies(package, gisbase, grass_version);
568 
569  fprintf(stdout, "Installing...");
570 
571  /* check if an uninstall script exists */
572  f = fopen("../uninstall", "r");
573  if (f == NULL) {
574  print_warning("error checking for uninstall script: %s\n \
575  Uninstalling this extension may leave orphaned files on your system", strerror(errno));
576  }
577  else {
578  /* it does: create a shell command to copy it upon installation */
579  if (VERBOSE) {
580  sprintf(tmp, "cp -vf ../uninstall %s/etc/uninstall.%s ;", gisbase,
581  pkg_short_name);
582  strcpy(UNINSTALL_CMD, tmp);
583  }
584  else {
585  sprintf(tmp, "cp -f ../uninstall %s/etc/uninstall.%s &> %s ;",
586  gisbase, pkg_short_name, TMP_NULL);
587  strcpy(UNINSTALL_CMD, tmp);
588  }
589  fclose(f);
590  }
591 
592  register_extension(gisbase, bins, pkg_short_name, pkg_major, pkg_minor,
593  pkg_revision);
594  check_dependencies(package, gisbase, grass_version);
595 
596  /* starting with GRASS 6.1.cvs, d.m uses the same menu system as gis.m */
597  if ((major == 6) && (minor < 1)) {
598  register_entries_gisman(pkg_short_name, gisbase);
599  }
600 
601  register_entries_gisman2(pkg_short_name, gisbase);
602 
603  register_html(pkg_short_name, gisbase, pkg_major, pkg_minor,
604  pkg_revision);
605 
606  /* create a shell command for the make install process and installation of extension.db */
607  /* we will use a local copy of the make command for this (extension author has to supply it). */
608  if (VERBOSE) {
609  fprintf(stdout, "Running '%s install':\n", MAKE_CMD);
610  sprintf(install_cmd, "bin/%s -f Makefile install ; \
611  cp -vf %s %s/etc/extensions.db ; chmod -v a+r %s/etc/extensions.db ;", MAKE_CMD, TMPDB, gisbase, gisbase);
612  }
613  else {
614  sprintf(install_cmd, "bin/%s -f Makefile -s install &> %s ; \
615  cp -f %s %s/etc/extensions.db &> %s ; chmod a+r %s/etc/extensions.db &> %s ;", MAKE_CMD, TMP_NULL, TMPDB, gisbase, TMP_NULL, gisbase, TMP_NULL);
616  }
617 
618  /* command to run post action script */
619  if (VERBOSE) {
620  sprintf(post_cmd, "sh ../post");
621  }
622  else {
623  sprintf(post_cmd, "sh ../post &> %s", TMP_NULL);
624  }
625 
626  /* make install */
627  sprintf(tmp, "%s %s %s %s %s %s", install_cmd, UNINSTALL_CMD, GISMAN_CMD,
628  GISMAN2_CMD, HTML_CMD, post_cmd);
629 
630  su(gisbase, tmp);
631 
632  print_done();
633 }
634 
635 
636 void test_install(char *package, char *gisbase, char *pkg_short_name,
637  int pkg_major, int pkg_minor, int pkg_revision,
638  char *grass_version)
639 {
640 
641  char tmp[MAXSTR];
642  char dir[MAXSTR];
643  char sysstr[MAXSTR];
644  int error;
645  struct stat buf;
646  FILE *f;
647 
648  char *verstr;
649  char *grass_major;
650  char *grass_minor;
651  char *grass_revision;
652  int major, minor, revision;
653 
654  /* check for valid install directory */
655  error = stat(gisbase, &buf);
656  if (error < 0) {
657  print_error(ERR_INSTALL_EXT, "installation directory invalid: %s\n",
658  strerror(errno));
659  }
660 
661  /* export environment variables for GRASS 6 build system */
662  /* target dir for installation */
663  sprintf(GINSTALL_DST, "GINSTALL_DST=%s", gisbase);
664  putenv(GINSTALL_DST);
665  /*external include path */
666  sprintf(tmp, "%s/include", gisbase);
667  sprintf(GINSTALL_INC, "GINSTALL_INC=%s", tmp);
668  putenv(GINSTALL_INC);
669  /* external linker path */
670  sprintf(tmp, "%s/lib", gisbase);
671  sprintf(GINSTALL_LIB, "GINSTALL_LIB=%s", tmp);
672  putenv(GINSTALL_LIB);
673  /* path to install files */
674  sprintf(GEM_GRASS_DIR, "GEM_GRASS_DIR=%s", gisbase);
675  putenv(GEM_GRASS_DIR);
676 
677  /* extract GRASS major and minor version numbers */
678  verstr = strdup(grass_version);
679  grass_major = strtok(verstr, ".");
680  grass_minor = strtok(NULL, ".");
681  grass_revision = strtok(NULL, ".");
682  major = strtol(grass_major, NULL, 10);
683  minor = strtol(grass_minor, NULL, 10);
684  revision = strtol(grass_revision, NULL, 10);
685  free(verstr);
686 
687  /* now need to register an exit function that unsets these env vars on termination! */
688  atexit(&exit_tmp);
689 
690  /* step into target directory and execute configure script */
691  sprintf(dir, "%s/src", basename(package));
692  error = chdir(dir);
693  if (error < 0) {
695  "extension files in '%s' not accessible: %s\n", package,
696  strerror(errno));
697  }
698 
699  if (!SKIP_CFG) {
700  if (VERBOSE) {
701  fprintf(stdout, "Running configure script:\n");
702  sprintf(sysstr, "sh %s %s", CONFIG_CMD, CONFIG_OPTS);
703  error = system(sysstr);
704  }
705  else {
706  fprintf(stdout, "Configuring...");
707  sprintf(sysstr, "sh %s %s --quiet &> %s", CONFIG_CMD, CONFIG_OPTS,
708  TMP_NULL);
709  error = system(sysstr);
710  }
711  if (error == -1) {
712  print_error(ERR_MISSING_CFG, "could not run configure script.\n");
713  }
714  if (error > 0) {
715  print_error(ERR_CONFIGURE_EXT, "system configuration failed.\n");
716  }
717  print_done();
718  print_cfg();
719  }
720 
721  /* export environment variables for generation of HTML documentation directories */
722  /* by include/Make/Rules.make */
723  sprintf(GEM_EXT_NAME, "GEM_EXT_NAME=%s", pkg_short_name);
724  putenv(GEM_EXT_NAME);
725  sprintf(tmp, "%i.%i.%i", pkg_major, pkg_minor, pkg_revision);
726  sprintf(GEM_EXT_VERSION, "GEM_EXT_VERSION=%s", tmp);
727  putenv(GEM_EXT_VERSION);
728  /* dump extension info text into two plain ASCII files for inclusion in HTML man page */
729  dump_plain("../description", TMP_DESCR);
730  dump_plain("../info", TMP_INFO);
731  dump_plain("../depends", TMP_DEPS);
732  dump_plain("../bugs", TMP_BUGS);
733  dump_plain("../authors", TMP_AUTHORS);
734  sprintf(GEM_EXT_DESCR, "GEM_EXT_DESCR=%s", TMP_DESCR);
735  putenv(GEM_EXT_DESCR);
736  sprintf(GEM_EXT_INFO, "GEM_EXT_INFO=%s", TMP_INFO);
737  putenv(GEM_EXT_INFO);
738  sprintf(GEM_EXT_DEPS, "GEM_EXT_DEPS=%s", TMP_DEPS);
739  putenv(GEM_EXT_DEPS);
740  sprintf(GEM_EXT_BUGS, "GEM_EXT_BUGS=%s", TMP_BUGS);
741  putenv(GEM_EXT_BUGS);
742  sprintf(GEM_EXT_AUTHORS, "GEM_EXT_AUTHORS=%s", TMP_AUTHORS);
743  putenv(GEM_EXT_AUTHORS);
744 
745  /* now need to register an exit function that unsets these env vars on termination! */
746  atexit(&exit_tmp);
747 
748  /* check dependencies before compiling everything ... */
749  check_dependencies(package, gisbase, grass_version);
750 
751  /* now execute Makefile in top-level directory */
752  if (VERBOSE) {
753  fprintf(stdout, "Running '%s':\n", MAKE_CMD);
754  sprintf(sysstr, "%s -f Makefile", MAKE_CMD);
755  error = system(sysstr);
756 
757  }
758  else {
759  fprintf(stdout, "Compiling...");
760  sprintf(sysstr, "%s -f Makefile &> %s", MAKE_CMD, TMP_NULL);
761  error = system(sysstr);
762  }
763  if (error == -1) {
764  if (!VERBOSE) {
766  "could not run '%s' do you have make tools installed?\n",
767  MAKE_CMD);
768  }
769  }
770  if (error > 0) {
771  print_error(ERR_COMPILE_EXT, "source code could not be compiled.\n \
772  Run again with option -v to see what is causing trouble.\n");
773  }
774  print_done();
775 
776  fprintf(stdout, "Installing...");
777 
778  /* check if an uninstall script exists */
779  f = fopen("../uninstall", "r");
780  if (f == NULL) {
781  print_warning("error checking for uninstall script: %s\n \
782  Uninstalling this extension may leave orphaned files on your system", strerror(errno));
783  }
784  else {
785  fclose(f);
786  }
787 
788  register_extension(gisbase, "src", pkg_short_name, pkg_major, pkg_minor,
789  pkg_revision);
790  check_dependencies(package, gisbase, grass_version);
791 
792  /* starting with GRASS 6.1.cvs, d.m uses the same menu system as gis.m */
793  if ((major == 6) && (minor < 1)) {
794  register_entries_gisman(pkg_short_name, gisbase);
795  }
796 
797  register_entries_gisman2(pkg_short_name, gisbase);
798 
799  register_html(pkg_short_name, gisbase, pkg_major, pkg_minor,
800  pkg_revision);
801 
802  fprintf(stdout, "(skipping '%s install')...", MAKE_CMD);
803 
804  print_done();
805 }
806 
807 
808 /*
809  Run the uninstall script that was (hopefully) provided by the packager.
810  Check for unsatisfied dependencies and warn/abort accordingly.
811  */
812 void uninstall(char *package, char *pkg_short_name, char *gisbase,
813  char *grass_version)
814 {
815  char tmp[MAXSTR];
816  char script[MAXSTR];
817  int error;
818  struct stat buf;
819  int no_script;
820 
821  char *verstr;
822  char *grass_major;
823  char *grass_minor;
824  char *grass_revision;
825  int major, minor, revision;
826 
827  fprintf(stdout, "Un-installing...");
828 
829  /* export environment variables for uninstall script */
830  sprintf(UNINSTALL_BASE, "UNINSTALL_BASE=%s", gisbase);
831  putenv(UNINSTALL_BASE);
832 
833  /* extract GRASS major and minor version numbers */
834  verstr = strdup(grass_version);
835  grass_major = strtok(verstr, ".");
836  grass_minor = strtok(NULL, ".");
837  grass_revision = strtok(NULL, ".");
838  major = strtol(grass_major, NULL, 10);
839  minor = strtol(grass_minor, NULL, 10);
840  revision = strtol(grass_revision, NULL, 10);
841  free(verstr);
842 
843  /* now need to register an exit function that unsets these env vars on termination! */
844  atexit(&exit_tmp);
845 
846  /* deregister extension */
847  deregister_extension(package, pkg_short_name, gisbase);
848 
849  /* deregister menu entries in GIS Manager */
850  /* starting with GRASS 6.1.cvs, d.m uses the same menu system as gis.m */
851  if ((major == 6) && (minor < 1)) {
852  error = deregister_entries_gisman(pkg_short_name, gisbase);
853  if (error == -1) {
854  print_warning("GIS Manager menu entries could not be removed.\n");
855  strcpy(GISMAN_CMD, "");
856  }
857  if (error == 0) {
858  print_warning("no entries found to remove from GIS Manager.\n");
859  strcpy(GISMAN_CMD, "");
860  }
861  }
862 
863  /* deregister menu entries in GIS Manager 2 */
864  deregister_entries_gisman2(pkg_short_name, gisbase);
865 
866  /* deregister HTML entries and delete man pages */
867  deregister_html(pkg_short_name, gisbase);
868 
869  /* check if an uninstall script exists */
870  sprintf(script, "%s/etc/uninstall.%s", gisbase, pkg_short_name);
871  no_script = 0;
872  error = stat(script, &buf);
873  if (error < 0) {
874  print_warning("no uninstall script available for this extension.\n \
875  Unneeded files may have been left on your system.\n");
876  no_script = 1;
877  }
878  if (no_script) {
879  print_warning("error checking for uninstall script: %s\n \
880  Uninstalling this extension may leave orphaned files on your system", strerror(errno));
881  }
882  else {
883  /* it does: create a shell command to execute and then delete it upon de-installation */
884  if (VERBOSE) {
885  sprintf(tmp, "sh %s ; rm -vf %s ; \
886  rm -vrf %s/docs/extensions/%s ; rm -vf %s/etc/dm/gem-entries/%s ; \
887  cp -vf %s %s/etc/extensions.db ; chmod -v a+r %s/etc/extensions.db ;", script, script, gisbase, pkg_short_name, gisbase, pkg_short_name, TMPDB, gisbase, gisbase);
888  strcpy(UNINSTALL_CMD, tmp);
889  }
890  else {
891  sprintf(tmp, "sh %s &> %s ; rm -vf %s &> %s ; \
892  rm -vrf %s/docs/extensions/%s &> %s ; rm -vf %s/etc/dm/gem-entries/%s &> %s ; \
893  cp -vf %s %s/etc/extensions.db &> %s ; chmod -v a+r %s/etc/extensions.db &> %s ;", script, TMP_NULL, script, TMP_NULL, gisbase, pkg_short_name, TMP_NULL, gisbase, pkg_short_name, TMP_NULL, TMPDB, gisbase, TMP_NULL, gisbase, TMP_NULL);
894  strcpy(UNINSTALL_CMD, tmp);
895  }
896  }
897 
898  /* do the uninstall! */
899  sprintf(tmp, "%s %s %s", UNINSTALL_CMD, GISMAN_CMD, HTML_CMD);
900 
901  su(gisbase, tmp);
902 
903  print_done();
904 }
905 
906 
907 int source_clean(char *package)
908 {
909  char dir[MAXSTR];
910  char sysstr[MAXSTR];
911  int error;
912 
913  /* step into target directory */
914  sprintf(dir, "%s/src", basename(package));
915  error = chdir(dir);
916  if (error < 0) {
917  print_error(ERR_NO_ACCESS_EXT, "extension '%s' not accessible: ",
918  package);
919  }
920 
921  /* now execute Makefile and 'clean' from top-level directory */
922  if (VERBOSE) {
923  fprintf(stdout, "Running '%s clean':\n", MAKE_CMD);
924  sprintf(sysstr, "%s -f Makefile clean", MAKE_CMD);
925  error = system(sysstr);
926  }
927  else {
928  fprintf(stdout, "Cleaning up...");
929  sprintf(sysstr, "%s -f Makefile -s clean &> %s", MAKE_CMD, TMP_NULL);
930  error = system(sysstr);
931  }
932 
933  if (error == -1) {
935  "could not run '%s clean' do you have make tools installed?\n",
936  MAKE_CMD);
937  }
938  else {
939  print_done();
940  }
941 
942  /* run post action script */
943  system("sh ../post");
944 
945  return (0);
946 }
947 
948 
949 /*
950  Restores HTML links and GIS Manager menus, e.g. after an update of GRASS
951  */
952 void restore(char *gisbase, char *grass_version)
953 {
954  int num_restored;
955  char tmp[MAXSTR];
956 
957  char *verstr;
958  char *grass_major;
959  char *grass_minor;
960  char *grass_revision;
961  int major, minor, revision;
962 
963 
964  /* extract GRASS major and minor version numbers */
965  verstr = strdup(grass_version);
966  grass_major = strtok(verstr, ".");
967  grass_minor = strtok(NULL, ".");
968  grass_revision = strtok(NULL, ".");
969  major = strtol(grass_major, NULL, 10);
970  minor = strtol(grass_minor, NULL, 10);
971  revision = strtol(grass_revision, NULL, 10);
972  free(verstr);
973 
974  fprintf(stdout, "Restoring...");
975 
976  /* starting with GRASS 6.1.cvs, d.m uses the same menu system as gis.m */
977  if ((major == 6) && (minor < 1)) {
978  num_restored = restore_entries_gisman(gisbase);
979  if (VERBOSE) {
980  fprintf(stdout, "\nRestored entries for GIS Manager: %i\n",
981  num_restored);
982  }
983  }
984 
985  num_restored = restore_html(gisbase);
986  if (VERBOSE) {
987  fprintf(stdout, "\nRestored links in index.hml: %i\n", num_restored);
988  }
989 
990  if (num_restored > 0) {
991  /* copy restored files to GRASS install tree */
992  if (VERBOSE) {
993  sprintf(tmp,
994  "cp -f %s %s/etc/dm/menu.tcl ; chmod a+r %s/etc/dm/menu.tcl ; \
995  cp -f %s %s/docs/html/index.html ; chmod a+r %s/docs/html/index.html",
996  TMP_GISMAN, gisbase, gisbase, TMP_HTML, gisbase, gisbase);
997  }
998  else {
999  sprintf(tmp,
1000  "cp -f %s %s/etc/dm/menu.tcl ; chmod a+r %s/etc/dm/menu.tcl &> %s ; \
1001  cp -f %s %s/docs/html/index.html ; chmod a+r %s/docs/html/index.html",
1002  TMP_GISMAN, gisbase, gisbase, TMP_NULL, TMP_HTML, gisbase,
1003  gisbase);
1004  }
1005 
1006  su(gisbase, tmp);
1007 
1008  }
1009 
1010  if (num_restored == 0) {
1011  print_error(ERR_RESTORE, "could not find anything to restore.\n");
1012  }
1013  else {
1014  print_done();
1015  }
1016 }
1017 
1018 
1019 /*
1020  List all extensions installed on system with versions and dependencies
1021  */
1023 {
1024  char file[MAXSTR];
1025  FILE *f_in;
1026 
1027  fprintf(stdout, "\nExtensions in '%s' (name, version, type, depends):\n",
1028  gisbase);
1029 
1030  /* check, if extensions.db exists and is readable */
1031  sprintf(file, "%s/etc/extensions.db", gisbase);
1032  f_in = fopen(file, "r");
1033  if (f_in == NULL) {
1034  if (errno == ENOENT) {
1035  /* file does not yet exist */
1036  fprintf(stderr, "NONE.\n");
1037  fclose(f_in);
1038  exit(0);
1039  }
1040  else {
1041  /* sth. strange happened */
1042  fclose(f_in);
1043  print_error(ERR_LIST, "checking for file '%s': %s\n", file,
1044  strerror(errno));
1045  }
1046  }
1047  fclose(f_in);
1048 
1049  dump_ascii(file, "");
1050 }
1051 
1052 
1053 /*
1054  A bit of a misnomer: this does not actually run the post
1055  script but it exports all necessary env vars.
1056  */
1057 void run_post(char *package, int action, char *bins, char *gisbase)
1058 {
1059  char tmp[MAXSTR];
1060  char tmp2[MAXSTR];
1061 
1062  switch (action) {
1063  case INSTALL:
1064  sprintf(GEM_ACTION, "GEM_ACTION=INSTALL");
1065  break;
1066  case BIN_INSTALL:
1067  sprintf(GEM_ACTION, "GEM_ACTION=INSTALL");
1068  break;
1069  case QUERY:
1070  sprintf(GEM_ACTION, "GEM_ACTION=QUERY");
1071  break;
1072  case CLEAN:
1073  sprintf(GEM_ACTION, "GEM_ACTION=CLEAN");
1074  break;
1075  case LICENSE:
1076  sprintf(GEM_ACTION, "GEM_ACTION=LICENSE");
1077  break;
1078  case DETAILS:
1079  sprintf(GEM_ACTION, "GEM_ACTION=DETAILS");
1080  break;
1081  default:
1082  break;
1083  }
1084  putenv(GEM_ACTION);
1085 
1086  if (gisbase != NULL) {
1087  sprintf(INSTALL_BASE, "INSTALL_BASE=%s", gisbase);
1088  }
1089  else {
1090  sprintf(INSTALL_BASE, "INSTALL_BASE=UNDEFINED");
1091  }
1092  putenv(INSTALL_BASE);
1093 
1094  /* export absolute path to current working dir */
1095  getcwd(tmp, MAXSTR);
1096  sprintf(tmp2, "%s/%s/src", tmp, basename(package));
1097  sprintf(EXT_BASE, "EXT_BASE=%s", tmp2);
1098  putenv(EXT_BASE);
1099 
1100  if (bins == NULL) {
1101  sprintf(INSTALL_TYPE, "INSTALL_TYPE=src");
1102  }
1103  else {
1104  sprintf(INSTALL_TYPE, "INSTALL_TYPE=%s", bins);
1105  }
1106  putenv(INSTALL_TYPE);
1107 
1108  sprintf(tmp, "%i", FORCE);
1109  sprintf(GEM_FORCE, "GEM_FORCE=%s", tmp);
1110  putenv(GEM_FORCE);
1111 
1112  sprintf(tmp, "%i", VERBOSE);
1113  sprintf(GEM_VERBOSE, "GEM_VERBOSE=%s", tmp);
1114  putenv(GEM_VERBOSE);
1115 
1116  sprintf(GEM_GUI, "GEM_GUI=0");
1117  putenv(GEM_GUI);
1118 
1119 
1120  /* now need to register an exit function that unsets these env vars on termination! */
1121  atexit(&exit_tmp);
1122 }
EXTERN int VERBOSE
Definition: globals.h:147
void query_extension(char *package, char *name, int major, int minor, int revision, char *short_name, char *invocation, char *org_name)
Definition: actions.c:201
#define TYPE_UNKNOWN
Definition: globals.h:111
void register_extension(char *gisbase, char *bins, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision)
Definition: reg_deps.c:87
void source_install(char *package, char *gisbase, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision, char *grass_version)
Definition: actions.c:263
int restore_entries_gisman(char *gisbase)
Definition: reg_entries.c:692
EXTERN char GINSTALL_LIB[MAXSTR]
Definition: globals.h:126
EXTERN int SKIP_CFG
Definition: globals.h:163
void list_extensions(char *gisbase)
Definition: actions.c:1022
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * basename(char *path)
Definition: tools.c:33
#define LICENSE
Definition: globals.h:69
void print_done(void)
Definition: gem/error.c:70
EXTERN char INSTALL_TYPE[MAXSTR]
Definition: globals.h:138
void bin_install(char *package, char *gisbase, char *bins, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision, char *grass_version)
Definition: actions.c:475
#define DETAILS
Definition: globals.h:71
EXTERN char GEM_VERBOSE[MAXSTR]
Definition: globals.h:140
EXTERN char GEM_EXT_BUGS[MAXSTR]
Definition: globals.h:133
EXTERN char CONFIG_OPTS[MAXSTR]
Definition: globals.h:170
string action
#define MAXSTR
Definition: globals.h:59
#define ERR_MISSING_CMD
Definition: globals.h:85
#define TAR_GZIP
Definition: globals.h:112
EXTERN char CONFIG_CMD[MAXSTR]
Definition: globals.h:171
FILE * fd
Definition: g3dcolor.c:368
void get_package_name(char *path, char *name)
Definition: tools.c:273
string name
Definition: render.py:1314
EXTERN char TMPDIR[MAXSTR]
Definition: globals.h:148
EXTERN char GISMAN2_CMD[MAXSTR]
Definition: globals.h:166
EXTERN char TMP_NULL[MAXSTR]
Definition: globals.h:156
EXTERN char GEM_EXT_INFO[MAXSTR]
Definition: globals.h:131
void print_error(int err_code, char *msg,...)
Definition: gem/error.c:32
#define QUERY
Definition: globals.h:67
void uninstall(char *package, char *pkg_short_name, char *gisbase, char *grass_version)
Definition: actions.c:812
void dump_html(char *file, char *tmpfile)
Definition: tools.c:597
#define BIN_INSTALL
Definition: globals.h:66
EXTERN char TMP_HTML[MAXSTR]
Definition: globals.h:158
#define TAR_BZIP2
Definition: globals.h:113
void mkdir_s(char *pathname, char *mode)
Definition: tools.c:73
void test_install(char *package, char *gisbase, char *pkg_short_name, int pkg_major, int pkg_minor, int pkg_revision, char *grass_version)
Definition: actions.c:636
EXTERN char GEM_ACTION[MAXSTR]
Definition: globals.h:136
tuple gisbase
Definition: forms.py:59
int check_filetype(char *myfile)
Definition: tools.c:737
#define ERR_COMPILE_EXT
Definition: globals.h:80
void deregister_html(char *pkg_short_name, char *gisbase)
Definition: reg_html.c:271
EXTERN char GEM_EXT_DESCR[MAXSTR]
Definition: globals.h:130
void unpack_extension(char *package)
Definition: actions.c:88
void deregister_extension(char *package, char *pkg_short_name, char *gisbase)
Definition: reg_deps.c:235
#define TAR
Definition: globals.h:115
EXTERN char UNINSTALL_CMD[MAXSTR]
Definition: globals.h:169
EXTERN char GEM_EXT_DEPS[MAXSTR]
Definition: globals.h:132
int deregister_entries_gisman(char *pkg_short_name, char *gisbase)
Definition: reg_entries.c:461
void register_entries_gisman(char *pkg_short_name, char *gisbase)
Definition: reg_entries.c:232
#define ERR_INSTALL_EXT
Definition: globals.h:81
void print_cfg(void)
Definition: actions.c:242
EXTERN char TMP_AUTHORS[MAXSTR]
Definition: globals.h:155
int stat
Definition: g3dcolor.c:369
#define ERR_CONFIGURE_EXT
Definition: globals.h:79
EXTERN char TMP_BUGS[MAXSTR]
Definition: globals.h:154
void exit_tmp(void)
Definition: at_exit_funcs.c:62
void list_binaries(char *package)
Definition: tools.c:642
EXTERN char HTML_CMD[MAXSTR]
Definition: globals.h:167
EXTERN char GINSTALL_DST[MAXSTR]
Definition: globals.h:124
void check_extension(char *package, char *name, int *major, int *minor, int *revision)
Definition: actions.c:29
EXTERN char UNINSTALL_BASE[MAXSTR]
Definition: globals.h:127
#define ERR_INVALID_EXT
Definition: globals.h:82
void register_html(char *pkg_short_name, char *gisbase, int major, int minor, int revision)
Definition: reg_html.c:169
#define CLEAN
Definition: globals.h:68
EXTERN char GEM_EXT_NAME[MAXSTR]
Definition: globals.h:128
EXTERN char TMP_DESCR[MAXSTR]
Definition: globals.h:151
void deregister_entries_gisman2(char *pkg_short_name, char *gisbase)
Definition: reg_entries.c:653
#define ERR_NO_ACCESS_EXT
Definition: globals.h:78
EXTERN char TMPDB[MAXSTR]
Definition: globals.h:149
void restore(char *gisbase, char *grass_version)
Definition: actions.c:952
void run_post(char *package, int action, char *bins, char *gisbase)
Definition: actions.c:1057
EXTERN char MAKE_CMD[MAXSTR]
Definition: globals.h:172
EXTERN int FORCE
Definition: globals.h:161
#define INSTALL
Definition: globals.h:65
EXTERN char GEM_EXT_AUTHORS[MAXSTR]
Definition: globals.h:134
void print_warning(char *msg,...)
Definition: gem/error.c:52
return NULL
Definition: dbfopen.c:1394
EXTERN char GEM_GUI[MAXSTR]
Definition: globals.h:141
#define ERR_MISSING_CFG
Definition: globals.h:103
#define ERR_UNPACK_EXT
Definition: globals.h:83
EXTERN char EXT_BASE[MAXSTR]
Definition: globals.h:143
EXTERN char GINSTALL_INC[MAXSTR]
Definition: globals.h:125
#define ERR_LIST
Definition: globals.h:105
void dump_ascii(char *file, char *heading)
Definition: tools.c:539
fclose(fd)
EXTERN char TMP_INFO[MAXSTR]
Definition: globals.h:152
void free(void *)
#define file
EXTERN char INSTALL_BASE[MAXSTR]
Definition: globals.h:137
void su(char *gisbase, char *cmd)
Definition: tools.c:796
#define ZIP
Definition: globals.h:114
EXTERN char GEM_FORCE[MAXSTR]
Definition: globals.h:139
void register_entries_gisman2(char *pkg_short_name, char *gisbase)
Definition: reg_entries.c:415
EXTERN char TMP_DEPS[MAXSTR]
Definition: globals.h:153
int errno
EXTERN char GEM_GRASS_DIR[MAXSTR]
Definition: globals.h:135
int source_clean(char *package)
Definition: actions.c:907
int restore_html(char *gisbase)
Definition: reg_html.c:374
EXTERN char GEM_EXT_VERSION[MAXSTR]
Definition: globals.h:129
char * nc_fgets_nb(char *s, int size, FILE *stream)
Definition: tools.c:500
EXTERN char GISMAN_CMD[MAXSTR]
Definition: globals.h:165
void dump_plain(char *file, char *tmpfile)
Definition: tools.c:563
#define ERR_RESTORE
Definition: globals.h:102
void check_dependencies(char *package, char *gisbase, char *grass_version)
Definition: reg_deps.c:340
EXTERN char TMP_GISMAN[MAXSTR]
Definition: globals.h:150