dpkg.h.in 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * libdpkg - Debian packaging suite library routines
  3. * dpkg.h - general header for Debian package handling
  4. *
  5. * Copyright (C) 1994,1995 Ian Jackson <iwj10@cus.cam.ac.uk>
  6. *
  7. * This is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2,
  10. * or (at your option) any later version.
  11. *
  12. * This is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public
  18. * License along with dpkg; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #ifndef DPKG_H
  22. #define DPKG_H
  23. #include <setjmp.h>
  24. #include <stdarg.h>
  25. #include <stdio.h>
  26. #include <sys/types.h>
  27. #include <sys/sysinfo.h>
  28. #define ARCHIVEVERSION "2.0"
  29. #define SPLITVERSION "2.1"
  30. #define OLDARCHIVEVERSION "0.939000"
  31. #define SPLITPARTDEFMAX (450*1024)
  32. #define MAXFIELDNAME 200
  33. #define MAXCONFFILENAME 1000
  34. #define MAXDIVERTFILENAME 1024
  35. #define MAXCONTROLFILENAME 100
  36. #define BUILDCONTROLDIR "DEBIAN"
  37. #define EXTRACTCONTROLDIR BUILDCONTROLDIR
  38. #define DEBEXT ".deb"
  39. #define OLDDBEXT "-old"
  40. #define NEWDBEXT "-new"
  41. #define OLDOLDDEBDIR ".DEBIAN"
  42. #define OLDDEBDIR "DEBIAN"
  43. #define REMOVECONFFEXTS "~", ".bak", "%", \
  44. DPKGTEMPEXT, DPKGNEWEXT, DPKGOLDEXT, DPKGDISTEXT
  45. #ifndef ARCHBINFMT
  46. #define ARCHBINFMT
  47. #endif
  48. #define DPKG_VERSION_ARCH DPKG_VERSION " (" ARCHITECTURE ARCHBINFMT ")"
  49. #define NEWCONFFILEFLAG "newconffile"
  50. #define NONEXISTENTFLAG "nonexistent"
  51. #define DPKGTEMPEXT ".dpkg-tmp"
  52. #define DPKGNEWEXT ".dpkg-new"
  53. #define DPKGOLDEXT ".dpkg-old"
  54. #define DPKGDISTEXT ".dpkg-dist"
  55. #define CONTROLFILE "control"
  56. #define CONFFILESFILE "conffiles"
  57. #define PREINSTFILE "preinst"
  58. #define POSTINSTFILE "postinst"
  59. #define PRERMFILE "prerm"
  60. #define POSTRMFILE "postrm"
  61. #define LISTFILE "list"
  62. #define ADMINDIR "#ADMINDIR#"
  63. #define STATUSFILE "status"
  64. #define AVAILFILE "available"
  65. #define LOCKFILE "lock"
  66. #define CMETHOPTFILE "cmethopt"
  67. #define METHLOCKFILE "methlock"
  68. #define DIVERSIONSFILE "diversions"
  69. #define UPDATESDIR "updates/"
  70. #define INFODIR "info/"
  71. #define PARTSDIR "parts/"
  72. #define CONTROLDIRTMP "tmp.ci/"
  73. #define IMPORTANTTMP "tmp.i"
  74. #define REASSEMBLETMP "reassemble" DEBEXT
  75. #define IMPORTANTMAXLEN 10
  76. #define IMPORTANTFMT "%04d" /* change => also change lib/database.c:cleanup_updates */
  77. #define MAXUPDATES 50
  78. #define LIBDIR "#LIBDIR#"
  79. #define LOCALLIBDIR "/usr/local/lib/dpkg"
  80. #define METHODSDIR "methods"
  81. #define NOJOBCTRLSTOPENV "DPKG_NO_TSTP"
  82. #define SHELLENV "SHELL"
  83. #define DEFAULTSHELL "sh"
  84. #define PAGERENV "PAGER"
  85. #define DEFAULTPAGER "pager"
  86. #define IMETHODMAXLEN 50
  87. #define IOPTIONMAXLEN IMETHODMAXLEN
  88. #define METHODOPTIONSFILE "names"
  89. #define METHODSETUPSCRIPT "setup"
  90. #define METHODUPDATESCRIPT "update"
  91. #define METHODINSTALLSCRIPT "install"
  92. #define OPTIONSDESCPFX "desc."
  93. #define OPTIONINDEXMAXLEN 5
  94. #define PKGSCRIPTMAXARGS 10
  95. #define MD5HASHLEN 32
  96. #define CONFFOPTCELLS /* int conffoptcells[2] {* 1= user edited *} \
  97. [2] {* 1= distributor edited *} = */ \
  98. /* dist not */ /* dist edited */ \
  99. /* user did not edit */ { cfo_keep, cfo_install }, \
  100. /* user did edit */ { cfo_keep, cfo_prompt_keep }
  101. #define ARCHIVE_FILENAME_PATTERN "*.deb"
  102. #define BACKEND "dpkg-deb"
  103. #define SPLITTER "dpkg-split"
  104. #define MD5SUM "md5sum"
  105. #define DSELECT "dselect"
  106. #define DPKG "dpkg"
  107. #define SAFEFILELIST "dpkg-safefilelist"
  108. #define TAR "tar"
  109. #define GZIP "gzip"
  110. #define CAT "cat"
  111. #define RM "rm"
  112. #define FIND "find"
  113. #define SHELL "sh"
  114. #define SHELLENVIR "SHELL"
  115. #define FIND_EXPRSTARTCHARS "-(),!"
  116. #define TARBLKSZ 512
  117. /* Take care of NLS matters. */
  118. #if HAVE_LOCALE_H
  119. # include <locale.h>
  120. #endif
  121. #if !HAVE_SETLOCALE
  122. # define setlocale(Category, Locale) /* empty */
  123. #endif
  124. #if ENABLE_NLS
  125. # include <libintl.h>
  126. # define _(Text) gettext (Text)
  127. # define N_(Text) Text
  128. #else
  129. # undef bindtextdomain
  130. # define bindtextdomain(Domain, Directory) /* empty */
  131. # undef textdomain
  132. # define textdomain(Domain) /* empty */
  133. # define _(Text) Text
  134. # define N_(Text) Text
  135. # define gettext(Text) Text
  136. #endif
  137. extern const char thisname[]; /* defined separately in each program */
  138. extern const char printforhelp[];
  139. /*** from ehandle.c ***/
  140. void push_error_handler(jmp_buf *jbufp,
  141. void (*printerror)(const char *, const char *),
  142. const char *contextstring);
  143. void set_error_display(void (*printerror)(const char *, const char *),
  144. const char *contextstring);
  145. void print_error_fatal(const char *emsg, const char *contextstring);
  146. void error_unwind(int flagset);
  147. void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
  148. void (*f2)(int argc, void **argv), int flagmask2,
  149. int nargs, ...);
  150. void push_checkpoint(int mask, int value);
  151. void pop_cleanup(int flagset);
  152. enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
  153. void do_internerr(const char *string, int line, const char *file) NONRETURNING;
  154. #define internerr(s) do_internerr(s,__LINE__,__FILE__)
  155. struct varbuf;
  156. void ohshit(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  157. void ohshitv(const char *fmt, va_list al) NONRETURNING;
  158. void ohshite(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  159. void ohshitvb(struct varbuf*) NONRETURNING;
  160. void badusage(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  161. void werr(const char *what) NONRETURNING;
  162. /*** from mlib.c ***/
  163. void *m_malloc(size_t);
  164. void *m_realloc(void*, size_t);
  165. int m_fork(void);
  166. void m_dup2(int oldfd, int newfd);
  167. void m_pipe(int fds[2]);
  168. void checksubprocerr(int status, const char *description, int sigpipeok);
  169. void waitsubproc(pid_t pid, const char *description, int sigpipeok);
  170. int do_fd_copy(int fd1, int fd2, char *desc);
  171. extern volatile int onerr_abort;
  172. /*** from showcright.c ***/
  173. struct cmdinfo;
  174. void showcopyright(const struct cmdinfo*, const char*);
  175. #endif /* DPKG_H */