libpkgmanifest::manifest

enum class libpkgmanifest::manifest::ChecksumMethod

Values:

enumerator SHA1
enumerator SHA224
enumerator SHA256
enumerator SHA384
enumerator SHA512
enumerator MD5
enumerator CRC32
enumerator CRC64
class Checksum
#include <checksum.hpp>

Stores information about the package checksum.

Public Functions

ChecksumMethod get_method() const

Retrieves the method used for calculating the checksum.

Returns:

The checksum calculation method.

std::string get_digest() const

Retrieves the output of the checksum hash function.

Returns:

The checksum digest.

void set_method(ChecksumMethod method)

Sets the method used for calculating the checksum.

Parameters:

method – The checksum calculation method to be used.

void set_digest(const std::string &digest)

Sets the output of the checksum hash function.

Parameters:

digest – The checksum digest to be set.

class Manifest
#include <manifest.hpp>

The primary data class that stores all information related to the items in the manifest file.

Public Functions

std::string get_document() const

Retrieves the YAML document identifier.

Note

This is expected to be the value “rpm-package-manifest”.

Returns:

The document identifier.

Version &get_version()

Retrieves the version of the YAML document.

Note

This version changes if the structure or format of the document’s properties has been updated.

Returns:

The document version.

Packages &get_packages()

Retrieves a structure containing all the packages defined in the manifest file.

Returns:

A structure with the packages listed in the manifest.

Repositories &get_repositories()

Retrieves a structure containing all the repositories defined in the manifest file.

Returns:

A structure with the repositories listed in the manifest.

void set_document(const std::string &document)

Sets the YAML document identifier.

Parameters:

document – The YAML identifier to set.

void set_version(Version &version)

Sets the version of the YAML document.

Parameters:

version – The version to set for the document.

void set_packages(Packages &packages)

Assigns a structure with all the packages to be included in the manifest file.

Parameters:

packages – A structure containing the packages to be set.

void set_repositories(Repositories &repositories)

Assigns a structure with all the repositories to be included in the manifest file.

Parameters:

repositories – A structure containing the repositories to be set.

class Module
#include <module.hpp>

A structure that holds modularity-related information about the package.

Note

For more details, refer to the official Modularity project documentation: https://docs.fedoraproject.org/en-US/modularity/.

Public Functions

std::string get_name() const

Retrieves the Name of the module to which the package belongs.

Returns:

A string representing the module name.

std::string get_stream() const

Retrieves the stream identifier, which indicates the specific version or variant of the module.

Returns:

A string representing the stream identifier.

void set_name(const std::string &name)

Sets the name of the module to which the package belongs.

Parameters:

name – A string containing the module name.

void set_stream(const std::string &stream)

Sets the stream identifier, which typically represents the version or variant of the module.

Parameters:

stream – A string containing the stream identifier.

class Nevra
#include <nevra.hpp>

Format for the package identifier, including Name, (optional) Epoch, Version, Release, and Architecture fields.

Note

For more details, refer to the official RPM documentation: https://rpm-software-management.github.io/rpm/manual/tags.html.

Public Functions

std::string get_name() const

Retrieves the package name.

Returns:

The package name.

std::string get_epoch() const

Retrieves the package epoch.

Note

Can be empty if the epoch is not defined.

Returns:

The package epoch.

std::string get_version() const

Retrieves the package version.

Returns:

The package version.

std::string get_release() const

Retrieves the package release.

Returns:

The package release.

std::string get_arch() const

Retrieves the package architecture.

Returns:

The package architecture.

void set_name(const std::string &name)

Sets the package name.

Parameters:

name – The package name.

void set_epoch(const std::string &epoch)

Sets the package epoch.

Parameters:

epoch – The package epoch.

void set_version(const std::string &version)

Sets package version.

Parameters:

version – The package version.

void set_release(const std::string &release)

Sets the package release.

Parameters:

release – The package release.

void set_arch(const std::string &arch)

Sets the package architecture.

Parameters:

arch – The package architecture.

std::string to_string() const

Converts the NEVRA object to its full string representation.

Returns:

The NEVRA string.

class Package
#include <package.hpp>

Represents a single package within the manifest.

Public Functions

