merge the formfield patch from ooo-build
[ooovba.git] / epm / epm-3.7.patch
blob116aa28f6690ae0a7f36c0e05d1e5ad5335e15ac
1 *** misc/epm-3.7/bsd.c Tue Jan 14 18:05:01 2003
2 --- misc/build/epm-3.7/bsd.c Mon Nov 20 14:54:51 2006
3 ***************
4 *** 26,31 ****
5 --- 26,38 ----
7 #include "epm.h"
9 + void cr2semicolon(char *command)
10 + {
11 + int len, i;
12 + len=strlen(command);
13 + for (i=0;i<len;i++)
14 + if(*(command+i)=='\n') *(command+i)=';';
15 + }
18 * 'make_bsd()' - Make a FreeBSD software distribution package.
19 ***************
20 *** 149,156 ****
21 --- 156,172 ----
23 for (i = dist->num_depends, d = dist->depends; i > 0; i --, d ++)
25 + #ifdef __FreeBSD__
26 + if (d->type == DEPEND_REQUIRES) {
27 + if (dist->relnumber)
28 + fprintf(fp, "@pkgdep %s-%s-%d-%s", d->product, dist->version, dist->relnumber, platname);
29 + else
30 + fprintf(fp, "@pkgdep %s-%s-%s", d->product, dist->version, platname);
31 + }
32 + #else
33 if (d->type == DEPEND_REQUIRES)
34 fprintf(fp, "@pkgdep %s", d->product);
35 + #endif
36 else
37 #ifdef __FreeBSD__
39 ***************
40 *** 179,187 ****
41 --- 195,205 ----
42 " by the BSD packager.\n", stderr);
43 break;
44 case COMMAND_POST_INSTALL :
45 + cr2semicolon(c->command);
46 fprintf(fp, "@exec %s\n", c->command);
47 break;
48 case COMMAND_PRE_REMOVE :
49 + cr2semicolon(c->command);
50 fprintf(fp, "@unexec %s\n", c->command);
51 break;
52 case COMMAND_POST_REMOVE :
53 ***************
54 *** 199,205 ****
57 fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst);
58 ! fprintf(fp, "@exec /bin/chown %s:%s %s\n", file->user, file->group,
59 file->dst);
60 fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst);
62 --- 217,223 ----
65 fprintf(fp, "@exec /bin/mkdir -p %s\n", file->dst);
66 ! fprintf(fp, "@exec /usr/sbin/chown %s:%s %s\n", file->user, file->group,
67 file->dst);
68 fprintf(fp, "@exec /bin/chmod %04o %s\n", file->mode, file->dst);
70 ***************
71 *** 326,337 ****
72 if (Verbosity)
73 puts("Building FreeBSD pkg binary distribution...");
75 ! if (run_command(NULL, "pkg_create -p / -s %s -c %s -d %s -f %s %s",
76 current, commentname, descrname, plistname, name))
77 return (1);
79 ! if (run_command(NULL, "mv %s.tgz %s", name, directory))
80 ! return (1);
83 * Remove temporary files...
84 --- 344,356 ----
85 if (Verbosity)
86 puts("Building FreeBSD pkg binary distribution...");
88 ! if (run_command(NULL, "/usr/sbin/pkg_create -p / -s %s -c %s -d %s -f %s %s",
89 current, commentname, descrname, plistname, name))
90 return (1);
92 ! if (run_command(NULL, "mv %s.tbz %s", name, directory))
93 ! if (run_command(NULL, "mv %s.tgz %s", name, directory))
94 ! return (1);
97 * Remove temporary files...
98 *** misc/epm-3.7/configure Thu Jul 24 03:20:54 2003
99 --- misc/build/epm-3.7/configure Mon Nov 20 15:01:11 2006
100 ***************
101 *** 1238,1244 ****
102 --- 1238,1249 ----
106 + # Check whether --enable-fltk or --disable-fltk was given.
107 + if test "${enable_fltk+set}" = set; then
108 + enableval="$enable_fltk"
109 + fi;
112 # Check whether --with-docdir or --without-docdir was given.
113 if test "${with_docdir+set}" = set; then
114 withval="$with_docdir"
115 ***************
116 *** 4904,4939 ****
120 ! # Extract the first word of "fltk-config", so it can be a program name with args.
121 ! set dummy fltk-config; ac_word=$2
122 ! echo "$as_me:$LINENO: checking for $ac_word" >&5
123 ! echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
124 ! if test "${ac_cv_path_FLTKCONFIG+set}" = set; then
125 ! echo $ECHO_N "(cached) $ECHO_C" >&6
126 ! else
127 ! case $FLTKCONFIG in
128 ! [\\/]* | ?:[\\/]*)
129 ! ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path.
130 ! ;;
131 ! *)
132 ! as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
133 ! for as_dir in $PATH
134 ! do
135 ! IFS=$as_save_IFS
136 ! test -z "$as_dir" && as_dir=.
137 ! for ac_exec_ext in '' $ac_executable_extensions; do
138 ! if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
139 ! ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext"
140 ! echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
141 ! break 2
143 ! done
144 ! done
146 ! ;;
147 ! esac
149 - FLTKCONFIG=$ac_cv_path_FLTKCONFIG
151 if test -n "$FLTKCONFIG"; then
152 echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5
153 --- 4909,4946 ----
157 ! if eval "test x$enable_fltk = xyes"; then
158 ! # Extract the first word of "fltk-config", so it can be a program name with args.
159 ! set dummy fltk-config; ac_word=$2
160 ! echo "$as_me:$LINENO: checking for $ac_word" >&5
161 ! echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
162 ! if test "${ac_cv_path_FLTKCONFIG+set}" = set; then
163 ! echo $ECHO_N "(cached) $ECHO_C" >&6
164 ! else
165 ! case $FLTKCONFIG in
166 ! [\\/]* | ?:[\\/]*)
167 ! ac_cv_path_FLTKCONFIG="$FLTKCONFIG" # Let the user override the test with a path.
168 ! ;;
169 ! *)
170 ! as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
171 ! for as_dir in $PATH
172 ! do
173 ! IFS=$as_save_IFS
174 ! test -z "$as_dir" && as_dir=.
175 ! for ac_exec_ext in '' $ac_executable_extensions; do
176 ! if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
177 ! ac_cv_path_FLTKCONFIG="$as_dir/$ac_word$ac_exec_ext"
178 ! echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
179 ! break 2
180 ! fi
181 ! done
182 ! done
184 ! ;;
185 ! esac
187 ! FLTKCONFIG=$ac_cv_path_FLTKCONFIG
190 if test -n "$FLTKCONFIG"; then
191 echo "$as_me:$LINENO: result: $FLTKCONFIG" >&5
192 ***************
193 *** 4950,4957 ****
194 --- 4957,4966 ----
195 INSTALL_GUIS=""
196 INSTALL_OSX=""
198 + if eval "test x$enable_fltk = xyes"; then
199 { echo "$as_me:$LINENO: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&5
200 echo "$as_me: WARNING: Sorry, setup GUI requires FLTK 1.1.x." >&2;}
201 + fi
202 else
203 CXXFLAGS="`$FLTKCONFIG --cflags` ${CXXFLAGS}"
204 GUIS="setup uninst"
205 *** misc/epm-3.7/deb.c Wed Jan 15 15:29:24 2003
206 --- misc/build/epm-3.7/deb.c Mon Nov 20 14:54:51 2006
207 ***************
208 *** 26,31 ****
209 --- 26,53 ----
211 #include "epm.h"
213 + /*
214 + * 'add_size()' - Append Installed-Size tag to DEBIAN/control file
215 + */
217 + int /* O - 0 = success, 1 = fail */
218 + add_size(FILE *fpControl, /* Control file stream */
219 + const char *directory) /* Directory containing all files to package */
221 + FILE *fp;
222 + char command[1024];
224 + snprintf(command, sizeof(command), "du -k -s %s", directory);
225 + fp = popen(command, "r");
226 + if( NULL != fp )
228 + char size[1024];
229 + fscanf(fp, "%s .", size);
230 + fprintf(fpControl, "Installed-Size: %s\n", size);
231 + return pclose(fp);
233 + return 1;
237 * 'make_deb()' - Make a Debian software distribution package.
238 ***************
239 *** 61,78 ****
240 if (Verbosity)
241 puts("Creating Debian distribution...");
243 if (dist->relnumber)
245 if (platname[0])
246 ! snprintf(name, sizeof(name), "%s-%s-%d-%s", prodname, dist->version, dist->relnumber,
247 platname);
248 else
249 ! snprintf(name, sizeof(name), "%s-%s-%d", prodname, dist->version, dist->relnumber);
251 else if (platname[0])
252 ! snprintf(name, sizeof(name), "%s-%s-%s", prodname, dist->version, platname);
253 else
254 ! snprintf(name, sizeof(name), "%s-%s", prodname, dist->version);
257 * Write the control file for DPKG...
258 --- 83,111 ----
259 if (Verbosity)
260 puts("Creating Debian distribution...");
262 + /*
263 + * Use debian default naming scheme
264 + */
266 + if (!strcmp(platform->machine, "intel"))
267 + platname = "i386";
268 + else if (!strcmp(platform->machine, "x86_64"))
269 + platname = "amd64";
270 + else if (!strcmp(platform->machine, "ppc"))
271 + platname = "powerpc";
273 if (dist->relnumber)
275 if (platname[0])
276 ! snprintf(name, sizeof(name), "%s_%s-%d_%s", prodname, dist->version, dist->relnumber,
277 platname);
278 else
279 ! snprintf(name, sizeof(name), "%s_%s-%d", prodname, dist->version, dist->relnumber);
281 else if (platname[0])
282 ! snprintf(name, sizeof(name), "%s_%s_%s", prodname, dist->version, platname);
283 else
284 ! snprintf(name, sizeof(name), "%s_%s", prodname, dist->version);
287 * Write the control file for DPKG...
288 ***************
289 *** 108,115 ****
290 * (which we change in get_platform to a common name)
293 ! if (strcmp(platform->machine, "intel") == 0)
294 fputs("Architecture: i386\n", fp);
295 else
296 fprintf(fp, "Architecture: %s\n", platform->machine);
298 --- 141,152 ----
299 * (which we change in get_platform to a common name)
302 ! if (!strcmp(platform->machine, "intel"))
303 fputs("Architecture: i386\n", fp);
304 + else if (!strcmp(platform->machine, "x86_64"))
305 + fputs("Architecture: amd64\n", fp);
306 + else if (!strcmp(platform->machine, "ppc"))
307 + fputs("Architecture: powerpc\n", fp);
308 else
309 fprintf(fp, "Architecture: %s\n", platform->machine);
311 ***************
312 *** 148,156 ****
313 putc('\n', fp);
317 fclose(fp);
320 * Write the preinst file for DPKG...
322 --- 185,193 ----
323 putc('\n', fp);
327 fclose(fp);
330 * Write the preinst file for DPKG...
332 ***************
333 *** 417,422 ****
334 --- 454,480 ----
339 + /*
340 + * Calculate and append Installed-Size to DEBIAN/control
341 + */
343 + if (Verbosity)
344 + puts("Calculating Installed-Size...");
346 + snprintf(filename, sizeof(filename), "%s/%s/DEBIAN/control", directory, name);
347 + if ((fp = fopen(filename, "a")) == NULL)
349 + fprintf(stderr, "epm: Unable to Installed-Size to file \"%s\" - %s\n", filename,
350 + strerror(errno));
351 + return (1);
354 + snprintf(filename, sizeof(filename), "%s/%s", directory, name);
355 + add_size(fp, filename);
356 + fclose(fp);
360 * Build the distribution from the spec file...
362 *** misc/epm-3.7/dist.c Thu Aug 7 16:14:40 2003
363 --- misc/build/epm-3.7/dist.c Mon Nov 20 14:54:51 2006
364 ***************
365 *** 394,401 ****
366 strcpy(platform->machine, "mips");
367 #elif defined(__hpux)
368 strcpy(platform->machine, "hppa");
369 ! #elif defined(_AIX) || defined(__APPLE__)
370 strcpy(platform->machine, "powerpc");
371 #else
372 for (temp = platform->machine; *temp != '\0'; temp ++)
373 if (*temp == '-' || *temp == '_')
374 --- 394,406 ----
375 strcpy(platform->machine, "mips");
376 #elif defined(__hpux)
377 strcpy(platform->machine, "hppa");
378 ! #elif defined(_AIX)
379 strcpy(platform->machine, "powerpc");
380 + #elif defined(__APPLE__)
381 + if (strstr(platform->machine, "86") != NULL)
382 + strcpy(platform->machine, "intel");
383 + else
384 + strcpy(platform->machine, "powerpc");
385 #else
386 for (temp = platform->machine; *temp != '\0'; temp ++)
387 if (*temp == '-' || *temp == '_')
388 ***************
389 *** 407,413 ****
390 *temp = tolower(*temp);
392 if (strstr(platform->machine, "86") != NULL)
393 ! strcpy(platform->machine, "intel");
394 else if (strncmp(platform->machine, "sun", 3) == 0)
395 strcpy(platform->machine, "sparc");
396 #endif /* __sgi */
397 --- 412,423 ----
398 *temp = tolower(*temp);
400 if (strstr(platform->machine, "86") != NULL)
402 ! if (strstr(platform->machine, "64") != NULL)
403 ! strcpy(platform->machine, "x86_64");
404 ! else
405 ! strcpy(platform->machine, "intel");
407 else if (strncmp(platform->machine, "sun", 3) == 0)
408 strcpy(platform->machine, "sparc");
409 #endif /* __sgi */
410 *** misc/epm-3.7/epm.c Tue Oct 28 15:48:30 2003
411 --- misc/build/epm-3.7/epm.c Mon Nov 20 14:54:51 2006
412 ***************
413 *** 547,552 ****
414 --- 547,553 ----
416 puts(EPM_VERSION);
417 puts("Copyright 1999-2003 by Easy Software Products.");
418 + puts("Patched for OpenOffice.org");
419 puts("");
420 puts("EPM is free software and comes with ABSOLUTELY NO WARRANTY; for details");
421 puts("see the GNU General Public License in the file COPYING or at");
422 *** misc/epm-3.7/file.c Wed Jul 23 23:41:08 2003
423 --- misc/build/epm-3.7/file.c Mon Nov 20 14:54:51 2006
424 ***************
425 *** 108,114 ****
426 fclose(dstfile);
428 chmod(dst, mode);
429 - chown(dst, owner, group);
431 return (0);
433 --- 108,113 ----
434 ***************
435 *** 138,144 ****
437 mkdir(buffer, 0777);
438 chmod(buffer, mode | 0700);
439 - chown(buffer, owner, group);
443 --- 137,142 ----
444 ***************
445 *** 151,157 ****
447 mkdir(buffer, 0777);
448 chmod(buffer, mode | 0700);
449 - chown(buffer, owner, group);
452 return (0);
453 --- 149,154 ----
454 *** misc/epm-3.7/osx.c Wed Jul 23 23:41:08 2003
455 --- misc/build/epm-3.7/osx.c Mon Nov 20 14:54:51 2006
456 ***************
457 *** 373,379 ****
458 else
459 snprintf(filename, sizeof(filename), "%s/%s", current, directory);
461 ! run_command(NULL, "/Developer/Applications/PackageMaker.app/"
462 "Contents/MacOS/PackageMaker -build "
463 "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist",
464 filename, prodname, filename, filename, filename, prodname, filename, prodname);
465 --- 373,379 ----
466 else
467 snprintf(filename, sizeof(filename), "%s/%s", current, directory);
469 ! run_command(NULL, "/Developer/Applications/Utilities/PackageMaker.app/"
470 "Contents/MacOS/PackageMaker -build "
471 "-p %s/%s.pkg -f %s/Package -r %s/Resources -d %s/%s-desc.plist -i %s/%s-info.plist",
472 filename, prodname, filename, filename, filename, prodname, filename, prodname);
473 *** misc/epm-3.7/pkg.c Tue Dec 17 19:57:56 2002
474 --- misc/build/epm-3.7/pkg.c Mon Nov 20 14:54:51 2006
475 ***************
476 *** 429,503 ****
478 fclose(fp);
480 - /*
481 - * Build the distribution from the prototype file...
482 - */
484 - if (Verbosity)
485 - puts("Building PKG binary distribution...");
487 - if (run_command(NULL, "pkgmk -o -f %s/%s.prototype -d %s/%s",
488 - directory, prodname, current, directory))
489 - return (1);
491 - /*
492 - * Tar and compress the distribution...
493 - */
495 - if (Verbosity)
496 - puts("Creating tar.gz file for distribution...");
498 - snprintf(filename, sizeof(filename), "%s/%s.tar.gz", directory, name);
500 - if ((tarfile = tar_open(filename, 1)) == NULL)
501 - return (1);
503 - snprintf(filename, sizeof(filename), "%s/%s", directory, prodname);
505 - if (tar_directory(tarfile, filename, prodname))
507 - tar_close(tarfile);
508 - return (1);
511 - tar_close(tarfile);
513 - /*
514 - * Make a package stream file...
515 - */
517 - if (Verbosity)
518 - puts("Copying into package stream file...");
520 - if (run_command(directory, "pkgtrans -s %s/%s %s.pkg %s",
521 - current, directory, name, prodname))
522 - return (1);
524 - /*
525 - * Remove temporary files...
526 - */
528 - if (!KeepFiles)
530 - if (Verbosity)
531 - puts("Removing temporary distribution files...");
533 - snprintf(filename, sizeof(filename), "%s/%s.pkginfo", directory, prodname);
534 - unlink(filename);
535 - snprintf(filename, sizeof(filename), "%s/%s.depend", directory, prodname);
536 - unlink(filename);
537 - snprintf(filename, sizeof(filename), "%s/%s.prototype", directory, prodname);
538 - unlink(filename);
539 - if (preinstall[0])
540 - unlink(preinstall);
541 - if (postinstall[0])
542 - unlink(postinstall);
543 - if (preremove[0])
544 - unlink(preremove);
545 - if (postremove[0])
546 - unlink(postremove);
549 return (0);
552 --- 429,434 ----
553 *** misc/epm-3.7/qprintf.c Mon Jan 27 22:48:03 2003
554 --- misc/build/epm-3.7/qprintf.c Mon Nov 20 14:54:51 2006
555 ***************
556 *** 181,192 ****
558 for (i = slen; i > 0; i --, s ++, bytes ++)
560 if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s))
562 putc('\\', fp);
563 bytes ++;
566 putc(*s, fp);
569 --- 181,199 ----
571 for (i = slen; i > 0; i --, s ++, bytes ++)
573 + #if defined(__FreeBSD__)
574 + if (strchr("`~!#%^&*()[{]}\\|;\'\"<>? ", *s))
576 + putc('\\', fp);
577 + bytes ++;
579 + #else
580 if (strchr("`~!#$%^&*()[{]}\\|;\'\"<>? ", *s))
582 putc('\\', fp);
583 bytes ++;
585 ! #endif
586 putc(*s, fp);
589 *** misc/epm-3.7/rpm.c Wed Oct 1 21:27:15 2003
590 --- misc/build/epm-3.7/rpm.c Mon Nov 20 14:54:51 2006
591 ***************
592 *** 38,44 ****
593 dist_t *dist, /* I - Distribution information */
594 struct utsname *platform) /* I - Platform information */
596 ! int i; /* Looping var */
597 FILE *fp; /* Spec file */
598 char name[1024]; /* Full product name */
599 char specname[1024]; /* Spec filename */
600 --- 38,44 ----
601 dist_t *dist, /* I - Distribution information */
602 struct utsname *platform) /* I - Platform information */
604 ! int i,n; /* Looping vars */
605 FILE *fp; /* Spec file */
606 char name[1024]; /* Full product name */
607 char specname[1024]; /* Spec filename */
608 ***************
609 *** 160,165 ****
610 --- 160,167 ----
611 fprintf(fp, "Requires: %s", dname);
612 else if (d->type == DEPEND_PROVIDES)
613 fprintf(fp, "Provides: %s", dname);
614 + else if (d->type == DEPEND_REPLACES)
615 + fprintf(fp, "Obsoletes: %s", dname);
616 else
617 fprintf(fp, "Conflicts: %s", dname);
619 ***************
620 *** 186,200 ****
621 for (i = 0; i < dist->num_descriptions; i ++)
622 fprintf(fp, "%s\n", dist->descriptions[i]);
624 ! fputs("%pre\n", fp);
625 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
626 if (c->type == COMMAND_PRE_INSTALL)
627 fprintf(fp, "%s\n", c->command);
629 ! fputs("%post\n", fp);
630 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
631 if (c->type == COMMAND_POST_INSTALL)
632 fprintf(fp, "%s\n", c->command);
634 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
635 if (tolower(file->type) == 'i')
636 --- 188,220 ----
637 for (i = 0; i < dist->num_descriptions; i ++)
638 fprintf(fp, "%s\n", dist->descriptions[i]);
640 ! /*
641 ! * %pre
642 ! */
643 ! n = 0;
644 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
646 if (c->type == COMMAND_PRE_INSTALL)
648 + if (1 == ++n) /* Only write %pre if there is at least one command */
649 + fputs("%pre\n", fp);
650 fprintf(fp, "%s\n", c->command);
654 ! /*
655 ! * %post
656 ! */
657 ! n = 0;
658 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
660 if (c->type == COMMAND_POST_INSTALL)
662 + if (1 == ++n) /* Only write %post if there is at least one command */
663 + fputs("%post\n", fp);
664 fprintf(fp, "%s\n", c->command);
668 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
669 if (tolower(file->type) == 'i')
670 ***************
671 *** 202,207 ****
672 --- 222,229 ----
674 if (i)
676 + if (1 == ++n) /* If not previously done so, write %post here */
677 + fputs("%post\n", fp);
678 fputs("if test \"x$1\" = x1; then\n", fp);
679 fputs(" echo Setting up init scripts...\n", fp);
681 ***************
682 *** 259,265 ****
683 fputs("fi\n", fp);
686 ! fputs("%preun\n", fp);
687 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
688 if (tolower(file->type) == 'i')
689 break;
690 --- 281,290 ----
691 fputs("fi\n", fp);
694 ! /*
695 ! * %preun
696 ! */
697 ! n = 0;
698 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
699 if (tolower(file->type) == 'i')
700 break;
701 ***************
702 *** 266,271 ****
703 --- 291,297 ----
705 if (i)
707 + fputs("%preun\n", fp); ++n; /* Need to write %preun here */
708 fputs("if test \"x$1\" = x0; then\n", fp);
709 fputs(" echo Cleaning up init scripts...\n", fp);
711 ***************
712 *** 315,327 ****
715 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
716 if (c->type == COMMAND_PRE_REMOVE)
717 fprintf(fp, "%s\n", c->command);
719 ! fputs("%postun\n", fp);
720 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
721 if (c->type == COMMAND_POST_REMOVE)
722 fprintf(fp, "%s\n", c->command);
724 fputs("%files\n", fp);
725 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
726 --- 341,369 ----
729 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
731 if (c->type == COMMAND_PRE_REMOVE)
733 + if (1 == ++n) /* Only write %preun if not previously done so */
734 + fputs("%preun\n", fp);
736 fprintf(fp, "%s\n", c->command);
740 ! /*
741 ! * %post
742 ! */
743 ! n = 0;
744 for (i = dist->num_commands, c = dist->commands; i > 0; i --, c ++)
746 if (c->type == COMMAND_POST_REMOVE)
748 + if (1 == ++n) /* Only write %post if there is at least one command */
749 + fputs("%postun\n", fp);
750 fprintf(fp, "%s\n", c->command);
754 fputs("%files\n", fp);
755 for (i = dist->num_files, file = dist->files; i > 0; i --, file ++)
756 ***************
757 *** 415,467 ****
761 - /*
762 - * Build the distribution from the spec file...
763 - */
765 - if (Verbosity)
766 - puts("Building RPM binary distribution...");
768 - if (strcmp(platform->machine, "intel") == 0)
770 - if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "i386 %s",
771 - Verbosity == 0 ? "--quiet" : "", specname))
772 - return (1);
774 - else if (run_command(NULL, EPM_RPMBUILD " %s -bb " EPM_RPMARCH "%s %s",
775 - Verbosity == 0 ? "--quiet" : "", platform->machine,
776 - specname))
777 - return (1);
779 - /*
780 - * Move the RPM to the local directory and rename the RPM using the
781 - * product name specified by the user...
782 - */
784 - if (strcmp(platform->machine, "intel") == 0)
785 - run_command(NULL, "/bin/mv %s/RPMS/i386/%s-%s-%d.i386.rpm %s/%s.rpm",
786 - rpmdir, prodname, dist->version, dist->relnumber,
787 - directory, name);
788 - else
789 - run_command(NULL, "/bin/mv %s/RPMS/%s/%s-%s-%d.%s.rpm %s/%s.rpm",
790 - rpmdir, platform->machine, prodname, dist->version,
791 - dist->relnumber, platform->machine, directory, name);
793 - /*
794 - * Remove temporary files...
795 - */
797 - if (!KeepFiles)
799 - if (Verbosity)
800 - puts("Removing temporary distribution files...");
802 - run_command(NULL, "/bin/rm -rf %s/RPMS", directory);
803 - run_command(NULL, "/bin/rm -rf %s/buildroot", directory);
805 - unlink(specname);
808 return (0);
811 --- 457,462 ----