dpkg.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. #define ARCHIVEVERSION "2.0"
  28. #define SPLITVERSION "2.1"
  29. #define OLDARCHIVEVERSION "0.939000"
  30. #define SPLITPARTDEFMAX (450*1024)
  31. #define MAXFIELDNAME 200
  32. #define MAXCONFFILENAME 1000
  33. #define MAXDIVERTFILENAME 1024
  34. #define MAXCONTROLFILENAME 100
  35. #define BUILDCONTROLDIR "DEBIAN"
  36. #define EXTRACTCONTROLDIR BUILDCONTROLDIR
  37. #define DEBEXT ".deb"
  38. #define OLDDBEXT "-old"
  39. #define NEWDBEXT "-new"
  40. #define OLDOLDDEBDIR ".DEBIAN"
  41. #define OLDDEBDIR "DEBIAN"
  42. #define REMOVECONFFEXTS "~", ".bak", "%", \
  43. DPKGTEMPEXT, DPKGNEWEXT, DPKGOLDEXT, DPKGDISTEXT
  44. #ifndef ARCHBINFMT
  45. #define ARCHBINFMT
  46. #endif
  47. #define DPKG_VERSION_ARCH DPKG_VERSION " (" ARCHITECTURE ARCHBINFMT ")"
  48. #define NEWCONFFILEFLAG "newconffile"
  49. #define NONEXISTENTFLAG "nonexistent"
  50. #define DPKGTEMPEXT ".dpkg-tmp"
  51. #define DPKGNEWEXT ".dpkg-new"
  52. #define DPKGOLDEXT ".dpkg-old"
  53. #define DPKGDISTEXT ".dpkg-dist"
  54. #define CONTROLFILE "control"
  55. #define CONFFILESFILE "conffiles"
  56. #define PREINSTFILE "preinst"
  57. #define POSTINSTFILE "postinst"
  58. #define PRERMFILE "prerm"
  59. #define POSTRMFILE "postrm"
  60. #define LISTFILE "list"
  61. #define ADMINDIR "/var/lib/dpkg"
  62. #define STATUSFILE "status"
  63. #define AVAILFILE "available"
  64. #define LOCKFILE "lock"
  65. #define CMETHOPTFILE "cmethopt"
  66. #define METHLOCKFILE "methlock"
  67. #define DIVERSIONSFILE "diversions"
  68. #define UPDATESDIR "updates/"
  69. #define INFODIR "info/"
  70. #define PARTSDIR "parts/"
  71. #define CONTROLDIRTMP "tmp.ci/"
  72. #define IMPORTANTTMP "tmp.i"
  73. #define REASSEMBLETMP "reassemble" DEBEXT
  74. #define IMPORTANTMAXLEN 10
  75. #define IMPORTANTFMT "%04d" /* change => also change lib/database.c:cleanup_updates */
  76. #define MAXUPDATES 50
  77. #define LIBDIR "/usr/lib/dpkg"
  78. #define LOCALLIBDIR "/usr/local/lib/dpkg"
  79. #define METHODSDIR "methods"
  80. #define NOJOBCTRLSTOPENV "DPKG_NO_TSTP"
  81. #define SHELLENV "SHELL"
  82. #define DEFAULTSHELL "sh"
  83. #define IMETHODMAXLEN 50
  84. #define IOPTIONMAXLEN IMETHODMAXLEN
  85. #define METHODOPTIONSFILE "names"
  86. #define METHODSETUPSCRIPT "setup"
  87. #define METHODUPDATESCRIPT "update"
  88. #define METHODINSTALLSCRIPT "install"
  89. #define OPTIONSDESCPFX "desc."
  90. #define OPTIONINDEXMAXLEN 5
  91. #define PKGSCRIPTMAXARGS 10
  92. #define MD5HASHLEN 32
  93. #define CONFFOPTCELLS /* int conffoptcells[2] {* 1= user edited *} \
  94. [2] {* 1= distributor edited *} = */ \
  95. /* dist not */ /* dist edited */ \
  96. /* user did not edit */ { cfo_keep, cfo_install }, \
  97. /* user did edit */ { cfo_keep, cfo_prompt_keep }
  98. #define ARCHIVE_FILENAME_PATTERN "*.deb"
  99. #define BACKEND "dpkg-deb"
  100. #define SPLITTER "dpkg-split"
  101. #define MD5SUM "md5sum"
  102. #define DSELECT "dselect"
  103. #define DPKG "dpkg"
  104. #define TAR "tar"
  105. #define GZIP "gzip"
  106. #define CAT "cat"
  107. #define RM "rm"
  108. #define FIND "find"
  109. #define SHELL "sh"
  110. #define SHELLENVIR "SHELL"
  111. #define FIND_EXPRSTARTCHARS "-(),!"
  112. #define TARBLKSZ 512
  113. extern const char thisname[]; /* defined separately in each program */
  114. extern const char printforhelp[];
  115. /*** from ehandle.c ***/
  116. void push_error_handler(jmp_buf *jbufp,
  117. void (*printerror)(const char *, const char *),
  118. const char *contextstring);
  119. void set_error_display(void (*printerror)(const char *, const char *),
  120. const char *contextstring);
  121. void print_error_fatal(const char *emsg, const char *contextstring);
  122. void error_unwind(int flagset);
  123. void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
  124. void (*f2)(int argc, void **argv), int flagmask2,
  125. int nargs, ...);
  126. void push_checkpoint(int mask, int value);
  127. void pop_cleanup(int flagset);
  128. enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
  129. void do_internerr(const char *string, int line, const char *file) NONRETURNING;
  130. #define internerr(s) do_internerr(s,__LINE__,__FILE__)
  131. struct varbuf;
  132. void ohshit(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  133. void ohshitv(const char *fmt, va_list al) NONRETURNING;
  134. void ohshite(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  135. void ohshitvb(struct varbuf*) NONRETURNING;
  136. void badusage(const char *fmt, ...) NONRETURNPRINTFFORMAT(1,2);
  137. void werr(const char *what) NONRETURNING;
  138. /*** from mlib.c ***/
  139. void *m_malloc(size_t);
  140. void *m_realloc(void*, size_t);
  141. int m_fork(void);
  142. void m_dup2(int oldfd, int newfd);
  143. void m_pipe(int fds[2]);
  144. void checksubprocerr(int status, const char *description, int sigpipeok);
  145. void waitsubproc(pid_t pid, const char *description, int sigpipeok);
  146. extern volatile int onerr_abort;
  147. /*** from showcright.c ***/
  148. struct cmdinfo;
  149. void showcopyright(const struct cmdinfo*, const char*);
  150. #endif /* DPKG_H */