std::string get_repo_id() const

Retrieves the repository identifier the packages is from.

Returns:

The repository ID.

std::string get_location() const

Retrieves the package’s relative path within the repository.

Returns:

The package’s relative path.

std::string get_url() const

Retrieves the complete URL for downloading the package.

Note

Constructed by combining the repository URL and the package’s relative location path.

Returns:

The full URL of the package.

uint64_t get_size() const

Retrieves the download size of the package in bytes.

Returns:

The size of the package in bytes.

Repository &get_repository() const

Retrieves the repository where the package originates.

Returns:

The repository object.

Checksum &get_checksum()

Retrieves the checksum associated with this package.

Returns:

The package checksum.

Nevra &get_nevra()

Retrieves the NEVRA package identifier.

Returns:

The NEVRA identifier of the package.

Nevra &get_srpm()

Retrieves the NEVRA identifier of the source package.

Note

This identifies the source package used to build this binary package.

Returns:

The NEVRA identifier of the source package.

Module &get_module()

Retrieves the module information associated with this package.

Returns:

The package module.

void set_repo_id(const std::string &repo_id)

Sets the repository identifier the package is from.

Parameters:

repo_id – The repository ID to be set.

void set_location(const std::string &location)

Sets the package’s relative path within the repository.

Parameters:

location – The path to be set for the package.

void set_size(uint64_t size)

Sets the download size of the package in bytes.

Parameters:

size – The size of the package in bytes to be set.

void set_checksum(Checksum &checksum)

Sets the checksum associated with this package.

Parameters:

checksum – The checksum to be set for the package.

void set_nevra(Nevra &nevra)

Sets the package NEVRA identifier.

Parameters:

nevra – The NEVRA identifier to be set for the package.

void set_srpm(Nevra &srpm)

Sets the source package NEVRA identifier.

Note

This identifies the source package used to build this binary package.

Parameters:

srpm – The source RPM NEVRA to be set for the package.

void set_module(Module &module)

Sets the module information associated with this package.

Parameters:

module – The module to be set for the package.

void attach(Repositories &repositories)

Binds the repositories to the package object.

Note

Used to reference and validate repository-related information within the package.

Parameters:

repositories – The repositories object to bind.

class Packages
#include <packages.hpp>

A container for all packages listed in the manifest.

Public Functions

std::vector<Package> get() const

Retrieves a list of all packages in the container.

Returns:

A vector containing all packages.

std::vector<Package> get(const std::string &basearch, bool with_source = false) const

Retrieves a list of packages filtered by the specified base architecture.

Parameters:
  • basearch – The base architecture used to filter the packages.

  • with_source – True if source packages should be included in the result.

Returns:

A vector containing the packages for the specified base architecture.

void add(Package &package)

Adds a given package to the container.

Note

The package is categorized within the container based on its architecture.

Parameters:

package – The package to be added.

void add(Package &package, const std::string &basearch)

Adds a given package to the container and link it to the given base architecture.

Note

Used when storing multiple base architectures in a manifest file.

Parameters:
  • package – The package to be added.

  • basearch – The base architecture to link the package to.

bool contains(const Package &package)

Verifies if the given package exists in the container.

Note

Packages are considered identical if they share the same NEVRA and repository ID.

Returns:

True if the package is present in the container.

void attach(Repositories &repositories)

Binds the repositories to the packages object.

Note

Used to reference and validate repository-related information within the packages.

Parameters:

repositories – The repositories object to bind.

class Parser
#include <parser.hpp>

A class responsible for parsing the YAML files into objects.

Public Functions

Manifest parse(const std::string &path) const

Parses the manifest file from a specified file path.

Parameters:

path – The location of the manifest file.

Throws:

ParserError – if an error occurs during file parsing.

Returns:

A manifest object containing data parsed from the file.

class Serializer
#include <serializer.hpp>

A class responsible for serializing the manifest object into a YAML file.

Public Functions

void serialize(const Manifest &manifest, const std::string &path) const

Serializes a manifest object to a specified file path.

Parameters:
  • manifest – The manifest object containing package data.

  • path – The file path where the manifest should be saved.

Throws:

SerializerError – if an error occurs during serialization.