1.1 --- a/librazor/razor.h Fri Oct 03 12:24:10 2014 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,631 +0,0 @@
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 -struct razor_atomic;
1.178 -
1.179 -struct razor_atomic *razor_atomic_open(const char *description);
1.180 -int razor_atomic_commit(struct razor_atomic *atomic);
1.181 -struct razor_error *razor_atomic_get_error(struct razor_atomic *atomic);
1.182 -const char *razor_atomic_get_error_msg(struct razor_atomic *atomic);
1.183 -void razor_atomic_destroy(struct razor_atomic *atomic);
1.184 -
1.185 -/**
1.186 - * razor_atomic_make_dirs
1.187 - *
1.188 - * Create all sub-directories leading up to path. We know root exists
1.189 - * and is a dir, root does not end in a '/', and path either has a
1.190 - * leading '/' or (on MS-Windows only) root is the empty string
1.191 - * and path starts with drive (eg., "c:/windows").
1.192 - * Note: path itself is not created, only the directory in which it
1.193 - * (would) exist.
1.194 - *
1.195 - * Returns: non-zero on error.
1.196 - **/
1.197 -int razor_atomic_make_dirs(struct razor_atomic *atomic, const char *root,
1.198 - const char *path);
1.199 -int razor_atomic_remove(struct razor_atomic *atomic, const char *path);
1.200 -int razor_atomic_rename_file(struct razor_atomic *atomic, const char *oldpath,
1.201 - const char *newpath);
1.202 -
1.203 -/**
1.204 - * razor_atomic_create_dir
1.205 - *
1.206 - * Create a directory, replacing any existing object at this path except
1.207 - * an existing directory (which is not counted as a error).
1.208 - *
1.209 - * Returns: non-zero on error.
1.210 - */
1.211 -int razor_atomic_create_dir(struct razor_atomic *atomic, const char *dirname,
1.212 - mode_t mode);
1.213 -
1.214 -/**
1.215 - * razor_atomic_create_symlink
1.216 - *
1.217 - * Create a symbolic link, replacing any existing object at this path except
1.218 - * a non-empty directory.
1.219 - *
1.220 - * Note: This function will always fail on platforms that don't support
1.221 - * symbolic links.
1.222 - *
1.223 - * Returns: non-zero on error.
1.224 - */
1.225 -int razor_atomic_create_symlink(struct razor_atomic *atomic, const char *target,
1.226 - const char *path);
1.227 -/**
1.228 - * razor_atomic_create_file
1.229 - *
1.230 - * Create a file, replacing any existing object at this path except
1.231 - * a non-empty directory.
1.232 - *
1.233 - * Returns: A handle to be passed to razor_atomic_write() and
1.234 - * razor_atomic_close() or a negative value on error.
1.235 - */
1.236 -int razor_atomic_create_file(struct razor_atomic *atomic, const char *filename,
1.237 - mode_t mode);
1.238 -int razor_atomic_write(struct razor_atomic *atomic, int handle,
1.239 - const void *data, size_t size);
1.240 -int razor_atomic_close(struct razor_atomic *atomic, int handle);
1.241 -int razor_atomic_sync(struct razor_atomic *atomic, int handle);
1.242 -void razor_atomic_abort(struct razor_atomic *atomic, int domain, int code,
1.243 - const char *error_msg);
1.244 -void razor_atomic_propagate_error(struct razor_atomic *atomic,
1.245 - struct razor_error *error, const char *summary);
1.246 -int razor_atomic_in_error_state(struct razor_atomic *atomic);
1.247 -
1.248 -/**
1.249 - * SECTION:set
1.250 - * @title: Package Set
1.251 - * @short_description: Represents a set of packages and their metadata.
1.252 - *
1.253 - * This object represents a set of packages, their dependency
1.254 - * information, the file lists and a number of other details.
1.255 - **/
1.256 -
1.257 -struct razor_set;
1.258 -struct razor_package;
1.259 -struct razor_property;
1.260 -
1.261 -#define RAZOR_HEADER_VERSION 2 /* Current version */
1.262 -#define RAZOR_HEADER_VERSION_MIN 1 /* Minimum version we support */
1.263 -
1.264 -/**
1.265 - * razor_set_create:
1.266 - *
1.267 - * Create a new #razor_set object.
1.268 - *
1.269 - * Returns: the new #razor_set object.
1.270 - **/
1.271 -struct razor_set *razor_set_create_without_root(void);
1.272 -struct razor_set *razor_set_create(void);
1.273 -struct razor_set *
1.274 -razor_set_open(const char *filename, enum razor_set_flags flags,
1.275 - struct razor_error **error);
1.276 -uint32_t razor_set_get_header_version(struct razor_set *set);
1.277 -int razor_set_set_header_version(struct razor_set *set,
1.278 - uint32_t header_version);
1.279 -void razor_set_unref(struct razor_set *set);
1.280 -struct razor_set *razor_set_ref(struct razor_set *set);
1.281 -void razor_set_write_to_handle(struct razor_set *set,
1.282 - struct razor_atomic *atomic, int handle,
1.283 - uint32_t section_mask);
1.284 -int razor_set_write(struct razor_set *set, struct razor_atomic *atomic,
1.285 - const char *filename, uint32_t setions);
1.286 -int
1.287 -razor_set_bind_sections(struct razor_set *set, const char *filename,
1.288 - enum razor_set_flags flags, struct razor_error **error);
1.289 -
1.290 -void
1.291 -razor_package_get_details(struct razor_set *set,
1.292 - struct razor_package *package, ...);
1.293 -int
1.294 -razor_package_remove(struct razor_set *prev, struct razor_set *next,
1.295 - struct razor_atomic *atomic, struct razor_package *package,
1.296 - const char *root, int install_count,
1.297 - enum razor_stage_type stage);
1.298 -
1.299 -/**
1.300 - * SECTION:iterator
1.301 - * @title: Iterators
1.302 - * @short_description: Objects for traversing packages or properties.
1.303 - *
1.304 - * The razor iterator objects provides a way to iterate through a set
1.305 - * of packages or properties.
1.306 - **/
1.307 -
1.308 -struct razor_package_iterator;
1.309 -
1.310 -/**
1.311 - * razor_package_iterator_create:
1.312 - *
1.313 - * Create a new #razor_package_iterator object.
1.314 - *
1.315 - * Returns: the new #razor_package_iterator object.
1.316 - **/
1.317 -
1.318 -struct razor_package_iterator *
1.319 -razor_package_iterator_create(struct razor_set *set);
1.320 -
1.321 -/**
1.322 - * razor_package_iterator_create_for_property:
1.323 - *
1.324 - * Create a new #razor_package_iterator object for the packages that
1.325 - * own the given property.
1.326 - *
1.327 - * Returns: the new #razor_package_iterator object.
1.328 - **/
1.329 -struct razor_package_iterator *
1.330 -razor_package_iterator_create_for_property(struct razor_set *set,
1.331 - struct razor_property *property);
1.332 -
1.333 -/**
1.334 - * razor_package_iterator_create_for_file:
1.335 - *
1.336 - * Create a new #razor_package_iterator object for the packages that
1.337 - * contain the given file name.
1.338 - *
1.339 - * Returns: the new #razor_package_iterator object.
1.340 - **/
1.341 -struct razor_package_iterator *
1.342 -razor_package_iterator_create_for_file(struct razor_set *set,
1.343 - const char *filename);
1.344 -
1.345 -int razor_package_iterator_next(struct razor_package_iterator *pi,
1.346 - struct razor_package **package, ...);
1.347 -void razor_package_iterator_destroy(struct razor_package_iterator *pi);
1.348 -
1.349 -struct razor_package_query *
1.350 -razor_package_query_create(struct razor_set *set);
1.351 -void
1.352 -razor_package_query_add_package(struct razor_package_query *pq,
1.353 - struct razor_package *p);
1.354 -void
1.355 -razor_package_query_add_iterator(struct razor_package_query *pq,
1.356 - struct razor_package_iterator *pi);
1.357 -struct razor_package_iterator *
1.358 -razor_package_query_finish(struct razor_package_query *pq);
1.359 -
1.360 -struct razor_property_iterator;
1.361 -struct razor_property_iterator *
1.362 -razor_property_iterator_create(struct razor_set *set,
1.363 - struct razor_package *package);
1.364 -int razor_property_iterator_next(struct razor_property_iterator *pi,
1.365 - struct razor_property **property,
1.366 - const char **name,
1.367 - uint32_t *flags,
1.368 - const char **version);
1.369 -void
1.370 -razor_property_iterator_destroy(struct razor_property_iterator *pi);
1.371 -
1.372 -struct razor_file_iterator;
1.373 -struct razor_file_iterator *
1.374 -razor_file_iterator_create(struct razor_set *set,
1.375 - struct razor_package *package, int post_order);
1.376 -int razor_file_iterator_next(struct razor_file_iterator *fi,
1.377 - const char **name);
1.378 -void razor_file_iterator_destroy(struct razor_file_iterator *fi);
1.379 -
1.380 -void razor_set_list_files(struct razor_set *set, const char *prefix);
1.381 -void razor_set_list_package_files(struct razor_set *set,
1.382 - struct razor_package *package);
1.383 -
1.384 -enum razor_diff_action {
1.385 - RAZOR_DIFF_ACTION_ADD,
1.386 - RAZOR_DIFF_ACTION_REMOVE,
1.387 -};
1.388 -
1.389 -typedef void (*razor_diff_callback_t)(enum razor_diff_action action,
1.390 - struct razor_package *package,
1.391 - const char *name,
1.392 - const char *version,
1.393 - const char *arch,
1.394 - void *data);
1.395 -
1.396 -void
1.397 -razor_set_diff(struct razor_set *set, struct razor_set *upstream,
1.398 - razor_diff_callback_t callback, void *data);
1.399 -
1.400 -struct razor_install_iterator;
1.401 -
1.402 -enum razor_install_action {
1.403 - RAZOR_INSTALL_ACTION_ADD,
1.404 - RAZOR_INSTALL_ACTION_REMOVE,
1.405 - RAZOR_INSTALL_ACTION_COMMIT
1.406 -};
1.407 -
1.408 -struct razor_install_iterator *
1.409 -razor_set_create_install_iterator(struct razor_set *set,
1.410 - struct razor_set *next);
1.411 -
1.412 -int razor_install_iterator_next(struct razor_install_iterator *ii,
1.413 - struct razor_package **package,
1.414 - enum razor_install_action *action,
1.415 - int *count);
1.416 -
1.417 -/**
1.418 - * razor_install_iterator_commit_set
1.419 - *
1.420 - * Immediately after razor_install_iterator_next() returns
1.421 - * RAZOR_INSTALL_ACTION_COMMIT, this function will return the razor_set
1.422 - * which should be committed.
1.423 - *
1.424 - * Returns: a new #razor_set object.
1.425 - **/
1.426 -struct razor_set *
1.427 -razor_install_iterator_commit_set(struct razor_install_iterator *ii);
1.428 -
1.429 -void razor_install_iterator_rewind(struct razor_install_iterator *ii);
1.430 -size_t razor_install_iterator_tell(struct razor_install_iterator *ii);
1.431 -size_t razor_install_iterator_seek(struct razor_install_iterator *ii,
1.432 - size_t pos);
1.433 -void razor_install_iterator_destroy(struct razor_install_iterator *ii);
1.434 -
1.435 -/**
1.436 - * SECTION:transaction
1.437 - * @title: Transaction
1.438 - * @short_description: Create a new package set by merging two or more sets.
1.439 - *
1.440 - * The razor transaction object provides a way to create a new package set
1.441 - * from packages from one or more other package sets.
1.442 - **/
1.443 -
1.444 -struct razor_rpm;
1.445 -
1.446 -struct razor_transaction *
1.447 -razor_transaction_create(struct razor_set *system, struct razor_set *upstream);
1.448 -void razor_transaction_install_package(struct razor_transaction *transaction,
1.449 - struct razor_package *package);
1.450 -void razor_transaction_remove_package(struct razor_transaction *transaction,
1.451 - struct razor_package *package);
1.452 -void razor_transaction_update_package(struct razor_transaction *trans,
1.453 - struct razor_package *package);
1.454 -void razor_transaction_fixup_package(struct razor_transaction *trans,
1.455 - struct razor_package *package,
1.456 - struct razor_rpm *rpm);
1.457 -void razor_transaction_update_all(struct razor_transaction *transaction);
1.458 -int razor_transaction_resolve(struct razor_transaction *trans);
1.459 -
1.460 -typedef void (*razor_unsatisfied_callback_t)(const char *requirement,
1.461 - struct razor_package *package,
1.462 - const char *name,
1.463 - const char *version,
1.464 - const char *arch,
1.465 - void *data);
1.466 -
1.467 -int razor_transaction_unsatisfied(struct razor_transaction *trans,
1.468 - razor_unsatisfied_callback_t callback,
1.469 - void *data);
1.470 -int razor_transaction_describe(struct razor_transaction *trans);
1.471 -struct razor_set *razor_transaction_commit(struct razor_transaction *trans);
1.472 -void razor_transaction_destroy(struct razor_transaction *trans);
1.473 -
1.474 -/* Temporary helper for test suite. */
1.475 -int razor_transaction_unsatisfied_property(struct razor_transaction *trans,
1.476 - const char *name,
1.477 - uint32_t flags,
1.478 - const char *version);
1.479 -
1.480 -/**
1.481 - * SECTION:rpm
1.482 - * @title: Razor RPM
1.483 - * @short_description: Operating on RPM files.
1.484 - *
1.485 - * Functions for open RPM files and extracting information and
1.486 - * installing or removing RPM files.
1.487 - **/
1.488 -
1.489 -struct razor_relocations;
1.490 -
1.491 -struct razor_relocations *razor_relocations_create(void);
1.492 -void razor_relocations_add(struct razor_relocations *relocations,
1.493 - const char *oldpath, const char *newpath);
1.494 -void razor_relocations_set_rpm(struct razor_relocations *relocations,
1.495 - struct razor_rpm *rpm);
1.496 -const char *razor_relocations_apply(struct razor_relocations *relocations,
1.497 - const char *path);
1.498 -void razor_relocations_destroy(struct razor_relocations *relocations);
1.499 -
1.500 -struct razor_rpm *razor_rpm_open(const char *filename,
1.501 - struct razor_error **error);
1.502 -void razor_rpm_get_details(struct razor_rpm *rpm, ...);
1.503 -void razor_rpm_set_relocations(struct razor_rpm *rpm,
1.504 - struct razor_relocations *relocations);
1.505 -int razor_rpm_install(struct razor_rpm *rpm, struct razor_atomic *atomic,
1.506 - const char *root, int install_count,
1.507 - enum razor_stage_type stage);
1.508 -int razor_rpm_close(struct razor_rpm *rpm);
1.509 -
1.510 -/**
1.511 - * SECTION:importer
1.512 - * @title: Importer
1.513 - * @short_description: A mechanism for building #razor_set objects
1.514 - *
1.515 - * The %razor_importer is a helper object for building a razor set
1.516 - * from external sources, like yum metadata, the RPM database or RPM
1.517 - * files.
1.518 - *
1.519 - * The importer is a stateful object; it has the notion of a current
1.520 - * package, and the caller can provide meta data such as properties,
1.521 - * files and similiar for the package as it becomes available. Once a
1.522 - * package is fully described, the next pacakge can begin. When all
1.523 - * packages have been described to the importer, the importer will
1.524 - * create a new %razor_set with the specified packages.
1.525 - *
1.526 - * A typical use
1.527 - * of the importer will follow this template:
1.528 - * |[
1.529 - * importer = razor_importer_create();
1.530 - *
1.531 - * while ( /<!-- -->* more packages to import *<!-- -->/; ) {
1.532 - * /<!-- -->* get name, version and arch of next package *<!-- -->/
1.533 - * razor_importer_begin_package(importer, name, version, arch);
1.534 - * razor_importer_add_details(importer, summary, description, url, license);
1.535 - *
1.536 - * while ( /<!-- -->* more properties to add *<!-- -->/ )
1.537 - * razor_importer_add_property(importer, name, flags, version);
1.538 - *
1.539 - * while ( /<!-- -->* [more files to add *<!-- -->/ )
1.540 - * razor_importer_add_file(importer, name);
1.541 - *
1.542 - * razor_importer_finish_package(importer);
1.543 - * }
1.544 - *
1.545 - * return razor_importer_finish(importer);
1.546 - * ]|
1.547 - **/
1.548 -struct razor_importer;
1.549 -
1.550 -struct razor_importer *razor_importer_create(void);
1.551 -void razor_importer_destroy(struct razor_importer *importer);
1.552 -void razor_importer_begin_package(struct razor_importer *importer,
1.553 - const char *name,
1.554 - const char *version,
1.555 - const char *arch);
1.556 -void razor_importer_add_details(struct razor_importer *importer,
1.557 - const char *summary,
1.558 - const char *description,
1.559 - const char *url,
1.560 - const char *license);
1.561 -void razor_importer_add_script(struct razor_importer *importer,
1.562 - enum razor_property_flags script,
1.563 - const char *program,
1.564 - const char *body);
1.565 -void razor_importer_add_install_prefix(struct razor_importer *importer,
1.566 - const char *install_prefix);
1.567 -void razor_importer_add_property(struct razor_importer *importer,
1.568 - const char *name,
1.569 - uint32_t flags,
1.570 - const char *version);
1.571 -void razor_importer_add_file(struct razor_importer *importer,
1.572 - const char *name);
1.573 -void razor_importer_finish_package(struct razor_importer *importer);
1.574 -
1.575 -int razor_importer_add_rpm(struct razor_importer *importer,
1.576 - struct razor_rpm *rpm);
1.577 -
1.578 -struct razor_set *razor_importer_finish(struct razor_importer *importer);
1.579 -
1.580 -struct razor_set *razor_set_create_from_yum(void);
1.581 -struct razor_set *razor_set_create_from_rpmdb(void);
1.582 -
1.583 -/**
1.584 - * SECTION:root
1.585 - * @title: Root
1.586 - * @short_description: Functions for accessing an install root.
1.587 - *
1.588 - * The #razor_root object encapsulate access to and locking of a razor
1.589 - * install root.
1.590 - **/
1.591 -struct razor_root;
1.592 -
1.593 -const char *razor_get_database_path();
1.594 -void razor_set_database_path(const char *database_path);
1.595 -int razor_root_create(const char *root, struct razor_error **error);
1.596 -struct razor_root *
1.597 -razor_root_open(const char *root, struct razor_error **error);
1.598 -struct razor_set *
1.599 -razor_root_open_read_only(const char *root, struct razor_error **error);
1.600 -struct razor_set *razor_root_get_system_set(struct razor_root *root);
1.601 -int razor_root_close(struct razor_root *root);
1.602 -int
1.603 -razor_root_update(struct razor_root *root, struct razor_set *next,
1.604 - struct razor_atomic *atomic);
1.605 -
1.606 -/**
1.607 - * SECTION:misc
1.608 - * @title: Miscellaneous Functions
1.609 - * @short_description: Various helper functions
1.610 - *
1.611 - * Functions that doesn't fit anywhere else.
1.612 - **/
1.613 -
1.614 -const char *
1.615 -razor_property_relation_to_string(struct razor_property *p);
1.616 -const char *
1.617 -razor_property_type_to_string(struct razor_property *p);
1.618 -
1.619 -void razor_build_evr(char *evr_buf, int size, const char *epoch,
1.620 - const char *version, const char *release);
1.621 -int razor_versioncmp(const char *s1, const char *s2);
1.622 -
1.623 -void razor_disable_root_name_checks(int disable);
1.624 -
1.625 -void razor_set_lua_loader(const char *modname, void (*loader)());
1.626 -void (*razor_get_lua_loader(const char *modname))();
1.627 -
1.628 -char *razor_concat(const char *s, ...) RAZOR_MALLOC RAZOR_NULL_TERMINATED;
1.629 -
1.630 -char *razor_path_add_root(const char *path, const char *root) RAZOR_MALLOC;
1.631 -
1.632 -const char *razor_system_arch(void);
1.633 -
1.634 -#endif /* _RAZOR_H_ */