dpkg 1.21.11
pkg-spec.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * pkg-spec.h - primitives for pkg specifier handling
4 *
5 * Copyright © 2011 Linaro Limited
6 * Copyright © 2011 Raphaël Hertzog <hertzog@debian.org>
7 * Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
8 *
9 * This is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef LIBDPKG_PKG_SPEC_H
24#define LIBDPKG_PKG_SPEC_H
25
26#include <stdbool.h>
27
28#include <dpkg/macros.h>
29#include <dpkg/dpkg-db.h>
30#include <dpkg/error.h>
31#include <dpkg/arch.h>
32
34
44
45 /* How to consider the lack of an arch qualifier. */
49};
50
51struct pkg_spec {
52 char *name;
53 const struct dpkg_arch *arch;
54
56
57 /* Members below are private state. */
58
61
66};
67
68void pkg_spec_init(struct pkg_spec *ps, enum pkg_spec_flags flags);
69void pkg_spec_destroy(struct pkg_spec *ps);
70
71const char *pkg_spec_is_illegal(struct pkg_spec *ps);
72
73const char *pkg_spec_set(struct pkg_spec *ps,
74 const char *pkgname, const char *archname);
75const char *pkg_spec_parse(struct pkg_spec *ps, const char *str);
76bool pkg_spec_match_pkg(struct pkg_spec *ps,
77 struct pkginfo *pkg, struct pkgbin *pkgbin);
78
79struct pkginfo *pkg_spec_parse_pkg(const char *str, struct dpkg_error *err);
80struct pkginfo *pkg_spec_find_pkg(const char *pkgname, const char *archname,
81 struct dpkg_error *err);
82
83void pkg_spec_iter_init(struct pkg_spec *ps);
84struct pkginfo *pkg_spec_iter_next_pkg(struct pkg_spec *ps);
85void pkg_spec_iter_destroy(struct pkg_spec *ps);
86
90
91#endif
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
#define DPKG_BIT(n)
Return the integer value of bit n.
Definition: macros.h:125
void pkg_spec_iter_destroy(struct pkg_spec *ps)
Definition: pkg-spec.c:291
pkg_spec_flags
Definition: pkg-spec.h:41
const char * pkg_spec_is_illegal(struct pkg_spec *ps)
Definition: pkg-spec.c:63
const char * pkg_spec_set(struct pkg_spec *ps, const char *pkgname, const char *archname)
Definition: pkg-spec.c:135
struct pkginfo * pkg_spec_find_pkg(const char *pkgname, const char *archname, struct dpkg_error *err)
Definition: pkg-spec.c:224
struct pkginfo * pkg_spec_iter_next_pkg(struct pkg_spec *ps)
Definition: pkg-spec.c:282
bool pkg_spec_match_pkg(struct pkg_spec *ps, struct pkginfo *pkg, struct pkgbin *pkgbin)
Definition: pkg-spec.c:187
void pkg_spec_destroy(struct pkg_spec *ps)
Definition: pkg-spec.c:298
const char * pkg_spec_parse(struct pkg_spec *ps, const char *str)
Definition: pkg-spec.c:141
void pkg_spec_init(struct pkg_spec *ps, enum pkg_spec_flags flags)
Definition: pkg-spec.c:54
struct pkginfo * pkg_spec_parse_pkg(const char *str, struct dpkg_error *err)
Definition: pkg-spec.c:204
void pkg_spec_iter_init(struct pkg_spec *ps)
Definition: pkg-spec.c:245
@ PKG_SPEC_ARCH_MASK
Definition: pkg-spec.h:48
@ PKG_SPEC_ARCH_WILDCARD
Definition: pkg-spec.h:47
@ PKG_SPEC_ARCH_SINGLE
Definition: pkg-spec.h:46
@ PKG_SPEC_PATTERNS
Recognize glob patterns.
Definition: pkg-spec.h:43
Definition: arch.h:48
Definition: error.h:42
Definition: pkg-hash.c:259
Definition: pkg-spec.h:51
struct pkginfo * pkg_next
Used for the pkgset iterator.
Definition: pkg-spec.h:65
struct pkg_hash_iter * pkg_iter
Used for the pkg_db iterator.
Definition: pkg-spec.h:63
char * name
Definition: pkg-spec.h:52
enum pkg_spec_flags flags
Definition: pkg-spec.h:55
bool arch_is_pattern
Definition: pkg-spec.h:60
const struct dpkg_arch * arch
Definition: pkg-spec.h:53
bool name_is_pattern
Definition: pkg-spec.h:59
Node describing a binary package file.
Definition: dpkg-db.h:108
Node describing an architecture package instance.
Definition: dpkg-db.h:198