A few final changes for the 3.0.6 release
[pacman.git] / lib / libalpm / package.h
blob8055c17761daf23abba2450c70393ba164ca802a
1 /*
2 * package.h
3 *
4 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
5 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
6 * Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
7 * Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
8 * Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 * USA.
25 #ifndef _ALPM_PACKAGE_H
26 #define _ALPM_PACKAGE_H
28 #if defined(__APPLE__) || defined(__sun__)
29 #include <time.h>
30 #endif
32 #include "alpm.h"
33 #include "db.h"
35 typedef enum _pmpkgfrom_t {
36 PKG_FROM_CACHE = 1,
37 PKG_FROM_FILE
38 } pmpkgfrom_t;
40 /* Packages */
41 #define PKG_FILENAME_LEN 512
42 #define PKG_NAME_LEN 256
43 #define PKG_VERSION_LEN 64
44 #define PKG_FULLNAME_LEN (PKG_NAME_LEN + PKG_VERSION_LEN)
45 #define PKG_DESC_LEN 512
46 #define PKG_URL_LEN 256
47 #define PKG_DATE_LEN 32
48 #define PKG_TYPE_LEN 32
49 #define PKG_PACKAGER_LEN 64
50 #define PKG_MD5SUM_LEN 33
51 #define PKG_SHA1SUM_LEN 41
52 #define PKG_ARCH_LEN 32
54 struct __pmpkg_t {
55 char filename[PKG_FILENAME_LEN];
56 char name[PKG_NAME_LEN];
57 char version[PKG_VERSION_LEN];
58 char desc[PKG_DESC_LEN];
59 char url[PKG_URL_LEN];
60 char builddate[PKG_DATE_LEN];
61 char buildtype[PKG_TYPE_LEN];
62 char installdate[PKG_DATE_LEN];
63 char packager[PKG_PACKAGER_LEN];
64 char md5sum[PKG_MD5SUM_LEN];
65 char sha1sum[PKG_SHA1SUM_LEN];
66 char arch[PKG_ARCH_LEN];
67 unsigned long size;
68 unsigned long isize;
69 unsigned short scriptlet;
70 unsigned short force;
71 time_t date;
72 pmpkgreason_t reason;
73 /* alpm_list_t *desc_localized;*/
74 alpm_list_t *licenses;
75 alpm_list_t *replaces;
76 alpm_list_t *groups;
77 alpm_list_t *files;
78 alpm_list_t *backup;
79 alpm_list_t *depends;
80 alpm_list_t *removes;
81 alpm_list_t *requiredby;
82 alpm_list_t *conflicts;
83 alpm_list_t *provides;
84 /* internal */
85 pmpkgfrom_t origin;
86 void *data;
87 /* TODO replace 'data' with this:
88 origin == PKG_FROM_CACHE, use pkg->origin_data.db
89 origin == PKG_FROM_FILE, use pkg->origin_data.fd
90 union {
91 int fd;
92 pmdb_t *db;
93 } origin_data;
95 pmdbinfrq_t infolevel;
98 #define FREEPKG(p) do { if(p){_alpm_pkg_free(p); p = NULL;}} while(0)
99 #define FREELISTPKGS(p) _FREELIST(p, _alpm_pkg_free)
101 pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
102 pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
103 void _alpm_pkg_free(void *data);
104 int _alpm_pkg_cmp(const void *p1, const void *p2);
105 int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
106 pmpkg_t *_alpm_pkg_load(const char *pkgfile);
107 pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
108 int _alpm_pkg_splitname(const char *target, char *name, char *version, int witharch);
109 int _alpm_pkg_istoonew(pmpkg_t *pkg);
110 void _alpm_pkg_update_requiredby(pmpkg_t *pkg);
112 #endif /* _ALPM_PACKAGE_H */
114 /* vim: set ts=2 sw=2 noet: */