4 * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
6 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
7 * Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
8 * Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
9 * Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef _ALPM_PACKAGE_H
25 #define _ALPM_PACKAGE_H
27 #include <sys/types.h> /* off_t */
28 #include <time.h> /* time_t */
34 typedef enum _pmpkgfrom_t
{
40 /** Package operations struct. This struct contains function pointers to
41 * all methods used to access data in a package to allow for things such
42 * as lazy package intialization (such as used by the file backend). Each
43 * backend is free to define a stuct containing pointers to a specific
44 * implementation of these methods. Some backends may find using the
45 * defined default_pkg_ops struct to work just fine for their needs.
47 struct pkg_operations
{
48 const char *(*get_filename
) (pmpkg_t
*);
49 const char *(*get_name
) (pmpkg_t
*);
50 const char *(*get_version
) (pmpkg_t
*);
51 const char *(*get_desc
) (pmpkg_t
*);
52 const char *(*get_url
) (pmpkg_t
*);
53 time_t (*get_builddate
) (pmpkg_t
*);
54 time_t (*get_installdate
) (pmpkg_t
*);
55 const char *(*get_packager
) (pmpkg_t
*);
56 const char *(*get_md5sum
) (pmpkg_t
*);
57 const char *(*get_arch
) (pmpkg_t
*);
58 off_t (*get_size
) (pmpkg_t
*);
59 off_t (*get_isize
) (pmpkg_t
*);
60 pmpkgreason_t (*get_reason
) (pmpkg_t
*);
61 int (*has_scriptlet
) (pmpkg_t
*);
63 alpm_list_t
*(*get_licenses
) (pmpkg_t
*);
64 alpm_list_t
*(*get_groups
) (pmpkg_t
*);
65 alpm_list_t
*(*get_depends
) (pmpkg_t
*);
66 alpm_list_t
*(*get_optdepends
) (pmpkg_t
*);
67 alpm_list_t
*(*get_conflicts
) (pmpkg_t
*);
68 alpm_list_t
*(*get_provides
) (pmpkg_t
*);
69 alpm_list_t
*(*get_replaces
) (pmpkg_t
*);
70 alpm_list_t
*(*get_deltas
) (pmpkg_t
*);
71 alpm_list_t
*(*get_files
) (pmpkg_t
*);
72 alpm_list_t
*(*get_backup
) (pmpkg_t
*);
74 void *(*changelog_open
) (pmpkg_t
*);
75 size_t (*changelog_read
) (void *, size_t, const pmpkg_t
*, const void *);
76 int (*changelog_close
) (const pmpkg_t
*, void *);
80 * compute_requiredby()
84 /** The standard package operations struct. get fields directly from the
85 * struct itself with no abstraction layer or any type of lazy loading.
86 * The actual definition is in package.c so it can have access to the
87 * default accessor functions which are defined there.
89 extern struct pkg_operations default_pkg_ops
;
92 unsigned long name_hash
;
113 pmpkgreason_t reason
;
115 /* origin == PKG_FROM_FILE, use pkg->origin_data.file
116 * origin == PKG_FROM_*DB, use pkg->origin_data.db */
121 pmdbinfrq_t infolevel
;
123 alpm_list_t
*licenses
;
124 alpm_list_t
*replaces
;
128 alpm_list_t
*depends
;
129 alpm_list_t
*optdepends
;
130 alpm_list_t
*conflicts
;
131 alpm_list_t
*provides
;
133 alpm_list_t
*delta_path
;
134 alpm_list_t
*removes
; /* in transaction targets only */
136 struct pkg_operations
*ops
;
139 pmpkg_t
* _alpm_pkg_new(void);
140 pmpkg_t
*_alpm_pkg_dup(pmpkg_t
*pkg
);
141 void _alpm_pkg_free(pmpkg_t
*pkg
);
142 void _alpm_pkg_free_trans(pmpkg_t
*pkg
);
143 int _alpm_pkg_cmp(const void *p1
, const void *p2
);
144 int _alpm_pkg_compare_versions(pmpkg_t
*local_pkg
, pmpkg_t
*pkg
);
145 pmpkg_t
*_alpm_pkg_find(alpm_list_t
*haystack
, const char *needle
);
146 int _alpm_pkg_should_ignore(pmpkg_t
*pkg
);
148 #endif /* _ALPM_PACKAGE_H */
150 /* vim: set ts=2 sw=2 noet: */