chiark / gitweb /
lib/dpkg/tarfn.c: Kludge `tar_header_decode' to handle spurious `errno'.
[dpkg] / src / archives.h
1 /*
2  * dpkg - main program for package management
3  * archives.h - functions common to archives.c and unpack.c
4  *
5  * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6  * Copyright © 2008-2013, 2015 Guillem Jover <guillem@debian.org>
7  *
8  * This is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21
22 #ifndef ARCHIVES_H
23 #define ARCHIVES_H
24
25 #include <stdbool.h>
26
27 #include <dpkg/tarfn.h>
28
29 struct tarcontext {
30   int backendpipe;
31   struct pkginfo *pkg;
32   /** A queue of filenamenode that have been extracted anew. */
33   struct filenamenode_queue *newfiles_queue;
34   /** Are all “Multi-arch: same” instances about to be in sync? */
35   bool pkgset_getting_in_sync;
36 };
37
38 struct pkg_deconf_list {
39   struct pkg_deconf_list *next;
40   struct pkginfo *pkg;
41   struct pkginfo *pkg_removal;
42 };
43
44 extern struct varbuf_state fname_state;
45 extern struct varbuf fnamevb;
46 extern struct varbuf fnametmpvb;
47 extern struct varbuf fnamenewvb;
48 extern struct pkg_deconf_list *deconfigure;
49
50 void clear_deconfigure_queue(void);
51 void enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo *pkg_removal);
52 void enqueue_conflictor(struct pkginfo *pkg);
53
54 void cu_pathname(int argc, void **argv);
55 void cu_cidir(int argc, void **argv);
56 void cu_fileslist(int argc, void **argv);
57 void cu_backendpipe(int argc, void **argv);
58
59 void cu_installnew(int argc, void **argv);
60
61 void cu_prermupgrade(int argc, void **argv);
62 void cu_prerminfavour(int argc, void **argv);
63 void cu_preinstverynew(int argc, void **argv);
64 void cu_preinstnew(int argc, void **argv);
65 void cu_preinstupgrade(int argc, void **argv);
66 void cu_postrmupgrade(int argc, void **argv);
67
68 void cu_prermdeconfigure(int argc, void **argv);
69 void ok_prermdeconfigure(int argc, void **argv);
70
71 void setupfnamevbs(const char *filename);
72
73 int tarobject(void *ctx, struct tar_entry *ti);
74 int tarfileread(void *ud, char *buf, int len);
75 void tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg);
76
77 struct fileinlist *
78 tar_filenamenode_queue_push(struct filenamenode_queue *queue,
79                             struct filenamenode *namenode);
80
81 bool filesavespackage(struct fileinlist *, struct pkginfo *,
82                       struct pkginfo *pkgbeinginstalled);
83
84 void check_conflict(struct dependency *dep, struct pkginfo *pkg,
85                     const char *pfilename);
86 void check_breaks(struct dependency *dep, struct pkginfo *pkg,
87                   const char *pfilename);
88
89 extern int cleanup_pkg_failed, cleanup_conflictor_failed;
90
91 #endif /* ARCHIVES_H */