main.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * dpkg - main program for package management
  3. * dpkg-deb.h - external definitions for this program
  4. *
  5. * Copyright (C) 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 MAIN_H
  22. #define MAIN_H
  23. struct fileinlist; /* these two are defined in filesdb.h */
  24. struct filenamenode;
  25. struct perpackagestate {
  26. enum istobes {
  27. itb_normal, itb_remove, itb_installnew, itb_deconfigure, itb_preinstall
  28. } istobe;
  29. /* filelistvalid files meaning
  30. * 0 0 not read yet, must do so if want them
  31. * 0 !=0 read, but rewritten and now out of
  32. * date. If want info must throw away old
  33. * and reread file.
  34. * 1 !=0 read, all is OK
  35. * 1 0 read OK, but, there were no files
  36. */
  37. int fileslistvalid;
  38. struct fileinlist *files;
  39. int replacingfilesandsaid;
  40. };
  41. struct packageinlist {
  42. struct packageinlist *next;
  43. struct pkginfo *pkg;
  44. };
  45. enum action { act_unset, act_install, act_unpack, act_avail, act_configure,
  46. act_remove, act_purge, act_listpackages, act_avreplace, act_avmerge,
  47. act_unpackchk, act_status, act_searchfiles, act_audit, act_listfiles,
  48. act_assertpredep, act_printarch, act_predeppackage, act_cmpversions,
  49. act_printinstarch, act_compareversions, act_printavail, act_avclear,
  50. act_forgetold, act_getselections, act_setselections, act_printgnuarch };
  51. enum conffopt {
  52. cfof_prompt = 001,
  53. cfof_keep = 002,
  54. cfof_install = 004,
  55. cfof_backup = 0100,
  56. cfof_newconff = 0200,
  57. cfof_isnew = 0400,
  58. cfom_main = 007,
  59. cfo_keep = cfof_keep,
  60. cfo_prompt_keep = cfof_keep | cfof_prompt,
  61. cfo_prompt = cfof_prompt,
  62. cfo_prompt_install = cfof_prompt | cfof_install,
  63. cfo_install = cfof_install,
  64. cfo_newconff = cfof_install | cfof_newconff,
  65. cfo_identical = cfof_keep
  66. };
  67. extern int conffoptcells[2][2];
  68. extern const char *const statusstrings[];
  69. extern const struct cmdinfo *cipaction;
  70. extern int f_pending, f_recursive, f_alsoselect, f_skipsame, f_noact;
  71. extern int f_autodeconf, f_largemem;
  72. extern unsigned long f_debug;
  73. extern int fc_downgrade, fc_configureany, fc_hold, fc_removereinstreq, fc_overwrite;
  74. extern int fc_removeessential, fc_conflicts, fc_depends, fc_dependsversion;
  75. extern int fc_autoselect, fc_badpath, fc_overwritediverted, fc_architecture;
  76. extern int fc_nonroot, fc_overwritedir;
  77. extern const char *admindir;
  78. extern const char *instdir;
  79. extern struct packageinlist *ignoredependss;
  80. extern const char architecture[];
  81. /* from filesdb.c */
  82. void filesdbinit(void);
  83. /* from archives.c */
  84. void archivefiles(const char *const *argv);
  85. void process_archive(const char *filename);
  86. /* from update.c */
  87. void forgetold(const char *const *argv);
  88. void updateavailable(const char *const *argv);
  89. /* from enquiry.c */
  90. void listpackages(const char *const *argv);
  91. void audit(const char *const *argv);
  92. void unpackchk(const char *const *argv);
  93. void searchfiles(const char *const *argv);
  94. void enqperpackage(const char *const *argv);
  95. void assertpredep(const char *const *argv);
  96. void predeppackage(const char *const *argv);
  97. void printarch(const char *const *argv);
  98. void printinstarch(const char *const *argv);
  99. void cmpversions(const char *const *argv);
  100. /* Intended for use as a comparison function for qsort when
  101. * sorting an array of pointers to struct pkginfo:
  102. */
  103. int pkglistqsortcmp(const void *a, const void *b);
  104. /* from select.c */
  105. void getselections(const char *const *argv);
  106. void setselections(const char *const *argv);
  107. /* from packages.c, remove.c and configure.c */
  108. void add_to_queue(struct pkginfo *pkg);
  109. void process_queue(void);
  110. void packages(const char *const *argv);
  111. void removal_bulk(struct pkginfo *pkg);
  112. int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in);
  113. int dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing,
  114. struct varbuf *aemsgs);
  115. void deferred_remove(struct pkginfo *pkg);
  116. void deferred_configure(struct pkginfo *pkg);
  117. extern int queuelen, sincenothing, dependtry;
  118. /* from cleanup.c (most of these are declared in archives.h) */
  119. void cu_prermremove(int argc, void **argv);
  120. /* from errors.c */
  121. void print_error_perpackage(const char *emsg, const char *arg);
  122. void forcibleerr(int forceflag, const char *format, ...) PRINTFFORMAT(2,3);
  123. int reportbroken_retexitstatus(void);
  124. int skip_due_to_hold(struct pkginfo *pkg);
  125. /* from help.c */
  126. void cu_closefile(int argc, void **argv);
  127. void cu_closepipe(int argc, void **argv);
  128. void cu_closedir(int argc, void **argv);
  129. void cu_closefd(int argc, void **argv);
  130. int ignore_depends(struct pkginfo *pkg);
  131. int force_depends(struct deppossi *possi);
  132. int force_conflicts(struct deppossi *possi);
  133. void ensure_package_clientdata(struct pkginfo *pkg);
  134. const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile);
  135. void oldconffsetflags(struct conffile *searchconff);
  136. void ensure_pathname_nonexisting(const char *pathname);
  137. void checkpath(void);
  138. struct filenamenode *namenodetouse(struct filenamenode*, struct pkginfo*);
  139. /* all ...'s are const char*'s ... */
  140. int maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
  141. const char *description, ...);
  142. int maintainer_script_new(const char *scriptname, const char *description,
  143. const char *cidir, char *cidirrest, ...);
  144. int maintainer_script_alternative(struct pkginfo *pkg,
  145. const char *scriptname, const char *description,
  146. const char *cidir, char *cidirrest,
  147. const char *ifok, const char *iffallback);
  148. void clear_istobes(void);
  149. int isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
  150. enum debugflags {
  151. dbg_general= 00001,
  152. dbg_scripts= 00002,
  153. dbg_eachfile= 00010,
  154. dbg_eachfiledetail= 00100,
  155. dbg_conff= 00020,
  156. dbg_conffdetail= 00200,
  157. dbg_depcon= 00040,
  158. dbg_depcondetail= 00400,
  159. dbg_veryverbose= 01000,
  160. dbg_stupidlyverbose= 02000,
  161. };
  162. void debug(int which, const char *fmt, ...) PRINTFFORMAT(2,3);
  163. /* from depcon.c */
  164. int depisok(struct dependency *dep, struct varbuf *whynot,
  165. struct pkginfo **fixbyrm, int allowunconfigd);
  166. struct cyclesofarlink;
  167. int findbreakcycle(struct pkginfo *pkg, struct cyclesofarlink *sofar);
  168. void describedepcon(struct varbuf *addto, struct dependency *dep);
  169. #endif /* MAIN_H */