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 */
33 typedef enum _pmpkgfrom_t
{
39 /** Package operations struct. This struct contains function pointers to
40 * all methods used to access data in a package to allow for things such
41 * as lazy package intialization (such as used by the file backend). Each
42 * backend is free to define a stuct containing pointers to a specific
43 * implementation of these methods. Some backends may find using the
44 * defined default_pkg_ops struct to work just fine for their needs.
46 struct pkg_operations
{
47 const char *(*get_filename
) (pmpkg_t
*);
48 const char *(*get_name
) (pmpkg_t
*);
49 const char *(*get_version
) (pmpkg_t
*);
50 const char *(*get_desc
) (pmpkg_t
*);
51 const char *(*get_url
) (pmpkg_t
*);
52 time_t (*get_builddate
) (pmpkg_t
*);
53 time_t (*get_installdate
) (pmpkg_t
*);
54 const char *(*get_packager
) (pmpkg_t
*);
55 const char *(*get_md5sum
) (pmpkg_t
*);
56 const char *(*get_arch
) (pmpkg_t
*);
57 off_t (*get_size
) (pmpkg_t
*);
58 off_t (*get_isize
) (pmpkg_t
*);
59 pmpkgreason_t (*get_reason
) (pmpkg_t
*);
60 int (*has_scriptlet
) (pmpkg_t
*);
62 alpm_list_t
*(*get_licenses
) (pmpkg_t
*);
63 alpm_list_t
*(*get_groups
) (pmpkg_t
*);
64 alpm_list_t
*(*get_depends
) (pmpkg_t
*);
65 alpm_list_t
*(*get_optdepends
) (pmpkg_t
*);
66 alpm_list_t
*(*get_conflicts
) (pmpkg_t
*);
67 alpm_list_t
*(*get_provides
) (pmpkg_t
*);
68 alpm_list_t
*(*get_replaces
) (pmpkg_t
*);
69 alpm_list_t
*(*get_deltas
) (pmpkg_t
*);
70 alpm_list_t
*(*get_files
) (pmpkg_t
*);
71 alpm_list_t
*(*get_backup
) (pmpkg_t
*);
73 void *(*changelog_open
) (pmpkg_t
*);
74 size_t (*changelog_read
) (void *, size_t, const pmpkg_t
*, const void *);
75 int (*changelog_close
) (const pmpkg_t
*, void *);
79 * compute_requiredby()
83 /** The standard package operations struct. get fields directly from the
84 * struct itself with no abstraction layer or any type of lazy loading.
85 * The actual definition is in package.c so it can have access to the
86 * default accessor functions which are defined there.
88 extern struct pkg_operations default_pkg_ops
;
91 unsigned long name_hash
;
110 pmpkgreason_t reason
;
112 /* origin == PKG_FROM_FILE, use pkg->origin_data.file
113 * origin == PKG_FROM_*DB, use pkg->origin_data.db */
118 pmdbinfrq_t infolevel
;
120 alpm_list_t
*licenses
;
121 alpm_list_t
*replaces
;
125 alpm_list_t
*depends
;
126 alpm_list_t
*optdepends
;
127 alpm_list_t
*conflicts
;
128 alpm_list_t
*provides
;
130 alpm_list_t
*delta_path
;
131 alpm_list_t
*removes
; /* in transaction targets only */
133 struct pkg_operations
*ops
;
136 pmpkg_t
* _alpm_pkg_new(void);
137 pmpkg_t
*_alpm_pkg_dup(pmpkg_t
*pkg
);
138 void _alpm_pkg_free(pmpkg_t
*pkg
);
139 void _alpm_pkg_free_trans(pmpkg_t
*pkg
);
140 int _alpm_pkg_cmp(const void *p1
, const void *p2
);
141 int _alpm_pkg_compare_versions(pmpkg_t
*local_pkg
, pmpkg_t
*pkg
);
142 pmpkg_t
*_alpm_pkg_find(alpm_list_t
*haystack
, const char *needle
);
143 int _alpm_pkg_should_ignore(pmpkg_t
*pkg
);
145 #endif /* _ALPM_PACKAGE_H */
147 /* vim: set ts=2 sw=2 noet: */