1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/librazor/razor.h.in Fri Oct 17 09:57:19 2014 +0100
1.3 @@ -0,0 +1,634 @@
1.4 +/*
1.5 + * Copyright (C) 2008 Kristian Høgsberg <krh@redhat.com>
1.6 + * Copyright (C) 2008 Red Hat, Inc
1.7 + * Copyright (C) 2009, 2011, 2012, 2014 J. Ali Harlow <ali@juiblex.co.uk>
1.8 + *
1.9 + * This program is free software; you can redistribute it and/or modify
1.10 + * it under the terms of the GNU General Public License as published by
1.11 + * the Free Software Foundation; either version 2 of the License, or
1.12 + * (at your option) any later version.
1.13 + *
1.14 + * This program is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License along
1.20 + * with this program; if not, write to the Free Software Foundation, Inc.,
1.21 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1.22 + */
1.23 +
1.24 +#ifndef _RAZOR_H_
1.25 +#define _RAZOR_H_
1.26 +
1.27 +#include <stdint.h>
1.28 +#include <sys/types.h>
1.29 +
1.30 +/* GCC extensions */
1.31 +#if defined(__GNUC__)
1.32 +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
1.33 +#define RAZOR_MALLOC __attribute__((__malloc__))
1.34 +#else
1.35 +#define RAZOR_MALLOC
1.36 +#endif
1.37 +#if __GNUC__ >= 4
1.38 +#define RAZOR_NULL_TERMINATED __attribute__ ((__sentinel__))
1.39 +#else
1.40 +#define RAZOR_NULL_TERMINATED
1.41 +#endif
1.42 +#endif /* __GNUC__ */
1.43 +
1.44 +enum razor_section_type {
1.45 + RAZOR_SECTION_MAIN = 0x01,
1.46 + RAZOR_SECTION_DETAILS = 0x02,
1.47 + RAZOR_SECTION_FILES = 0x04,
1.48 + RAZOR_SECTION_ALL = 0x07
1.49 +};
1.50 +
1.51 +enum razor_stage_type {
1.52 + RAZOR_STAGE_SCRIPTS_PRE = 0x1,
1.53 + RAZOR_STAGE_FILES = 0x2,
1.54 + RAZOR_STAGE_SCRIPTS_POST = 0x4,
1.55 + RAZOR_STAGE_SCRIPTS = 0x5,
1.56 + RAZOR_STAGE_ALL = 0x7
1.57 +};
1.58 +
1.59 +enum razor_detail_type {
1.60 + RAZOR_DETAIL_LAST = 0, /* the sentinel */
1.61 + RAZOR_DETAIL_NAME,
1.62 + RAZOR_DETAIL_VERSION,
1.63 + RAZOR_DETAIL_ARCH,
1.64 + RAZOR_DETAIL_SUMMARY,
1.65 + RAZOR_DETAIL_DESCRIPTION,
1.66 + RAZOR_DETAIL_URL,
1.67 + RAZOR_DETAIL_LICENSE,
1.68 + RAZOR_DETAIL_PREUNPROG,
1.69 + RAZOR_DETAIL_PREUN,
1.70 + RAZOR_DETAIL_POSTUNPROG,
1.71 + RAZOR_DETAIL_POSTUN,
1.72 + RAZOR_DETAIL_PREFIXES
1.73 +};
1.74 +
1.75 +enum razor_property_flags {
1.76 + RAZOR_PROPERTY_LESS = 1 << 0,
1.77 + RAZOR_PROPERTY_GREATER = 1 << 1,
1.78 + RAZOR_PROPERTY_EQUAL = 1 << 2,
1.79 + RAZOR_PROPERTY_RELATION_MASK =
1.80 + RAZOR_PROPERTY_LESS |
1.81 + RAZOR_PROPERTY_GREATER |
1.82 + RAZOR_PROPERTY_EQUAL,
1.83 +
1.84 + RAZOR_PROPERTY_REQUIRES = 0 << 3,
1.85 + RAZOR_PROPERTY_PROVIDES = 1 << 3,
1.86 + RAZOR_PROPERTY_CONFLICTS = 2 << 3,
1.87 + RAZOR_PROPERTY_OBSOLETES = 3 << 3,
1.88 + RAZOR_PROPERTY_TYPE_MASK = 3 << 3,
1.89 +
1.90 + RAZOR_PROPERTY_PRE = 1 << 5,
1.91 + RAZOR_PROPERTY_POST = 1 << 6,
1.92 + RAZOR_PROPERTY_PREUN = 1 << 7,
1.93 + RAZOR_PROPERTY_POSTUN = 1 << 8,
1.94 + RAZOR_PROPERTY_SCRIPT_MASK =
1.95 + RAZOR_PROPERTY_PRE |
1.96 + RAZOR_PROPERTY_POST |
1.97 + RAZOR_PROPERTY_PREUN |
1.98 + RAZOR_PROPERTY_POSTUN
1.99 +};
1.100 +
1.101 +enum razor_set_flags {
1.102 + /*
1.103 + * Create a private copy of the razor set such that changes made
1.104 + * to the underlying file are not visible in the razor set.
1.105 + * If this flag is not set then the caller must ensure that the
1.106 + * underlying file (if any) is not changed.
1.107 + */
1.108 + RAZOR_SET_PRIVATE = 1 << 0,
1.109 +};
1.110 +
1.111 +/**
1.112 + * SECTION:error
1.113 + * @title: Error reporting
1.114 + * @short_description: A system for reporting errors.
1.115 + *
1.116 + * This object represents an error condition.
1.117 + */
1.118 +struct razor_error;
1.119 +
1.120 +struct razor_error *razor_error_new_str(int domain, int code,
1.121 + const char *object, const char *str);
1.122 +struct razor_error *razor_error_dup(struct razor_error *src,
1.123 + const char *summary);
1.124 +
1.125 +#define razor_set_error(error, domain, code, object, str) \
1.126 + if (error) \
1.127 + *(error) = razor_error_new_str(domain, code, object, str); \
1.128 + else
1.129 +
1.130 +#define razor_propagate_error(dest, src, summary) \
1.131 + if (dest) \
1.132 + *(dest) = razor_error_dup(src, summary); \
1.133 + else
1.134 +
1.135 +#define RAZOR_ERROR_DOMAIN(i1,i2,i3,c) \
1.136 + (((i1)&0xff)<<24|((i2)&0xff)<<16|((i3)&0xff)<<8|(c)&0xff)
1.137 +
1.138 +#define RAZOR_GENERAL_ERROR RAZOR_ERROR_DOMAIN('R','z','r',0)
1.139 +#define RAZOR_POSIX_ERROR RAZOR_ERROR_DOMAIN('R','z','r',1)
1.140 +#define RAZOR_MSWIN_ERROR RAZOR_ERROR_DOMAIN('R','z','r',2)
1.141 +#define RAZOR_ZLIB_ERROR RAZOR_ERROR_DOMAIN('R','z','r',3)
1.142 +
1.143 +enum razor_general_error {
1.144 + RAZOR_GENERAL_ERROR_FAILED,
1.145 + RAZOR_GENERAL_ERROR_DATABASE_CORRUPTED,
1.146 + RAZOR_GENERAL_ERROR_DATABASE_INCOMPATIBLE,
1.147 + RAZOR_GENERAL_ERROR_DATABASE_EXISTS,
1.148 + RAZOR_GENERAL_ERROR_DATABASE_LOCKED,
1.149 + RAZOR_GENERAL_ERROR_RPM_UNSUPPORTED,
1.150 +};
1.151 +
1.152 +int razor_error_get_domain(struct razor_error *error);
1.153 +int razor_error_get_code(struct razor_error *error);
1.154 +const char *razor_error_get_object(struct razor_error *error);
1.155 +const char *razor_error_get_primary_text(struct razor_error *error);
1.156 +const char *razor_error_get_secondary_text(struct razor_error *error);
1.157 +const char *razor_error_get_msg(struct razor_error *error);
1.158 +void razor_error_free(struct razor_error *error);
1.159 +
1.160 +/**
1.161 + * SECTION:atomic
1.162 + * @title: Atomic transactions
1.163 + * @short_description: File-based transactions that shouldn't half-succeed
1.164 + *
1.165 + * This is a helper object for issuing a sequence of file-based actions
1.166 + * that should either all succeed or all fail.
1.167 + *
1.168 + * Note that currently only Windows 7 has a native implementation and that
1.169 + * while the emulated fallback implementation attempts to rollback the
1.170 + * transaction if it fails, this is not guaranteed to succeed and that
1.171 + * the transaction is held in core (and thus vulnernable to program crashes,
1.172 + * power loss, etc.). This could (and should) be improved.
1.173 + *
1.174 + * Atomic transactions can be disabled via configure, in which case all
1.175 + * bets are off.
1.176 + **/
1.177 +
1.178 +@RAZOR_HAVE_ATOMIC_ROLLBACK@
1.179 +
1.180 +struct razor_atomic;
1.181 +
1.182 +struct razor_atomic *razor_atomic_open(const char *description);
1.183 +int razor_atomic_commit(struct razor_atomic *atomic);
1.184 +struct razor_error *razor_atomic_get_error(struct razor_atomic *atomic);
1.185 +const char *razor_atomic_get_error_msg(struct razor_atomic *atomic);
1.186 +void razor_atomic_destroy(struct razor_atomic *atomic);
1.187 +
1.188 +/**
1.189 + * razor_atomic_make_dirs
1.190 + *
1.191 + * Create all sub-directories leading up to path. We know root exists
1.192 + * and is a dir, root does not end in a '/', and path either has a
1.193 + * leading '/' or (on MS-Windows only) root is the empty string
1.194 + * and path starts with drive (eg., "c:/windows").
1.195 + * Note: path itself is not created, only the directory in which it
1.196 + * (would) exist.
1.197 + *
1.198 + * Returns: non-zero on error.
1.199 + **/
1.200 +int razor_atomic_make_dirs(struct razor_atomic *atomic, const char *root,
1.201 + const char *path);
1.202 +int razor_atomic_remove(struct razor_atomic *atomic, const char *path);
1.203 +int razor_atomic_rename_file(struct razor_atomic *atomic, const char *oldpath,
1.204 + const char *newpath);
1.205 +
1.206 +/**
1.207 + * razor_atomic_create_dir
1.208 + *
1.209 + * Create a directory, replacing any existing object at this path except
1.210 + * an existing directory (which is not counted as a error).
1.211 + *
1.212 + * Returns: non-zero on error.
1.213 + */
1.214 +int razor_atomic_create_dir(struct razor_atomic *atomic, const char *dirname,
1.215 + mode_t mode);
1.216 +
1.217 +/**
1.218 + * razor_atomic_create_symlink
1.219 + *
1.220 + * Create a symbolic link, replacing any existing object at this path except
1.221 + * a non-empty directory.
1.222 + *
1.223 + * Note: This function will always fail on platforms that don't support
1.224 + * symbolic links.
1.225 + *
1.226 + * Returns: non-zero on error.
1.227 + */
1.228 +int razor_atomic_create_symlink(struct razor_atomic *atomic, const char *target,
1.229 + const char *path);
1.230 +/**
1.231 + * razor_atomic_create_file
1.232 + *
1.233 + * Create a file, replacing any existing object at this path except
1.234 + * a non-empty directory.
1.235 + *
1.236 + * Returns: A handle to be passed to razor_atomic_write() and
1.237 + * razor_atomic_close() or a negative value on error.
1.238 + */
1.239 +int razor_atomic_create_file(struct razor_atomic *atomic, const char *filename,
1.240 + mode_t mode);
1.241 +int razor_atomic_write(struct razor_atomic *atomic, int handle,
1.242 + const void *data, size_t size);
1.243 +int razor_atomic_close(struct razor_atomic *atomic, int handle);
1.244 +int razor_atomic_sync(struct razor_atomic *atomic, int handle);
1.245 +void razor_atomic_abort(struct razor_atomic *atomic, int domain, int code,
1.246 + const char *error_msg);
1.247 +void razor_atomic_propagate_error(struct razor_atomic *atomic,
1.248 + struct razor_error *error, const char *summary);
1.249 +int razor_atomic_in_error_state(struct razor_atomic *atomic);
1.250 +
1.251 +/**
1.252 + * SECTION:set
1.253 + * @title: Package Set
1.254 + * @short_description: Represents a set of packages and their metadata.
1.255 + *
1.256 + * This object represents a set of packages, their dependency
1.257 + * information, the file lists and a number of other details.
1.258 + **/
1.259 +
1.260 +struct razor_set;
1.261 +struct razor_package;
1.262 +struct razor_property;
1.263 +
1.264 +#define RAZOR_HEADER_VERSION 2 /* Current version */
1.265 +#define RAZOR_HEADER_VERSION_MIN 1 /* Minimum version we support */
1.266 +
1.267 +/**
1.268 + * razor_set_create:
1.269 + *
1.270 + * Create a new #razor_set object.
1.271 + *
1.272 + * Returns: the new #razor_set object.
1.273 + **/
1.274 +struct razor_set *razor_set_create_without_root(void);
1.275 +struct razor_set *razor_set_create(void);
1.276 +struct razor_set *
1.277 +razor_set_open(const char *filename, enum razor_set_flags flags,
1.278 + struct razor_error **error);
1.279 +uint32_t razor_set_get_header_version(struct razor_set *set);
1.280 +int razor_set_set_header_version(struct razor_set *set,
1.281 + uint32_t header_version);
1.282 +void razor_set_unref(struct razor_set *set);
1.283 +struct razor_set *razor_set_ref(struct razor_set *set);
1.284 +void razor_set_write_to_handle(struct razor_set *set,
1.285 + struct razor_atomic *atomic, int handle,
1.286 + uint32_t section_mask);
1.287 +int razor_set_write(struct razor_set *set, struct razor_atomic *atomic,
1.288 + const char *filename, uint32_t setions);
1.289 +int
1.290 +razor_set_bind_sections(struct razor_set *set, const char *filename,
1.291 + enum razor_set_flags flags, struct razor_error **error);
1.292 +
1.293 +void
1.294 +razor_package_get_details(struct razor_set *set,
1.295 + struct razor_package *package, ...);
1.296 +int
1.297 +razor_package_remove(struct razor_set *prev, struct razor_set *next,
1.298 + struct razor_atomic *atomic, struct razor_package *package,
1.299 + const char *root, int install_count,
1.300 + enum razor_stage_type stage);
1.301 +
1.302 +/**
1.303 + * SECTION:iterator
1.304 + * @title: Iterators
1.305 + * @short_description: Objects for traversing packages or properties.
1.306 + *
1.307 + * The razor iterator objects provides a way to iterate through a set
1.308 + * of packages or properties.
1.309 + **/
1.310 +
1.311 +struct razor_package_iterator;
1.312 +
1.313 +/**
1.314 + * razor_package_iterator_create:
1.315 + *
1.316 + * Create a new #razor_package_iterator object.
1.317 + *
1.318 + * Returns: the new #razor_package_iterator object.
1.319 + **/
1.320 +
1.321 +struct razor_package_iterator *
1.322 +razor_package_iterator_create(struct razor_set *set);
1.323 +
1.324 +/**
1.325 + * razor_package_iterator_create_for_property:
1.326 + *
1.327 + * Create a new #razor_package_iterator object for the packages that
1.328 + * own the given property.
1.329 + *
1.330 + * Returns: the new #razor_package_iterator object.
1.331 + **/
1.332 +struct razor_package_iterator *
1.333 +razor_package_iterator_create_for_property(struct razor_set *set,
1.334 + struct razor_property *property);
1.335 +
1.336 +/**
1.337 + * razor_package_iterator_create_for_file:
1.338 + *
1.339 + * Create a new #razor_package_iterator object for the packages that
1.340 + * contain the given file name.
1.341 + *
1.342 + * Returns: the new #razor_package_iterator object.
1.343 + **/
1.344 +struct razor_package_iterator *
1.345 +razor_package_iterator_create_for_file(struct razor_set *set,
1.346 + const char *filename);
1.347 +
1.348 +int razor_package_iterator_next(struct razor_package_iterator *pi,
1.349 + struct razor_package **package, ...);
1.350 +void razor_package_iterator_destroy(struct razor_package_iterator *pi);
1.351 +
1.352 +struct razor_package_query *
1.353 +razor_package_query_create(struct razor_set *set);
1.354 +void
1.355 +razor_package_query_add_package(struct razor_package_query *pq,
1.356 + struct razor_package *p);
1.357 +void
1.358 +razor_package_query_add_iterator(struct razor_package_query *pq,
1.359 + struct razor_package_iterator *pi);
1.360 +struct razor_package_iterator *
1.361 +razor_package_query_finish(struct razor_package_query *pq);
1.362 +
1.363 +struct razor_property_iterator;
1.364 +struct razor_property_iterator *
1.365 +razor_property_iterator_create(struct razor_set *set,
1.366 + struct razor_package *package);
1.367 +int razor_property_iterator_next(struct razor_property_iterator *pi,
1.368 + struct razor_property **property,
1.369 + const char **name,
1.370 + uint32_t *flags,
1.371 + const char **version);
1.372 +void
1.373 +razor_property_iterator_destroy(struct razor_property_iterator *pi);
1.374 +
1.375 +struct razor_file_iterator;
1.376 +struct razor_file_iterator *
1.377 +razor_file_iterator_create(struct razor_set *set,
1.378 + struct razor_package *package, int post_order);
1.379 +int razor_file_iterator_next(struct razor_file_iterator *fi,
1.380 + const char **name);
1.381 +void razor_file_iterator_destroy(struct razor_file_iterator *fi);
1.382 +
1.383 +void razor_set_list_files(struct razor_set *set, const char *prefix);
1.384 +void razor_set_list_package_files(struct razor_set *set,
1.385 + struct razor_package *package);
1.386 +
1.387 +enum razor_diff_action {
1.388 + RAZOR_DIFF_ACTION_ADD,
1.389 + RAZOR_DIFF_ACTION_REMOVE,
1.390 +};
1.391 +
1.392 +typedef void (*razor_diff_callback_t)(enum razor_diff_action action,
1.393 + struct razor_package *package,
1.394 + const char *name,
1.395 + const char *version,
1.396 + const char *arch,
1.397 + void *data);
1.398 +
1.399 +void
1.400 +razor_set_diff(struct razor_set *set, struct razor_set *upstream,
1.401 + razor_diff_callback_t callback, void *data);
1.402 +
1.403 +struct razor_install_iterator;
1.404 +
1.405 +enum razor_install_action {
1.406 + RAZOR_INSTALL_ACTION_ADD,
1.407 + RAZOR_INSTALL_ACTION_REMOVE,
1.408 + RAZOR_INSTALL_ACTION_COMMIT
1.409 +};
1.410 +
1.411 +struct razor_install_iterator *
1.412 +razor_set_create_install_iterator(struct razor_set *set,
1.413 + struct razor_set *next);
1.414 +
1.415 +int razor_install_iterator_next(struct razor_install_iterator *ii,
1.416 + struct razor_package **package,
1.417 + enum razor_install_action *action,
1.418 + int *count);
1.419 +
1.420 +/**
1.421 + * razor_install_iterator_commit_set
1.422 + *
1.423 + * Immediately after razor_install_iterator_next() returns
1.424 + * RAZOR_INSTALL_ACTION_COMMIT, this function will return the razor_set
1.425 + * which should be committed.
1.426 + *
1.427 + * Returns: a new #razor_set object.
1.428 + **/
1.429 +struct razor_set *
1.430 +razor_install_iterator_commit_set(struct razor_install_iterator *ii);
1.431 +
1.432 +void razor_install_iterator_rewind(struct razor_install_iterator *ii);
1.433 +size_t razor_install_iterator_tell(struct razor_install_iterator *ii);
1.434 +size_t razor_install_iterator_seek(struct razor_install_iterator *ii,
1.435 + size_t pos);
1.436 +void razor_install_iterator_destroy(struct razor_install_iterator *ii);
1.437 +
1.438 +/**
1.439 + * SECTION:transaction
1.440 + * @title: Transaction
1.441 + * @short_description: Create a new package set by merging two or more sets.
1.442 + *
1.443 + * The razor transaction object provides a way to create a new package set
1.444 + * from packages from one or more other package sets.
1.445 + **/
1.446 +
1.447 +struct razor_rpm;
1.448 +
1.449 +struct razor_transaction *
1.450 +razor_transaction_create(struct razor_set *system, struct razor_set *upstream);
1.451 +void razor_transaction_install_package(struct razor_transaction *transaction,
1.452 + struct razor_package *package);
1.453 +void razor_transaction_remove_package(struct razor_transaction *transaction,
1.454 + struct razor_package *package);
1.455 +void razor_transaction_update_package(struct razor_transaction *trans,
1.456 + struct razor_package *package);
1.457 +void razor_transaction_fixup_package(struct razor_transaction *trans,
1.458 + struct razor_package *package,
1.459 + struct razor_rpm *rpm);
1.460 +void razor_transaction_update_all(struct razor_transaction *transaction);
1.461 +int razor_transaction_resolve(struct razor_transaction *trans);
1.462 +
1.463 +typedef void (*razor_unsatisfied_callback_t)(const char *requirement,
1.464 + struct razor_package *package,
1.465 + const char *name,
1.466 + const char *version,
1.467 + const char *arch,
1.468 + void *data);
1.469 +
1.470 +int razor_transaction_unsatisfied(struct razor_transaction *trans,
1.471 + razor_unsatisfied_callback_t callback,
1.472 + void *data);
1.473 +int razor_transaction_describe(struct razor_transaction *trans);
1.474 +struct razor_set *razor_transaction_commit(struct razor_transaction *trans);
1.475 +void razor_transaction_destroy(struct razor_transaction *trans);
1.476 +
1.477 +/* Temporary helper for test suite. */
1.478 +int razor_transaction_unsatisfied_property(struct razor_transaction *trans,
1.479 + const char *name,
1.480 + uint32_t flags,
1.481 + const char *version);
1.482 +
1.483 +/**
1.484 + * SECTION:rpm
1.485 + * @title: Razor RPM
1.486 + * @short_description: Operating on RPM files.
1.487 + *
1.488 + * Functions for open RPM files and extracting information and
1.489 + * installing or removing RPM files.
1.490 + **/
1.491 +
1.492 +struct razor_relocations;
1.493 +
1.494 +struct razor_relocations *razor_relocations_create(void);
1.495 +void razor_relocations_add(struct razor_relocations *relocations,
1.496 + const char *oldpath, const char *newpath);
1.497 +void razor_relocations_set_rpm(struct razor_relocations *relocations,
1.498 + struct razor_rpm *rpm);
1.499 +const char *razor_relocations_apply(struct razor_relocations *relocations,
1.500 + const char *path);
1.501 +void razor_relocations_destroy(struct razor_relocations *relocations);
1.502 +
1.503 +struct razor_rpm *razor_rpm_open(const char *filename,
1.504 + struct razor_error **error);
1.505 +void razor_rpm_get_details(struct razor_rpm *rpm, ...);
1.506 +void razor_rpm_set_relocations(struct razor_rpm *rpm,
1.507 + struct razor_relocations *relocations);
1.508 +int razor_rpm_install(struct razor_rpm *rpm, struct razor_atomic *atomic,
1.509 + const char *root, int install_count,
1.510 + enum razor_stage_type stage);
1.511 +int razor_rpm_close(struct razor_rpm *rpm);
1.512 +
1.513 +/**
1.514 + * SECTION:importer
1.515 + * @title: Importer
1.516 + * @short_description: A mechanism for building #razor_set objects
1.517 + *
1.518 + * The %razor_importer is a helper object for building a razor set
1.519 + * from external sources, like yum metadata, the RPM database or RPM
1.520 + * files.
1.521 + *
1.522 + * The importer is a stateful object; it has the notion of a current
1.523 + * package, and the caller can provide meta data such as properties,
1.524 + * files and similiar for the package as it becomes available. Once a
1.525 + * package is fully described, the next pacakge can begin. When all
1.526 + * packages have been described to the importer, the importer will
1.527 + * create a new %razor_set with the specified packages.
1.528 + *
1.529 + * A typical use
1.530 + * of the importer will follow this template:
1.531 + * |[
1.532 + * importer = razor_importer_create();
1.533 + *
1.534 + * while ( /<!-- -->* more packages to import *<!-- -->/; ) {
1.535 + * /<!-- -->* get name, version and arch of next package *<!-- -->/
1.536 + * razor_importer_begin_package(importer, name, version, arch);
1.537 + * razor_importer_add_details(importer, summary, description, url, license);
1.538 + *
1.539 + * while ( /<!-- -->* more properties to add *<!-- -->/ )
1.540 + * razor_importer_add_property(importer, name, flags, version);
1.541 + *
1.542 + * while ( /<!-- -->* [more files to add *<!-- -->/ )
1.543 + * razor_importer_add_file(importer, name);
1.544 + *
1.545 + * razor_importer_finish_package(importer);
1.546 + * }
1.547 + *
1.548 + * return razor_importer_finish(importer);
1.549 + * ]|
1.550 + **/
1.551 +struct razor_importer;
1.552 +
1.553 +struct razor_importer *razor_importer_create(void);
1.554 +void razor_importer_destroy(struct razor_importer *importer);
1.555 +void razor_importer_begin_package(struct razor_importer *importer,
1.556 + const char *name,
1.557 + const char *version,
1.558 + const char *arch);
1.559 +void razor_importer_add_details(struct razor_importer *importer,
1.560 + const char *summary,
1.561 + const char *description,
1.562 + const char *url,
1.563 + const char *license);
1.564 +void razor_importer_add_script(struct razor_importer *importer,
1.565 + enum razor_property_flags script,
1.566 + const char *program,
1.567 + const char *body);
1.568 +void razor_importer_add_install_prefix(struct razor_importer *importer,
1.569 + const char *install_prefix);
1.570 +void razor_importer_add_property(struct razor_importer *importer,
1.571 + const char *name,
1.572 + uint32_t flags,
1.573 + const char *version);
1.574 +void razor_importer_add_file(struct razor_importer *importer,
1.575 + const char *name);
1.576 +void razor_importer_finish_package(struct razor_importer *importer);
1.577 +
1.578 +int razor_importer_add_rpm(struct razor_importer *importer,
1.579 + struct razor_rpm *rpm);
1.580 +
1.581 +struct razor_set *razor_importer_finish(struct razor_importer *importer);
1.582 +
1.583 +struct razor_set *razor_set_create_from_yum(void);
1.584 +struct razor_set *razor_set_create_from_rpmdb(void);
1.585 +
1.586 +/**
1.587 + * SECTION:root
1.588 + * @title: Root
1.589 + * @short_description: Functions for accessing an install root.
1.590 + *
1.591 + * The #razor_root object encapsulate access to and locking of a razor
1.592 + * install root.
1.593 + **/
1.594 +struct razor_root;
1.595 +
1.596 +const char *razor_get_database_path();
1.597 +void razor_set_database_path(const char *database_path);
1.598 +int razor_root_create(const char *root, struct razor_error **error);
1.599 +struct razor_root *
1.600 +razor_root_open(const char *root, struct razor_error **error);
1.601 +struct razor_set *
1.602 +razor_root_open_read_only(const char *root, struct razor_error **error);
1.603 +struct razor_set *razor_root_get_system_set(struct razor_root *root);
1.604 +int razor_root_close(struct razor_root *root);
1.605 +int
1.606 +razor_root_update(struct razor_root *root, struct razor_set *next,
1.607 + struct razor_atomic *atomic);
1.608 +
1.609 +/**
1.610 + * SECTION:misc
1.611 + * @title: Miscellaneous Functions
1.612 + * @short_description: Various helper functions
1.613 + *
1.614 + * Functions that doesn't fit anywhere else.
1.615 + **/
1.616 +
1.617 +const char *
1.618 +razor_property_relation_to_string(struct razor_property *p);
1.619 +const char *
1.620 +razor_property_type_to_string(struct razor_property *p);
1.621 +
1.622 +void razor_build_evr(char *evr_buf, int size, const char *epoch,
1.623 + const char *version, const char *release);
1.624 +int razor_versioncmp(const char *s1, const char *s2);
1.625 +
1.626 +void razor_disable_root_name_checks(int disable);
1.627 +
1.628 +void razor_set_lua_loader(const char *modname, void (*loader)());
1.629 +void (*razor_get_lua_loader(const char *modname))();
1.630 +
1.631 +char *razor_concat(const char *s, ...) RAZOR_MALLOC RAZOR_NULL_TERMINATED;
1.632 +
1.633 +char *razor_path_add_root(const char *path, const char *root) RAZOR_MALLOC;
1.634 +
1.635 +const char *razor_system_arch(void);
1.636 +
1.637 +#endif /* _RAZOR_H_ */