1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
|
/*
* This file is part of libmodulemd
* Copyright (C) 2018 Red Hat, Inc.
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free software, see <https://www.gnu.org/philosophy/free-sw.en.html>.
*/
#pragma once
#include "modulemd-defaults.h"
#include "modulemd-deprecated.h"
#include "modulemd-module-stream.h"
#include "modulemd-translation.h"
#include "modulemd-obsoletes.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-module
* @title: Modulemd.Module
* @stability: stable
* @short_description: Collects all information about a module: all of its streams, defaults, etc.
*/
#define MODULEMD_TYPE_MODULE (modulemd_module_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdModule, modulemd_module, MODULEMD, MODULE, GObject)
/**
* modulemd_module_get_stream_names_as_strv: (rename-to modulemd_module_get_stream_names)
* @self: This #ModulemdModule object.
*
* Returns: (transfer full): An ordered #GStrv list of stream names in this
* module.
*
* Since: 2.6
*/
GStrv
modulemd_module_get_stream_names_as_strv (ModulemdModule *self);
/**
* modulemd_module_copy:
* @self: (in): This #ModulemdModule object.
*
* Returns: (transfer full): A deep copy of this #ModulemdModule object.
*
* Since: 2.0
*/
ModulemdModule *
modulemd_module_copy (ModulemdModule *self);
/**
* modulemd_module_validate:
* @self: (in): This #ModulemdModule object.
* @error: (out): A #GError containing the reason the object failed validation.
* NULL if the validation passed.
*
* Returns: TRUE if validation passed, FALSE and sets @error if failed.
*
* Since: 2.0
*/
gboolean
modulemd_module_validate (ModulemdModule *self, GError **error);
/**
* modulemd_module_get_module_name:
* @self: This #ModulemdModule object.
*
* Returns: (transfer none): The module name.
*
* Since: 2.0
*/
const gchar *
modulemd_module_get_module_name (ModulemdModule *self);
/**
* modulemd_module_get_all_streams:
* @self: This #ModulemdModule object.
*
* Returns: (transfer none) (element-type ModulemdModuleStream): A list of all available stream objects associated with
* this module. There may be multiple streams with the same name and different version and
* context. The order of items in this list is not guaranteed.
*
* Since: 2.0
*/
GPtrArray *
modulemd_module_get_all_streams (ModulemdModule *self);
/**
* modulemd_module_get_streams_by_stream_name_as_list: (rename-to modulemd_module_get_streams_by_stream_name)
* @self: This #ModulemdModule object.
* @stream_name: The name of the stream to retrieve.
*
* Returns: (transfer container) (element-type ModulemdModuleStream): A list of all available stream objects associated with a
* particular stream name, sorted highest to lowest by the version. The same version may have
* more than one associated context.
*
* Since: 2.0
*/
GPtrArray *
modulemd_module_get_streams_by_stream_name_as_list (ModulemdModule *self,
const gchar *stream_name);
/**
* modulemd_module_get_stream_by_NSVC:
* @self: This #ModulemdModule object.
* @stream_name: The name of the stream to retrieve.
* @version: The version of the stream to retrieve.
* @context: The context of the stream to retrieve.
*
* Returns: (transfer none): The requested stream object or NULL if no match was found.
*
* Since: 2.0
* Deprecated: 2.2: Use modulemd_module_get_stream_by_NSVCA() instead.
*/
MMD_DEPRECATED_FOR (modulemd_module_get_stream_by_NSVCA)
ModulemdModuleStream *
modulemd_module_get_stream_by_NSVC (ModulemdModule *self,
const gchar *stream_name,
guint64 version,
const gchar *context);
/**
* modulemd_module_search_streams:
* @self: This #ModulemdModule object.
* @stream_name: The name of the stream to retrieve.
* @version: The version of the stream to retrieve. If set to zero,
* the version is not included in the search.
* @context: (nullable): The context of the stream to retrieve. If NULL, the
* context is not included in the search.
* @arch: (nullable): The processor architecture of the stream to retrieve. If
* NULL, the architecture is not included in the search.
*
* Returns: (transfer container) (element-type ModulemdModuleStream): The list
* of stream objects matching the requested parameters. This function cannot
* fail, but it may return a zero-length list if no matches were found. The
* returned streams will be in a predictable order, sorted first by stream
* name, then by version (highest to lowest), then by context and finally by
* architecture.
*
* Since: 2.5
*/
GPtrArray *
modulemd_module_search_streams (ModulemdModule *self,
const gchar *stream_name,
guint64 version,
const gchar *context,
const gchar *arch);
/**
* modulemd_module_search_streams_by_glob:
* @self: This #ModulemdModule object.
* @stream_name: (nullable): The name of the stream to retrieve. If NULL, will
* search all streams.
* @version: (nullable): The version of the stream to retrieve. If NULL, will
* search all versions.
* @context: (nullable): The context of the stream to retrieve. If NULL, will
* search all contexts.
* @arch: (nullable): The processor architecture of the stream to retrieve. If
* NULL, the architecture is not included in the search.
*
* All arguments to this method will be compared using
* [fnmatch(3)](https://www.mankier.com/3/fnmatch).
*
* Returns: (transfer container) (element-type ModulemdModuleStream): The list
* of stream objects matching all of the requested parameters. This function
* cannot fail, but it may return a zero-length list if no matches were found.
* The returned streams will be in a predictable order, sorted first by module
* name, then stream name, then by version (highest first), then by context
* and finally by architecture.
*
* Since: 2.9
*/
GPtrArray *
modulemd_module_search_streams_by_glob (ModulemdModule *self,
const gchar *stream_name,
const gchar *version,
const gchar *context,
const gchar *arch);
/**
* modulemd_module_search_streams_by_nsvca_glob:
* @self: This #ModulemdModule object.
* @nsvca_pattern: (nullable): A [glob](https://www.mankier.com/3/glob)
* pattern to match against the NSVCA strings of the #ModulemdModuleStream
* objects in this module. If NULL, this will match all NSVCAs.
*
* Returns: (transfer container) (element-type ModulemdModuleStream): An array
* of #ModulemdModuleStream objects whose NSVCA string matches the provided
* pattern. This function cannot fail, but may return an array of zero entries
* if the pattern did not match any streams. The returned streams will be in a
* predictable order, sorted first by module name, then stream name, then by
* version (highest first), then by context and finally by architecture.
*
* Since: 2.9
*/
GPtrArray *
modulemd_module_search_streams_by_nsvca_glob (ModulemdModule *self,
const gchar *nsvca_pattern);
/**
* modulemd_module_get_stream_by_NSVCA:
* @self: This #ModulemdModule object.
* @stream_name: The name of the stream to retrieve.
* @version: The version of the stream to retrieve. If set to zero, the version
* is not included in the search.
* @context: (nullable): The context of the stream to retrieve. If NULL, the
* context is not included in the search.
* @arch: (nullable): The processor architecture of the stream to retrieve. If
* NULL, the architecture is not included in the search.
* @error: (out): A #GError indicating the reason this function failed to
* retrieve exactly one #ModulemdModuleStream.
*
* Returns: (transfer none): The requested stream object. NULL and sets @error
* appropriately if the provided information is not sufficient to return
* exactly one #ModulemdModuleStream result.
*
* Since: 2.2
*/
ModulemdModuleStream *
modulemd_module_get_stream_by_NSVCA (ModulemdModule *self,
const gchar *stream_name,
guint64 version,
const gchar *context,
const gchar *arch,
GError **error);
/**
* modulemd_module_remove_streams_by_NSVCA:
* @self: This #ModulemdModule object.
* @stream_name: (not nullable): The name of the stream to remove.
* @version: The version of the stream to remove. If set to zero, matches all
* versions.
* @context: (nullable): The context of the stream to remove. If NULL, matches
* all stream contexts.
* @arch: (nullable): The processor architecture of the stream to remove. If
* NULL, matches all architectures.
*
* Remove one or more #ModulemdModuleStream objects from this #ModulemdModule
* that match the provided parameters.
*
* Since: 2.3
*/
void
modulemd_module_remove_streams_by_NSVCA (ModulemdModule *self,
const gchar *stream_name,
guint64 version,
const gchar *context,
const gchar *arch);
/**
* modulemd_module_remove_streams_by_name:
* @self: This #ModulemdModule object.
* @stream_name: (not nullable): The name of the stream to remove.
*
* Remove one or more #ModulemdModuleStream objects from this #ModulemdModule
* that match the provided stream name.
*
* Since: 2.3
*/
#define modulemd_module_remove_streams_by_name(self, stream_name) \
modulemd_module_remove_streams_by_NSVCA (self, stream_name, 0, NULL, NULL)
/**
* modulemd_module_get_defaults:
* @self: This #ModulemdModule object.
*
* Returns: (transfer none): The defaults of this module or NULL if none.
*
* Since: 2.0
*/
ModulemdDefaults *
modulemd_module_get_defaults (ModulemdModule *self);
/**
* modulemd_module_get_translation:
* @self: This #ModulemdModule object.
* @stream: The stream to look up translations for.
*
* Returns: (transfer none): The set of translations attached to streams.
*
* Since: 2.8
*/
ModulemdTranslation *
modulemd_module_get_translation (ModulemdModule *self, const gchar *stream);
/**
* modulemd_module_get_obsoletes:
* @self: (in): This #ModulemdModule object.
*
* Returns: (transfer none) (element-type ModulemdObsoletes): A list of all obsoletes attached
* to this module. These are pointers to the internal memory objects and must not be modified or freed.
*
* Since: 2.10
*/
GPtrArray *
modulemd_module_get_obsoletes (ModulemdModule *self);
/**
* modulemd_module_get_newest_active_obsoletes:
* @self: (in): This #ModulemdModule object.
* @stream: (in): The stream to look up obsoletes for.
* @context: (in) (nullable): The stream context to look up obsoletes for.
*
* Returns: (transfer none): The newest active obsoletes attached to this module with
* specified stream and context (when eol_date is not set or it already occurred
* the obsoletes is active). If no context is passed it matches obsoletes without context.
*
* Since: 2.10
*/
ModulemdObsoletes *
modulemd_module_get_newest_active_obsoletes (ModulemdModule *self,
const gchar *stream,
const gchar *context);
/**
* modulemd_module_clear_xmds:
* @self: (in): This #ModulemdModule object.
*
* Iterates through all #ModulemdModuleStream entries in this
* #ModulemdModule and removes any XMD sections that are present. This is
* generally done to trim down the metadata to only the portions that are
* useful to the package manager.
*
* Since: 2.14
*/
void
modulemd_module_clear_xmds (ModulemdModule *self);
G_END_DECLS
|