[packit] 2.10.0 upstream release

Upstream tag: 2.10.0
Upstream commit: 30e25418

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
Stephen Gallagher 2020-11-20 15:17:11 -05:00
commit b160fb6d7f
No known key found for this signature in database
GPG key ID: 45DB85A568286D11
499 changed files with 5420415 additions and 19 deletions

1
.gitignore vendored
View file

@ -46,3 +46,4 @@
/modulemd-2.9.2.tar.xz
/modulemd-2.9.3.tar.xz
/modulemd-2.9.4.tar.xz
/modulemd-2.10.0.tar.xz

View file

@ -1,27 +1,23 @@
specfile_path: libmodulemd.spec
specfile_path: fedora/libmodulemd.spec
upstream_package_name: libmodulemd
upstream_project_url: https://github.com/fedora-modularity/libmodulemd
downstream_package_name: libmodulemd
upstream_tag_template: libmodulemd-{version}
current_version_command:
- ./.packit_version.sh
current_version_command: [
git, describe, --tags, --match, "*.*", --exclude, "libmodulemd-*", --abbrev=0
]
synced_files:
- .packit.yml
- .make_packit_specfile.sh
- libmodulemd.spec
actions:
post-upstream-clone: ./.make_packit_specfile.sh
- fedora/
- .packit.yaml
jobs:
- job: sync_from_downstream
trigger: commit
- job: copr_build
trigger: pull_request
metadata:
targets:
- fedora-all
- epel-7
- job: propose_downstream
trigger: release
metadata:
dist-git-branch: fedora-all

View file

@ -1,3 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.10.1.
The file was generated using packit 0.19.0.

48
fedora/.gitignore vendored Normal file
View file

@ -0,0 +1,48 @@
/modulemd-0.1.0.tar.xz
/modulemd-0.2.0.tar.xz
/modulemd-0.2.1.tar.xz
/modulemd-0.2.2.tar.xz
/modulemd-1.0.0.tar.xz
/modulemd-1.0.1.tar.xz
/modulemd-1.0.2.tar.xz
/modulemd-1.0.3.tar.xz
/modulemd-1.0.4.tar.xz
/modulemd-1.1.0.tar.xz
/modulemd-1.1.1.tar.xz
/modulemd-1.1.2.tar.xz
/modulemd-1.1.3.tar.xz
/modulemd-1.2.0.tar.xz
/modulemd-1.3.0.tar.xz
/modulemd-1.4.0.tar.xz
/modulemd-1.4.1.tar.xz
/modulemd-1.5.0.tar.xz
/modulemd-1.5.1.tar.xz
/modulemd-1.5.2.tar.xz
/modulemd-1.6.0.tar.xz
/modulemd-1.6.1.tar.xz
/modulemd-1.6.2.tar.xz
/modulemd-1.6.3.tar.xz
/modulemd-1.6.4.tar.xz
/modulemd-1.7.0.tar.xz
/modulemd-2.0.0beta2.tar.xz
/modulemd-2.0.0.tar.xz
/modulemd-2.1.0.tar.xz
/modulemd-2.2.0.tar.xz
/modulemd-2.2.1.tar.xz
/modulemd-2.2.2.tar.xz
/modulemd-2.2.3.tar.xz
/modulemd-2.3.0.tar.xz
/modulemd-2.3.1.tar.xz
/modulemd-2.4.0.tar.xz
/modulemd-2.5.0.tar.xz
/modulemd-2.6.0.tar.xz
/modulemd-2.7.0.tar.xz
/modulemd-2.8.0.tar.xz
/modulemd-2.8.1.tar.xz
/modulemd-2.8.2.tar.xz
/modulemd-2.8.3.tar.xz
/modulemd-2.9.0.tar.xz
/modulemd-2.9.1.tar.xz
/modulemd-2.9.2.tar.xz
/modulemd-2.9.3.tar.xz
/modulemd-2.9.4.tar.xz

5
fedora/README.md Normal file
View file

@ -0,0 +1,5 @@
# libmodulemd
C Library for manipulating module metadata files
See https://github.com/fedora-modularity/libmodulemd for more details.

3
fedora/README.packit Normal file
View file

@ -0,0 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.10.1.

17
fedora/gating.yaml Normal file
View file

@ -0,0 +1,17 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: dist.abicheck}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: dist.abicheck}

Binary file not shown.

View file

@ -0,0 +1,7 @@
[global]
default = libmodulemd
[libmodulemd]
command = clang-format
config = libmodulemd-clang.cfg
name = libmodulemd

View file

@ -0,0 +1,60 @@
---
# C format
Language: Cpp
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: GNU
BreakBeforeTernaryOperators: false
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
ContinuationIndentWidth: 2
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Always
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

View file

@ -0,0 +1,4 @@
[chdr]
map = c
default = libmodulemd

View file

@ -0,0 +1,60 @@
---
# C format
Language: Cpp
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: GNU
BreakBeforeTernaryOperators: false
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
ContinuationIndentWidth: 2
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Always
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

View file

@ -0,0 +1,23 @@
specfile_path: fedora/libmodulemd.spec
upstream_package_name: libmodulemd
upstream_project_url: https://github.com/fedora-modularity/libmodulemd
downstream_package_name: libmodulemd
current_version_command: [
git, describe, --tags, --match, "*.*", --exclude, "libmodulemd-*", --abbrev=0
]
synced_files:
- fedora/
- .packit.yaml
jobs:
- job: sync_from_downstream
trigger: commit
- job: copr_build
trigger: pull_request
metadata:
targets:
- fedora-all
- epel-7

View file

@ -0,0 +1,112 @@
language: c
compiler: gcc
sudo: required
dist: bionic
# Don't run Travis against tags, just new builds.
# Tagged builds will always fail the test for whether we remembered to bump
# the version number after a release.
if: tag IS blank
services:
- docker
addons:
apt:
packages:
- bash
- tar
- bzip2
- m4
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "mMcLLwYU0rAQkJDQEw3NlX5l1e1DCuUfCHDhhvku4YMgLbMV3ADvrTvwfnZoimgRhVw5hWXLDGSdJ2jkwAraeNHLjyfDXn/NrPNvo8xAgbtlsWaCO76p3yecfdIzawbW2iKpkyIjw8fCgi2xRccvp2ZTinDspiN96aqqZuhwy/5WzavQG+ECTxkFW6tDcly/NUyy/CH6FH6fqp6tswd+VsqKgZLqybhrwW1/OPBr5e+QvVyfn3KAlWWiyUCj33WU1mxL+LhsS2cNXK5S5V1NOO624oXPCy6oJImONWh0feXuPu20LqoWE/uOVXOcNpSB+3EUA5mfj22ST0FPMrvwS9k2oZGLiIVfDyGmI+Hl/kI4tlh/7zolpaeQB/c8GCGRBuEr+k0J0pqVp7ptOSIw3n6l4R113Sp+EBqSOcNxNVgOoW6pMZSKM73Z9tlr1yHVKw0cfge8YUgplGf0cENgExyjW97W535h2VEMKlgdH9PCQgfTXYANBVp2My+u6CytUetjdJXLwjmjuXBiAtIsrSTUtZ3hx/D1RXygAq0l7YI4iHQOmumSy81rgO2xDs484z/Efs6EXg/zdxluPSND6o/A0OXx80FUa6dwDmP6AmBZsHggVUYK7Gduu0Dry/1lcc2avZqdyOSrLs02vnQaRxb84CKFbhUd93gnVlPki3M="
# This is the DOC_TOKEN
- secure: gOGYwbzAQ4fVZ53AdppercJ0w4rA2XzuZK964c7v46qxD64VFqMSra4O/Bk+0A7hHw5jw1aSvKU/eqoJpOOXPfgT/yth8hJ7XmC7powQiw/Atj2/dcWsmCMxX03uefur8LHGQgNWN4W6lbWMdTyLKzmN0snx5A3zbwbfKYpF+d1gYaKrHO1ykeJHuOoIHDGop5Ur9Inl4S3o2U063Wg/YroTuIWvbEjL0Laz7knWuNpSN0g5G2cnF4y0DTDYxZWxFtnfB0npTDggUQqUTHNYrL+a9CPQc+/47FpmXXx0VxwqZ2l3BVO+a+ef5Q6g2VNxU/WJWdnFyRHAjWRKsyKua8zlOsmj+IVmM4nZDtyD0qlS8/nfdI+ZJS16IvKqyA2n9ScHe5YRsNPItd8c6y22nSKnRKlF2h+gWvD56pHUUHFMPlba0dJ7KMiIQZxmY6dKgzerkOylQziBgBMVulvxGz8KILj9+DxTANDlI+8LHt01bIXa4RbsNvOAcjFhNdNgemGv2uXcFyaVsg5w08PVSKb2pQimmB/EOBRSMMhavxOSaAgu/Jjs8xLPj+hMD/yZlav2dlx4Oix3x1humSUsegoa/Az6qulxK+rQdJJA3BuHk389s7e/i+z30KJsbpuIWxH1c/5ETtUFeIflQBYywr++5GqLG7T8WfVxH3ie3aw=
notifications:
irc: "chat.freenode.net#fedora-modularity"
jobs:
fast_finish: true
include:
- stage: Documentation
name: "Documentation Update"
script: 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./.travis/travis-docs.sh; fi'
arch: amd64
- stage: CentOS x86_64
name: "CentOS 7 x86_64"
script: ./.travis/travis-centos.sh
arch: amd64
- name: "CentOS 8 x86_64"
script: ./.travis/travis-centos.sh
arch: amd64
- stage: Fedora x86_64
name: "Fedora 31 x86_64"
script: ./.travis/travis-fedora.sh
arch: amd64
- name: "Fedora 32 x86_64"
script: ./.travis/travis-fedora.sh
arch: amd64
- name: "Fedora 33 x86_64"
script: ./.travis/travis-fedora.sh
arch: amd64
- name: "Fedora rawhide x86_64"
script: ./.travis/travis-fedora.sh
arch: amd64
- stage: Other Distributions
name: "openSUSE tumbleweed"
script: ./.travis/travis-opensuse.sh
arch: amd64
- name: "Arch Linux"
script: ./.travis/travis-archlinux.sh
arch: amd64
- name: "Mageia 7"
script: ./.travis/travis-mageia.sh
arch: amd64
- name: "OpenMandriva cooker"
script: ./.travis/travis-openmandriva.sh
arch: amd64
- stage: Fedora aarch64
name: "Fedora 31 aarch64"
script: ./.travis/travis-fedora.sh
arch: arm64
- name: "Fedora 32 aarch64"
script: ./.travis/travis-fedora.sh
arch: arm64
- name: "Fedora 33 aarch64"
script: ./.travis/travis-fedora.sh
arch: arm64
- name: "Fedora rawhide aarch64"
script: ./.travis/travis-fedora.sh
arch: arm64
- stage: Static Analysis
name: "Coverity Scan"
script: 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./.travis/travis-coverity.sh; fi'
arch: amd64
allow_failures:
- name: "OpenMandriva cooker"
- name: "Fedora rawhide x86_64"
- name: "Fedora rawhide aarch64"

View file

@ -0,0 +1,18 @@
FROM __IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN pacman -Syu --needed --noconfirm \
base-devel \
file \
glib2 \
glib2-docs \
gobject-introspection \
gtk-doc \
help2man \
jq \
libyaml \
meson \
python-gobject \
python2-six \
&& pacman -Scc --noconfirm

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/archlinux/travis-tasks.sh

View file

@ -0,0 +1,20 @@
#!/bin/bash
#Exit on failures
set -e
set -x
pushd /builddir/
# Build the code under GCC and run standard tests
meson --buildtype=debug \
-Dtest_dirty_git=false \
-Ddeveloper_build=false \
-Dpython_name=python3 \
-Drpmio=disabled \
travis
ninja -C travis test
popd #builddir

View file

@ -0,0 +1,43 @@
FROM __IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN yum -y install epel-release \
ifelse(eval(__RELEASE__ >= 8), 1, `dnl
&& yum -y install dnf-plugins-core \
&& yum config-manager --enable PowerTools \
')dnl
&& yum -y --setopt=tsflags='' install \
clang \
createrepo_c \
elinks \
file-devel \
gcc \
gcc-c++ \
git-core \
glib2-devel \
glib2-doc \
gobject-introspection-devel \
gtk-doc \
help2man \
jq \
libyaml-devel \
meson \
ninja-build \
pkgconfig \
python2-devel \
python2-six \
ifelse(eval(__RELEASE__ < 8), 1, `dnl
python-gobject-base \
python36-gobject-base \
',`dnl
python3-gobject-base \
')dnl
python36-devel \
python3-rpm-macros \
redhat-rpm-config \
rpm-build \
rpm-devel \
rpmdevtools \
sudo \
&& yum -y clean all

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/centos/travis-tasks.sh

View file

@ -0,0 +1,22 @@
#!/bin/bash
#Exit on failures
set -e
set -x
# CentOS 7 doesn't have autopep8, so we'll drop the requirement for it
# This implementation will still allow it to occur if autopep8 still shows
# up later.
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3.6"
pushd /builddir/
# Build the code under GCC and run standard tests
meson --buildtype=debug \
$COMMON_MESON_ARGS \
travis
ninja-build -C travis test
popd #builddir

View file

@ -0,0 +1,20 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN yum -y --setopt=install_weak_deps=False --setopt=tsflags='' \
--nogpgcheck install \
rsync \
ruby \
rubygems \
"rubygem(json)" \
wget \
&& yum -y clean all
ARG TARBALL
ADD $TARBALL /builddir/
RUN /builddir/.travis/coverity_prep.sh
ENTRYPOINT /builddir/.travis/coverity/travis-tasks.sh

View file

@ -0,0 +1,37 @@
#!/bin/bash
#Exit on failures
set -e
set -x
if [ -e /usr/lib/os-release ]; then
source /usr/lib/os-release
case "${ID-unknown} ${VERSION_ID-unknown}" in
"centos 7")
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3.6"
;;
"centos "*)
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false"
;;
esac
fi
pushd /builddir/
meson --buildtype=debug \
$COMMON_MESON_ARGS \
coverity
pushd coverity
# The coverity scan script returns an error despite succeeding...
TRAVIS_BRANCH="${TRAVIS_BRANCH:-main}" \
COVERITY_SCAN_PROJECT_NAME="${COVERITY_SCAN_PROJECT_NAME:-sgallagher/libmodulemd}" \
COVERITY_SCAN_NOTIFICATION_EMAIL="${COVERITY_SCAN_NOTIFICATION_EMAIL:-sgallagh@redhat.com}" \
COVERITY_SCAN_BUILD_COMMAND="${COVERITY_SCAN_BUILD_COMMAND:-ninja}" \
COVERITY_SCAN_BRANCH_PATTERN=${COVERITY_SCAN_BRANCH_PATTERN:-main} \
/usr/bin/travisci_build_coverity_scan.sh ||:
popd #coverity
popd #builddir

View file

@ -0,0 +1,18 @@
#!/usr/bin/bash
set -x
echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
curl -s -L https://entrust.com/root-certificates/entrust_l1k.cer | tee -a /etc/pki/ca-trust/source/anchors/entrust_l1k.cer
sudo update-ca-trust
curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh -o /usr/bin/travisci_build_coverity_scan.sh
if [ "$(file -b --mime-type /usr/bin/travisci_build_coverity_scan.sh)" == "text/x-shellscript" ]; then
chmod a+x /usr/bin/travisci_build_coverity_scan.sh
else
echo "Warning: Coverity not detected!"
# Disable the scanning tool
ln -sf /usr/bin/true /usr/bin/travisci_build_coverity_scan.sh
fi

View file

@ -0,0 +1,12 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN dnf -y --setopt=install_weak_deps=False --nogpgcheck install rsync \
&& dnf -y clean all
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/docs/travis-tasks.sh

View file

@ -0,0 +1,52 @@
#!/bin/bash
#Exit on failures
set -e
set -x
RETRY_CMD=/builddir/.travis/retry-command.sh
pushd /builddir/
# Build the code under GCC and run documentation generation
meson --buildtype=debug \
$COMMON_MESON_ARGS \
doc-generation
set +e
ninja -C doc-generation modulemd-2.0-doc
err=$?
if [ $err != 0 ]; then
cat doc-generation/meson-logs/testlog.txt
exit $err
fi
set -e
# Fix external references for publishing on the web
pushd doc-generation/modulemd/html
/builddir/contrib/doc-tools/fix-xref.sh
popd
$RETRY_CMD git clone https://sgallagher:$DOC_TOKEN@github.com/fedora-modularity/fedora-modularity.github.io
rsync -avh --delete-before --no-perms --omit-dir-times /builddir/doc-generation/modulemd/html/* fedora-modularity.github.io/libmodulemd/latest
pushd fedora-modularity.github.io
git add libmodulemd/latest
# Check to see if there are any changes
set +e
git commit -m "Updating libmodulemd docs for $TRAVIS_COMMIT" --dry-run
err=$?
if [ $err = 0 ]; then
set -e
git config user.name "Travis CI"
git config user.email "sgallagh@redhat.com"
git commit -m "Updating libmodulemd docs for $TRAVIS_COMMIT"
$RETRY_CMD git push origin master
fi
set -e
popd #fedora-modularity.github.io
popd #builddir

View file

@ -0,0 +1,51 @@
FROM __IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' \
--nogpgcheck --skip-broken install \
python3-black \
clang \
clang-analyzer \
clang-tools-extra \
createrepo_c \
"libmodulemd >= 2.3" \
curl \
elinks \
file-devel \
gcc \
gcc-c++ \
git-core \
glib2-devel \
glib2-doc \
gobject-introspection-devel \
gtk-doc \
help2man \
jq \
libyaml-devel \
meson \
ninja-build \
openssl \
packit \
pkgconf \
popt-devel \
python2-devel \
python2-six \
python2-gobject-base \
python3-autopep8 \
python3-devel \
python3-GitPython \
python3-gobject-base \
python3-pycodestyle \
python3-rpm-macros \
redhat-rpm-config \
rpm-build \
rpm-devel \
rpmdevtools \
ruby \
"rubygem(json)" \
rubygems \
sudo \
valgrind \
wget \
&& dnf -y clean all

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/fedora/travis-tasks.sh

View file

@ -0,0 +1,102 @@
#!/bin/bash
#Exit on failures
set -e
set -x
PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
MESON_DIRTY_REPO_ARGS="-Dtest_dirty_git=${DIRTY_REPO_CHECK:-false}"
RETRY_CMD=/builddir/.travis/retry-command.sh
pushd /builddir/
valgrind_cmd='
valgrind --error-exitcode=1
--errors-for-leak-kinds=definite
--leak-check=full
--show-leak-kinds=definite
--suppressions=/usr/share/glib-2.0/valgrind/glib.supp
--suppressions=/builddir/contrib/valgrind/libmodulemd-python.supp
'
# Build the code under GCC and run standard tests
meson --buildtype=debug \
$MESON_DIRTY_REPO_ARGS \
travis
meson test --suite formatters \
-C travis \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 5
meson test --suite ci \
-C travis \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 5
meson test --suite ci_valgrind \
--wrap="$valgrind_cmd" \
-C travis \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 10
# Test the code with clang-analyzer
# This requires meson 0.49.0 or later
set +e
rpmdev-vercmp `meson --version` 0.49.0
if [ $? -eq 12 ]; then
# Meson was older than 0.49.0, skip this step
echo "Meson is too old to run scan-build"
set -e
else
set -e
meson --buildtype=debug \
-Dskip_introspection=true \
$COMMON_MESON_ARGS \
travis_scanbuild
pushd travis_scanbuild
/builddir/.travis/scanbuild.sh
popd #travis_scanbuild
fi
# Always install and run the installed RPM tests last so we don't pollute the
# testing environment above.
arch=$(uname -m)
mkdir -p rpmbuild/RPMS/
pushd rpmbuild/RPMS/
packit local-build ../..
createrepo_c $arch
popd
$RETRY_CMD dnf -y install --nogpgcheck \
--allowerasing \
--repofrompath libmodulemd-travis,rpmbuild/RPMS/$arch \
python3-libmodulemd \
"libmodulemd-devel > 2"
# Also install the python2-libmodulemd if it was built for this release
# the ||: at the end instructs bash to consider this a pass either way.
$RETRY_CMD dnf -y install --nogpgcheck \
--allowerasing \
--repofrompath libmodulemd-travis,rpmbuild/RPMS \
python2-libmodulemd ||:
popd #build_rpm
meson --buildtype=debug \
-Dtest_installed_lib=true \
installed_lib_tests
# Run the tests against the installed RPMs
meson test --suite ci \
-C installed_lib_tests \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 5
popd #builddir

View file

@ -0,0 +1,45 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This file is part of libmodulemd
# Copyright (C) 2020 Stephen Gallagher
#
# 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>.
import xmlrpc.client
import time
KOJI_URL = "https://koji.fedoraproject.org/kojihub"
def get_fedora_rawhide_version(session):
# Koji sometimes disconnects for no apparent reason. Retry up to 5
# times before failing.
for attempt in range(5):
try:
build_targets = session.getBuildTargets("rawhide")
except requests.exceptions.ConnectionError:
logging.warning(
"Connection lost while retrieving rawhide branch, retrying..."
)
else:
# Succeeded this time, so break out of the loop
break
time.sleep(3)
return build_targets[0]["build_tag_name"].partition("-build")[0][1:]
def main():
session = xmlrpc.client.ServerProxy(KOJI_URL)
print(get_fedora_rawhide_version(session))
if __name__ == "__main__":
main()

View file

@ -0,0 +1,44 @@
FROM __IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' install \
clang \
clang-analyzer \
createrepo_c \
curl \
elinks \
file-devel \
gcc \
gcc-c++ \
git-core \
glib2-devel \
/usr/share/gtk-doc/html/glib/index.html \
gobject-introspection-devel \
gtk-doc \
help2man \
jq \
libyaml-devel \
meson \
ninja-build \
openssl \
pkgconf \
popt-devel \
python2-six \
python3-autopep8 \
python3-devel \
python3-gitpython \
python3-gobject3 \
python3-pycodestyle \
python3-rpm-macros \
rpm-mageia-setup-build \
rpm-build \
rpm-devel \
rpmdevtools \
ruby \
"rubygem(json)" \
rubygems \
sudo \
valgrind \
wget \
&& dnf -y clean all

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/mageia/travis-tasks.sh

View file

@ -0,0 +1,59 @@
#!/bin/bash
#Exit on failures
set -e
set -x
PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
COMMON_MESON_ARGS="-Dtest_dirty_git=${DIRTY_REPO_CHECK:-false} -Ddeveloper_build=false"
pushd /builddir/
valgrind_cmd='
valgrind --error-exitcode=1
--errors-for-leak-kinds=definite
--leak-check=full
--show-leak-kinds=definite
--suppressions=/usr/share/glib-2.0/valgrind/glib.supp
--suppressions=/builddir/contrib/valgrind/libmodulemd-python.supp
'
# Build the code under GCC and run standard tests
meson --buildtype=debug \
$COMMON_MESON_ARGS \
travis
meson test --suite ci \
-C travis \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 5
meson test --suite ci_valgrind \
--wrap="$valgrind_cmd" \
-C travis \
--num-processes=$PROCESSORS \
--print-errorlogs \
-t 10
# Test the code with clang-analyzer
# This requires meson 0.49.0 or later
set +e
rpmdev-vercmp `meson --version` 0.49.0
if [ $? -eq 12 ]; then
# Meson was older than 0.49.0, skip this step
echo "Meson is too old to run scan-build"
set -e
else
set -e
meson --buildtype=debug \
-Dskip_introspection=true \
$COMMON_MESON_ARGS \
travis_scanbuild
pushd travis_scanbuild
/builddir/.travis/scanbuild.sh
popd #travis_scanbuild
fi

View file

@ -0,0 +1,27 @@
FROM __IMAGE__
MAINTAINER Tomasz Paweł Gajc <tpgxyz@gmail.com>
RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' install \
clang \
clang-analyzer \
cmake \
help2man \
jq \
meson \
ninja \
rpmdevtools \
sudo \
valgrind \
wget \
task-devel \
'pkgconfig(zlib)' \
'pkgconfig(gobject-introspection-1.0)' \
'python3dist(autopep8)' \
'python3dist(pygobject)' \
'pkgconfig(yaml-0.1)' \
'pkgconfig(rpm)' \
magic-devel \
git-core \
elinks \
&& dnf -y clean all

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Tomasz Paweł Gajc <tpgxyz@gmail.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/openmandriva/travis-tasks.sh

View file

@ -0,0 +1,37 @@
#!/bin/bash
#Exit on failures
set -e
set -x
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dwith_docs=false"
pushd /builddir/
# Build the code under LLVM/clang and run standard tests
CC=clang CXX=clang++ meson --buildtype=debug \
$COMMON_MESON_ARGS \
travis
# (tpg) skip valgrind tests taking too much time
MMD_SKIP_VALGRIND=True ninja -C travis test
# Test the code with clang-analyzer
# This requires meson 0.49.0 or later
set +e
rpmdev-vercmp $(meson --version) 0.49.0
if [ $? -eq 12 ]; then
# Meson was older than 0.49.0, skip this step
printf '%s\n' 'Meson is too old to run scan-build'
set -e
else
set -e
CC=clang CXX=clang++ meson --buildtype=debug \
-Dskip_introspection=true \
$COMMON_MESON_ARGS \
travis_scanbuild
pushd travis_scanbuild
/builddir/.travis/scanbuild.sh
popd #travis_scanbuild
fi

View file

@ -0,0 +1,37 @@
FROM __IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
RUN sed -i /etc/zypp/zypp.conf \
-e "s/rpm.install.excludedocs = yes/rpm.install.excludedocs = no/"
RUN zypper install --no-confirm --no-recommends --capability \
clang \
clang-tools \
createrepo_c \
elinks \
file-devel \
gcc \
gcc-c++ \
git-core \
glib2-devel \
gobject-introspection-devel \
gtk-doc \
help2man \
jq \
libyaml-devel \
meson \
ninja \
pkgconf \
python3-autopep8 \
python3-devel \
python3-GitPython \
python3-gobject \
python3-pycodestyle \
python-rpm-macros \
rpm-build \
rpm-devel \
rpmdevtools \
sudo \
valgrind \
&& zypper clean --all

View file

@ -0,0 +1,9 @@
FROM __DEPS_IMAGE__
MAINTAINER Stephen Gallagher <sgallagh@redhat.com>
ARG TARBALL
ADD $TARBALL /builddir/
ENTRYPOINT /builddir/.travis/opensuse/travis-tasks.sh

View file

@ -0,0 +1,20 @@
#!/bin/bash
#Exit on failures
set -e
set -x
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3"
pushd /builddir/
# Build the code under GCC and run standard tests
meson --buildtype=debug \
$COMMON_MESON_ARGS \
travis
MMD_SKIP_VALGRIND=TRUE ninja -C travis test
popd #builddir

View file

@ -0,0 +1,39 @@
#!/bin/bash
function retry_command {
local usage="Usage: ${FUNCNAME[0]} [-b backoff-factor] [-d delay] [-n numtries]"
local OPTIND OPTION
local backoff_factor=2 delay=3 numtries=4
while getopts ":b:d:n:" OPTION; do
case "${OPTION}" in
b)
backoff_factor=${OPTARG}
;;
d)
delay=${OPTARG}
;;
n)
numtries=${OPTARG}
;;
*)
echo "$usage" 1>&2
return 1
;;
esac
done
shift $((OPTIND-1))
exitcode=0
while (( numtries > 0 )) ; do
eval "$@"
exitcode=$?
(( exitcode == 0 )) && break
(( --numtries > 0 )) && sleep $delay
(( delay *= backoff_factor ))
done
return $exitcode
}
retry_command "$@"

View file

@ -0,0 +1,20 @@
#!/bin/bash
# This file is part of libmodulemd
# Copyright (C) 2018 Stephen Gallagher
#
# 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>.
ninja scan-build
if [ $? -eq 0 ]; then
exit 0
else
elinks -dump meson-logs/scanbuild/*/index.html
exit 1
fi

View file

@ -0,0 +1,20 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
# There is only one release of archlinux since it's a rolling release
# distribution, so we can hard-code these values.
mmd_run_docker_tests \
os=archlinux \
release=base \
repository=docker.io \
image=archlinux/base
popd # $SCRIPT_DIR

View file

@ -0,0 +1,22 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
JOB_NAME=${TRAVIS_JOB_NAME:-CentOS 7}
arr=($JOB_NAME)
release=${arr[1]:-7}
repository=docker.io
mmd_run_docker_tests \
os=centos \
release=$release \
repository=$repository
popd # $SCRIPT_DIR

View file

@ -0,0 +1,114 @@
#!/bin/bash
set -x
# Global variables to support finalize()
MMD_OS=
MMD_RELEASE=
MMD_TARBALL_PATH=
BUILDAH_PATH=$(which buildah)
DOCKER_PATH=$(which docker)
RETRY_CMD=$SCRIPT_DIR/retry-command.sh
if [ x$BUILDAH_PATH == x ]; then
if [ x$DOCKER_PATH == x ]; then
>&2 echo "error: Neither docker nor podman available"
exit 1
else
MMD_BUILDAH="$RETRY_CMD sudo $DOCKER_PATH build"
MMD_LAYERS_TRUE=
MMD_LAYERS_FALSE=
fi
else
MMD_BUILDAH="$RETRY_CMD $BUILDAH_PATH bud"
MMD_LAYERS_TRUE="--layers=true"
MMD_LAYERS_FALSE="--layers=false"
fi
PODMAN_PATH=$(which podman)
if [ x$PODMAN_PATH == x ]; then
MMD_OCI="sudo $DOCKER_PATH"
else
MMD_OCI="$PODMAN_PATH"
fi
function common_finalize {
# If any specific test launcher needs to do its own cleanup as well,
# it should set the EXIT trap and make sure to also call this function
# internally.
exitcode=$?
rm -f $MMD_TARBALL_PATH \
$SCRIPT_DIR/$MMD_OS/Dockerfile.deps.$MMD_RELEASE \
$SCRIPT_DIR/$MMD_OS/Dockerfile.test.$MMD_RELEASE
return $exitcode
}
trap common_finalize EXIT
function mmd_run_docker_tests {
local os release repository image
local deps_template deps_image
local test_template test_image
local oci_extra_args
local "${@}"
if [ -z $SCRIPT_DIR ]; then
>&2 echo "Programming error: \$SCRIPT_DIR must be set"
exit 1
fi
os=${os-fedora}
release=${release-rawhide}
repository=${repository-registry.fedoraproject.org}
# Lower-case the os and release for the container registry
MMD_OS=${os,,}
MMD_RELEASE=${release,,}
image=${image-$MMD_OS:$MMD_RELEASE}
deps_template=${deps_template-$MMD_OS/Dockerfile.deps.tmpl}
test_template=${test_template-$MMD_OS/Dockerfile.tmpl}
deps_image=${deps_image-libmodulemd-deps-$MMD_OS:$MMD_RELEASE}
test_image=${test_image-libmodulemd-$MMD_OS:$MMD_RELEASE}
# Create an archive of the current checkout
MMD_TARBALL_PATH=`mktemp -p $SCRIPT_DIR tarball-XXXXXX.tar.bz2`
TARBALL=`basename $MMD_TARBALL_PATH`
pushd $SCRIPT_DIR/..
git ls-files |xargs tar cfj $MMD_TARBALL_PATH .git
popd
m4 -D__IMAGE__="$repository/$image" \
-D__OS__=$os \
-D__RELEASE__=$release \
$SCRIPT_DIR/${deps_template} \
> $SCRIPT_DIR/$MMD_OS/Dockerfile.deps.$MMD_RELEASE
m4 -D__DEPS_IMAGE__="fedora-modularity/${deps_image}" \
-D__OS__=$os \
-D__RELEASE__=$release \
$SCRIPT_DIR/${test_template} \
> $SCRIPT_DIR/$MMD_OS/Dockerfile.test.$MMD_RELEASE
$MMD_BUILDAH $MMD_LAYERS_TRUE \
-f $SCRIPT_DIR/$MMD_OS/Dockerfile.deps.$MMD_RELEASE \
-t fedora-modularity/${deps_image} .
$MMD_BUILDAH $MMD_LAYERS_FALSE \
-f $SCRIPT_DIR/$MMD_OS/Dockerfile.test.$MMD_RELEASE \
-t fedora-modularity/${test_image} \
--build-arg TARBALL=${TARBALL} .
eval $MMD_OCI run \
${oci_extra_args} \
--rm fedora-modularity/${test_image}
}
set +x

View file

@ -0,0 +1,28 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
os=centos
release=8
repository=docker.io
# Override the standard tests with the Coverity scan
mmd_run_docker_tests \
os=$os \
release=$release \
repository=$repository \
test_template="coverity/Dockerfile.tmpl" \
test_image="libmodulemd-coverity" \
oci_extra_args="
-e COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN
-e TRAVIS=$TRAVIS
-e TRAVIS_COMMIT='$TRAVIS_COMMIT'
"
popd # $SCRIPT_DIR

View file

@ -0,0 +1,30 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
os=fedora
release=32
repository=quay.io
image=fedora/fedora:${release}-$(uname -m)
# Override the standard tests with the doc generation template
mmd_run_docker_tests \
os=$os \
release=$release \
repository=$repository \
image=$image \
test_template="docs/Dockerfile.tmpl" \
test_image="libmodulemd-docs-$os:$release" \
oci_extra_args="
-e TRAVIS=$TRAVIS
-e TRAVIS_COMMIT='$TRAVIS_COMMIT'
-e DOC_TOKEN='$DOC_TOKEN'
"
popd # $SCRIPT_DIR

View file

@ -0,0 +1,26 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
JOB_NAME=${TRAVIS_JOB_NAME:-Fedora rawhide}
arr=($JOB_NAME)
release=${arr[1]:-rawhide}
if [ $release = rawhide ]; then
release=$($SCRIPT_DIR/get_rawhide_version.py)
fi
mmd_run_docker_tests \
os=fedora \
release=$release \
repository=quay.io \
image=fedora/fedora:$release-$(uname -m)
popd # $SCRIPT_DIR

View file

@ -0,0 +1,22 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
JOB_NAME=${TRAVIS_JOB_NAME:-Mageia 7}
arr=($JOB_NAME)
release=${arr[1]:-7}
mmd_run_docker_tests \
os=mageia \
release=$release \
repository=docker.io
popd # $SCRIPT_DIR

View file

@ -0,0 +1,20 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
JOB_NAME=${TRAVIS_JOB_NAME:-OpenMandriva cooker}
arr=($JOB_NAME)
release=${arr[1]:-cooker}
mmd_run_docker_tests \
os=openmandriva \
release=$release \
repository=docker.io \
image=openmandriva/$release

View file

@ -0,0 +1,22 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR
source $SCRIPT_DIR/travis-common.inc
set -e
set -x
JOB_NAME=${TRAVIS_JOB_NAME:-openSUSE tumbleweed}
arr=($JOB_NAME)
release=${arr[1]:-tumbleweed}
mmd_run_docker_tests \
os=opensuse \
release=$release \
repository=registry.opensuse.org \
image=opensuse/$release
popd # $SCRIPT_DIR

View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2017-2018 Stephen Gallagher <sgallagh@redhat.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,352 @@
[![Travis](https://img.shields.io/travis/fedora-modularity/libmodulemd.svg?style=plastic)](https://travis-ci.org/fedora-modularity/libmodulemd)
[![Travis](https://img.shields.io/coverity/scan/13739.svg?style=plastic)](https://scan.coverity.com/projects/sgallagher-libmodulemd)
# libmodulemd
C Library for manipulating module metadata files
Full details can be found in the
[API Documentation](https://fedora-modularity.github.io/libmodulemd/latest/)
# Using libmodulemd from Python
Using libmodulemd from Python is possible thanks to the gobject-introspection
project. To use libmodulemd from Python, include the following at the top of
your sources.
Install the `python2-libmodulemd` or `python3-libmodulemd` package for your
system depending on the version of python with which you are working.
These packages provide the appropriate language bindings.
```python
import gi
gi.require_version("Modulemd", "2.0")
from gi.repository import Modulemd
```
# Working with repodata (DNF use-case)
The libmodulemd API provides a number of convenience tools for interacting
with repodata (that is, streams of YAML that contains information on multiple
streams, default data and translations). The documentation will use two
repositories, called "fedora" and "updates" for demonstrative purposes. It
will assume that the content of the YAML module metadata from those two
repositories have been loaded into string variables `fedora_yaml` and
`updates_yaml`, respectively.
First step is to load the metadata from these two repositories into
ModulemdModuleIndex objects. This is done as follows:
## C
```C
ModulemdModuleIndex *fedora_index = modulemd_module_index_new ();
gboolean ret = modulemd_module_index_update_from_string (
fedora_index, fedora_yaml, TRUE, &failures, &error);
ModulemdModuleIndex *updates_index = modulemd_module_index_new ();
gboolean ret2 = modulemd_module_index_update_from_string (
updates_index, updates_yaml, TRUE, &failures, &error);
```
## Python
```python
fedora_index = Modulemd.ModuleIndex.new()
ret, failures = fedora_index.update_from_string(fedora_yaml, True)
updates_index = Modulemd.ModuleIndex.new()
ret, failures = updates_index.update_from_string(updates_yaml, True)
```
The `failures` are a list of subdocuments in the YAML that failed parsing,
along with the reason they failed. Hence, by checking the return value of
failures we will know if the YAML parsing was successful or not.
Since it doesn't really make sense to view the contents from separate
repositories in isolation (in most cases), the next step is to merge the two
indexes into a combined one:
## C
```C
ModulemdModuleIndexMerger *merger = modulemd_module_index_merger_new ();
modulemd_module_index_merger_associate_index (merger, fedora_index, 0);
modulemd_module_index_merger_associate_index (merger, updates_index, 0);
ModulemdModuleIndex *merged_index =
modulemd_module_index_merger_resolve (merger, &error);
```
## Python
```python
merger = Modulemd.ModuleIndexMerger.new()
merger.associate_index(fedora_index, 0)
merger.associate_index(updates_index, 0)
merged_index = merger.resolve()
```
At this point, you now have either a complete view of the merged repodata,
or else have received an error describing why the merge was unable to
complete successfully. Additionally, it should be noted that the combined
metadata in any ModulemdModuleIndex will have all of its component parts
upgraded to match the highest version of those objects seen. So for example
if the repodata has a mix of v1 and v2 ModulemdModuleStream objects, the
index will contain only v2 objects (with the v1 objects automatically
upgraded internally).
Now, we can start operating on the retrieved data. This guide will
give only a brief overview of the most common operations. See the API
specification for a full list of information that can be retrieved.
## Discover the default stream for a particular module.
## C
```C
ModulemdModule *module =
modulemd_module_index_get_module (merged_index, "modulename");
ModulemdDefaults *defaults = modulemd_module_get_defaults (module);
printf ("Default stream for modulename is %s\n",
modulemd_defaults_v1_get_default_stream (
MODULEMD_DEFAULTS_V1 (defaults), NULL));
```
## Python
```python
module = merged_index.get_module("modulename")
defaults = module.get_defaults()
print("Default stream for modulename is %s" % defaults.get_default_stream())
```
## Get the list of RPMs defining the public API for a particular module NSVCA
First, query the ModulemdModuleIndex for the module with a given name.
## C
```C
ModulemdModule *module =
modulemd_module_index_get_module (merged_index, "modulename");
```
## Python
```python
module = merged_index.get_module("modulename")
```
Then, query the ModulemdModule for the ModulemdModuleStream associated with the
provided NSVCA (name-stream-version-context-architecture identifier).
## C
```C
ModulemdModuleStream *stream = modulemd_module_get_stream_by_NSVCA (
module, "modulestream", 0, "deadbeef", "coolarch", &error);
```
## Python
```python
stream = module.get_stream_by_NSVCA("modulestream", 0, "deadbeef", "coolarch")
```
Lastly, read the RPM API from the ModulemdModuleStream. Here, `api_list` is
a list of strings containing package names.
## C
```C
GStrv api_list = modulemd_module_stream_v2_get_rpm_api_as_strv (
MODULEMD_MODULE_STREAM_V2 (stream));
```
## Python
```python
api_list = stream.get_rpm_api()
```
Also note that in addition to accessor API methods, many objects also have
properties that can be accessed directly.
## C
```C
printf ("Documentation for module stream is at %s\n",
modulemd_module_stream_v2_get_documentation (
MODULEMD_MODULE_STREAM_V2 (stream)));
g_autofree gchar *doc;
g_object_get (MODULEMD_MODULE_STREAM_V2 (stream), "documentation", &doc, NULL);
printf ("Documentation for module stream is at %s\n", doc);
```
## Python
```python
print("Documentation for module stream is at %s" % stream.get_documentation())
print("Documentation for module stream is at %s" % stream.props.documentation)
```
## Retrieve the modular runtime dependencies for a particular module NSVCA
## C
```C
ModulemdModule *module =
modulemd_module_index_get_module (merged_index, "modulename");
ModulemdModuleStream *stream = modulemd_module_get_stream_by_NSVCA (
module, "modulestream", 0, "deadbeef", "coolarch", &error);
GPtrArray *deps_list = modulemd_module_stream_v2_get_dependencies (
MODULEMD_MODULE_STREAM_V2 (stream));
for (gint i = 0; i < deps_list->len; i++)
{
GStrv depmodules_list =
modulemd_dependencies_get_runtime_modules_as_strv (
g_ptr_array_index (deps_list, i));
for (gint j = 0; j < g_strv_length (depmodules_list); j++)
{
GStrv depstreams_list =
modulemd_dependencies_get_runtime_streams_as_strv (
g_ptr_array_index (deps_list, i), depmodules_list[j]);
for (gint k = 0; k < g_strv_length (depstreams_list); k++)
{
// do stuff with depmodules_list[j], depstreams_list[k]
}
}
}
```
## Python
```python
module = merged_index.get_module("modulename")
stream = module.get_stream_by_NSVCA("modulestream", 0, "deadbeef", "coolarch")
deps_list = stream.get_dependencies()
for dep in deps_list:
depmodules_list = dep.get_runtime_modules()
for depmod in depmodules_list:
depstream_list = dep.get_runtime_streams(depmod)
for depstream in depstream_list:
# do stuff with depmod, depstream
```
# Working with a single module stream (Packager/MBS use-case)
One limitation of the ModulemdModuleIndex format is that it requires that
all module streams loaded into it have both a name and a stream name.
This however is not possible when dealing with streams such as a packager
would be using (since the build-system auto-generates the module name and
stream name from the git repository information. In this case, we need to
work with a single module stream document at a time. For this, we will
use the ModulemdModuleStream interface.
This example will assume that the module name and stream name have
already been determined from the repodata and that they are stored in
string variables named `module_name` and `stream_name`, respectively.
## Python
```python
stream = Modulemd.ModuleStream.read_file(
"/path/to/module_name.yaml", True, module_name, stream_name
)
v2_stream = stream.upgrade(Modulemd.ModuleStreamVersionEnum.TWO)
v2_stream.validate()
```
In the example above, we upgraded the stream to v2, in case we were reading
from v1 metadata. This will allow us to avoid having to manage multiple
code-paths and support only the latest we understand. After that, it calls
validate() to ensure that the content that was read in was valid both
syntactically and referentially.
Also available is `Modulemd.ModuleStreamVersionEnum.LATEST` which will
always represent the highest-supported version of the
ModulemdModuleStream metadata format. This may change at any time.
# Getting started with developing
## Prerequisites
* A Fedora development environment (physical or virtual)
To install all of the dependencies needed to build libmodulemd, the following
command will work on Fedora 28+ (run as root or with sudo):
```
dnf -y install clang git-core python3-pycodestyle python3-black redhat-rpm-config "dnf-command(builddep)"
dnf -y builddep libmodulemd
```
To install the tools needed to run the docker-based tests, you will also need:
```
dnf -y install docker
sudo systemctl enable --now docker.service
```
and to make sure that your user has privilege to run `sudo docker` (see the
documentation for the `/etc/sudoers` file to figure this out).
## Forking and cloning the sources
The libmodulemd project follows the
[Github Fork-and-Pull](https://reflectoring.io/github-fork-and-pull/) model of
development. To get started, create a fork of the upstream libmodulemd sources,
clone those locally and create branches on your fork to make changes. When they
are ready for review or feedback, create a pull-request.
## Building the sources
Projects built with the meson build-system require a separate build directory from
the source path. The `meson` command will generate this directory for you.
```
meson --buildtype=debug -Db_coverage=true debugbuild
```
The above command (run from the root of the source checkout) will create a new
subdirectory - `debugbuild` - configured to compile with debug symbols and
`gcov` symbols to measure test coverage.
To build the sources, `chdir()` into the `debugbuild` directory and run
```
ninja
```
To build and run the in-tree tests, use
```
ninja test
```
To generate HTML documentation, you can run
```
ninja modulemd-2.0-doc
```
(Be aware that the GLib documentation module in meson has some strange quirks
and won't recognize newly-added pages without deleting and re-creating the
build directory first.)
To run the docker-based tests, you can run (from the source root and with
`sudo` privilege to run `docker`):
```
./.travis/travis-fedora.sh
```
(Optionally setting the environment variable `TRAVIS_JOB_NAME` to `Fedora 28`,
`Fedora 29`, etc. to switch to building against those releases rather than
Fedora Rawhide).
## Tips and tricks
### Running tests in debug mode
The libmodulemd library is built atop
[GObject](https://developer.gnome.org/gobject/stable/). It provides a debug
mode that is configurable by an environment variable. In general, it is highly
recommended that you run all tests with
`G_DEBUG='fatal-warnings,fatal-criticals'` set in the environment. This will
cause the application to `abort()` on programming errors that would be logged
and ignored at runtime.
### Running tests with valgrind
Assuming your current working directory is `debugbuild` as described above:
```
meson test --suite=ci_valgrind \
--wrap="valgrind \
--leak-check=full \
--suppressions=/usr/share/glib-2.0/valgrind/glib.supp \
--suppressions=../contrib/valgrind/libmodulemd-python.supp"
```
If not, you may need to adjust the path to libmodulemd-python.supp.
You can also specify individual tests to run against. See `meson test --list`
for the available tests.
The automated CI tests will always run with valgrind on all platforms where it
is supported.
# Authors:
* Stephen Gallagher <sgallagh@redhat.com>
* Igor Gnatenko <ignatenkobrain@fedoraproject.org>

View file

@ -0,0 +1,152 @@
# This file is part of libmodulemd
# Copyright (C) 2016 Red Hat, Inc.
# Copyright (C) 2017-2018 Stephen Gallagher
#
# 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>.
from ..module import get_introspection_module
from ..overrides import override
from six import text_type
from gi.repository import GLib
import datetime
Modulemd = get_introspection_module("Modulemd")
__all__ = []
class ModulemdUtil(object):
@staticmethod
def variant_str(s):
"""Converts a string to a GLib.Variant"""
if not isinstance(s, str):
raise TypeError("Only strings are supported for scalars")
return GLib.Variant.new_string(s)
@staticmethod
def variant_bool(b):
"""Converts a boolean to a GLib.Varant"""
if not isinstance(b, bool):
raise TypeError("Only booleans are supported")
return GLib.Variant.new_boolean(b)
@staticmethod
def variant_list(vl):
"""Converts a list to a GLib.Variant"""
# If this is a zero-length array, handle it specially
if len(vl) == 0:
return GLib.Variant.new_array(GLib.VariantType("v"))
# Build the array from each entry
builder = GLib.VariantBuilder(GLib.VariantType("a*"))
for item in vl:
if item is None:
item = ""
builder.add_value(ModulemdUtil.python_to_variant(item))
return builder.end()
@staticmethod
def variant_dict(d):
"""Converts a dictionary to a dictionary of GLib.Variant"""
if not isinstance(d, dict):
raise TypeError("Only dictionaries are supported for mappings")
vdict = GLib.VariantDict()
for k, v in d.items():
if v is None:
v = ""
vdict.insert_value(k, ModulemdUtil.python_to_variant(v))
return vdict.end()
@staticmethod
def python_to_variant(obj):
if isinstance(obj, str):
return ModulemdUtil.variant_str(obj)
elif isinstance(obj, text_type):
return ModulemdUtil.variant_str(obj.encode("utf-8"))
elif isinstance(obj, bool):
return ModulemdUtil.variant_bool(obj)
elif isinstance(obj, list):
return ModulemdUtil.variant_list(obj)
elif isinstance(obj, dict):
return ModulemdUtil.variant_dict(obj)
else:
raise TypeError("Cannot convert unknown type")
if float(Modulemd._version) >= 2:
class ModuleStreamV2(Modulemd.ModuleStreamV2):
def set_xmd(self, xmd):
super(ModuleStreamV2, self).set_xmd(
ModulemdUtil.python_to_variant(xmd)
)
def get_xmd(self):
variant_xmd = super(ModuleStreamV2, self).get_xmd()
if variant_xmd is None:
return {}
return variant_xmd.unpack()
ModuleStreamV2 = override(ModuleStreamV2)
__all__.append(ModuleStreamV2)
class ModuleStreamV1(Modulemd.ModuleStreamV1):
def set_xmd(self, xmd):
super(ModuleStreamV1, self).set_xmd(
ModulemdUtil.python_to_variant(xmd)
)
def get_xmd(self):
variant_xmd = super(ModuleStreamV1, self).get_xmd()
if variant_xmd is None:
return {}
return variant_xmd.unpack()
ModuleStreamV1 = override(ModuleStreamV1)
__all__.append(ModuleStreamV1)
class ServiceLevel(Modulemd.ServiceLevel):
def set_eol(self, eol):
if isinstance(eol, datetime.date):
return super(ServiceLevel, self).set_eol_ymd(
eol.year, eol.month, eol.day
)
raise TypeError(
"Expected datetime.date, but got %s." % (type(eol).__name__)
)
def get_eol(self):
eol = super(ServiceLevel, self).get_eol()
if eol is None:
return None
return datetime.date(
eol.get_year(), eol.get_month(), eol.get_day()
)
ServiceLevel = override(ServiceLevel)
__all__.append(ServiceLevel)

View file

@ -0,0 +1,30 @@
gobject_overrides_dir_py3 = get_option('gobject_overrides_dir_py3')
gobject_overrides_dir_py2 = get_option('gobject_overrides_dir_py2')
# Python 3
if gobject_overrides_dir_py3 == ''
ret = run_command([python3, '-c', 'import gi; print(gi._overridesdir)'])
if ret.returncode() != 0
error('Failed to determine Python 3 pygobject overridedir')
else
gobject_overrides_dir_py3 = ret.stdout().strip()
endif
endif
install_data('gi/overrides/Modulemd.py', install_dir: gobject_overrides_dir_py3)
# Python 2
if with_py2
if gobject_overrides_dir_py2 == ''
ret2 = run_command([python2, '-c', 'import gi; print(gi._overridesdir)'])
if ret2.returncode() != 0
error('Failed to determine Python 2 pygobject overridedir')
else
gobject_overrides_dir_py2 = ret2.stdout().strip()
endif
endif
install_data('gi/overrides/Modulemd.py', install_dir: gobject_overrides_dir_py2)
endif

View file

@ -0,0 +1,15 @@
#!/bin/sh
devdocs_url="https://developer.gnome.org"
dir=`pwd`
for file in $dir/*.html; do
echo "Fixing cross-references in ${file}..."
sed -i \
-e "s|/usr/share/gtk-doc/html/gobject|${devdocs_url}/gobject/stable|" \
-e "s|/usr/share/gtk-doc/html/glib|${devdocs_url}/glib/stable|" \
-e "s|\.\./glib|${devdocs_url}/glib/stable|" \
-e "s|\.\./gobject|${devdocs_url}/gobject/stable|" \
${file}
done

View file

@ -0,0 +1,87 @@
#!/usr/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SOURCE_ROOT=$SCRIPT_DIR/../..
pushd $SOURCE_ROOT
function error_out {
local code message
local "${@}"
echo $message 1>&2
exit $code
}
TMPDIR=$(mktemp -d MODULEMD_XXXXXX --tmpdir)
function common_finalize {
exitcode=$?
rm -Rf $TMPDIR
return $exitcode
}
trap common_finalize EXIT
# Don't release if the git repo has uncommitted changes
git diff --quiet || error_out code=127 message="There are uncommitted changes. Refusing to release."
[[ $(git remote get-url upstream) =~ fedora-modularity/libmodulemd.git$ ]] || error_out code=127 message="There must be a git remote named 'upstream' available. The user running this script must have privilege to push commits to the 'upstream' remote"
[ $(git branch --show-current) = main ] || error_out code=127 message="This script may only be run on the 'main' branch"
hub --version >/dev/null || error_out code=127 message="Install 'hub' to use this script"
jq --version >/dev/null || error_out code=127 message="Install 'jq' to use this script"
# Make sure the current user has logged in before or prompt them for credentials
echo "Logging into Github"
hub api "https://api.github.com/user" || error_out code=1 message="Invalid credentials"
# Get the previous tag for this branch
OLDTAG=$(git describe --first-parent --abbrev=0)
# Configure the build directory
meson --buildtype=release -Dskip_formatters=true -Ddeveloper_build=false $TMPDIR
MMD_SKIP_VALGRIND=True ninja -C $TMPDIR dist
# Get the version that will be tagged
NEWVERSION=$(meson introspect $TMPDIR --projectinfo |jq -r ".version")
NEWTAG=libmodulemd-$NEWVERSION
if [ $NEWTAG = $OLDTAG ]; then
error_out code=2 message="Version is already tagged. Update meson.build with the new version."
fi
echo ==========
echo Tagging $NEWTAG
echo ==========
echo Tagging $NEWTAG > $TMPDIR/tag_header
echo >> $TMPDIR/tag_header
git shortlog $OLDTAG.. >> $TMPDIR/shortlog || error_out code=3 message="Couldn't find the previous tag"
cat $TMPDIR/tag_header $TMPDIR/shortlog > $TMPDIR/tag_message
git tag -s -F $TMPDIR/tag_message $NEWTAG || error_out code=4 message="Couldn't create new signed tag for the release"
git tag -s -F $TMPDIR/tag_message $NEWVERSION || error_out code=4 message="Couldn't create new signed tag for the release"
# meson 0.50.0 and later can modify the version field programmatically
if [ $($SCRIPT_DIR/semver compare 0.50.0 $(meson --version)) = -1 ]; then
bump_version=$($SCRIPT_DIR/semver bump patch $NEWVERSION)
pushd $SOURCE_ROOT
meson rewrite kwargs set project / version $bump_version #|| error_out code=11 message="Couldn't bump the version in meson.build"
git commit -sm "Bump version in meson.build to $bump_version" meson.build
popd #$SOURCE_ROOT
fi
# Make sure everything is up-to-date on Github
git push --follow-tags upstream main || error_out code=5 message="Couldn't push the new tags to Github"
echo "libmodulemd $NEWVERSION" > $TMPDIR/github_message
echo >> $TMPDIR/github_message
sed -E "s/ / * /g" $TMPDIR/shortlog | sed -E "s/(.*):\$/\# \1/g" >> $TMPDIR/github_message
hub release create -a $TMPDIR/meson-dist/modulemd-$NEWVERSION.tar.xz \
-a $TMPDIR/meson-dist/modulemd-$NEWVERSION.tar.xz.sha256sum \
-F $TMPDIR/github_message \
$NEWTAG || error_out code=10 message="Couldn't publish the release"

View file

@ -0,0 +1,282 @@
#!/usr/bin/env bash
# Retrieved from https://github.com/fsaintjacques/semver-tool
# This code is GPLv3, but it's used as part of the libmodulemd release process
# and it does not end up in the built library.
set -o errexit -o nounset -o pipefail
NAT='0|[1-9][0-9]*'
ALPHANUM='[0-9]*[A-Za-z-][0-9A-Za-z-]*'
IDENT="$NAT|$ALPHANUM"
FIELD='[0-9A-Za-z-]+'
SEMVER_REGEX="\
^[vV]?\
($NAT)\\.($NAT)\\.($NAT)\
(\\-(${IDENT})(\\.(${IDENT}))*)?\
(\\+${FIELD}(\\.${FIELD})*)?$"
PROG=semver
PROG_VERSION="3.0.0"
USAGE="\
Usage:
$PROG bump (major|minor|patch|release|prerel <prerel>|build <build>) <version>
$PROG compare <version> <other_version>
$PROG get (major|minor|patch|release|prerel|build) <version>
$PROG --help
$PROG --version
Arguments:
<version> A version must match the following regular expression:
\"${SEMVER_REGEX}\"
In English:
-- The version must match X.Y.Z[-PRERELEASE][+BUILD]
where X, Y and Z are non-negative integers.
-- PRERELEASE is a dot separated sequence of non-negative integers and/or
identifiers composed of alphanumeric characters and hyphens (with
at least one non-digit). Numeric identifiers must not have leading
zeros. A hyphen (\"-\") introduces this optional part.
-- BUILD is a dot separated sequence of identifiers composed of alphanumeric
characters and hyphens. A plus (\"+\") introduces this optional part.
<other_version> See <version> definition.
<prerel> A string as defined by PRERELEASE above.
<build> A string as defined by BUILD above.
Options:
-v, --version Print the version of this tool.
-h, --help Print this help message.
Commands:
bump Bump by one of major, minor, patch; zeroing or removing
subsequent parts. \"bump prerel\" sets the PRERELEASE part and
removes any BUILD part. \"bump build\" sets the BUILD part.
\"bump release\" removes any PRERELEASE or BUILD parts.
The bumped version is written to stdout.
compare Compare <version> with <other_version>, output to stdout the
following values: -1 if <other_version> is newer, 0 if equal, 1 if
older. The BUILD part is not used in comparisons.
get Extract given part of <version>, where part is one of major, minor,
patch, prerel, build, or release.
See also:
https://semver.org -- Semantic Versioning 2.0.0"
function error {
echo -e "$1" >&2
exit 1
}
function usage-help {
error "$USAGE"
}
function usage-version {
echo -e "${PROG}: $PROG_VERSION"
exit 0
}
function validate-version {
local version=$1
if [[ "$version" =~ $SEMVER_REGEX ]]; then
# if a second argument is passed, store the result in var named by $2
if [ "$#" -eq "2" ]; then
local major=${BASH_REMATCH[1]}
local minor=${BASH_REMATCH[2]}
local patch=${BASH_REMATCH[3]}
local prere=${BASH_REMATCH[4]}
local build=${BASH_REMATCH[8]}
eval "$2=(\"$major\" \"$minor\" \"$patch\" \"$prere\" \"$build\")"
else
echo "$version"
fi
else
error "version $version does not match the semver scheme 'X.Y.Z(-PRERELEASE)(+BUILD)'. See help for more information."
fi
}
function is-nat {
[[ "$1" =~ ^($NAT)$ ]]
}
function is-null {
[ -z "$1" ]
}
function order-nat {
[ "$1" -lt "$2" ] && { echo -1 ; return ; }
[ "$1" -gt "$2" ] && { echo 1 ; return ; }
echo 0
}
function order-string {
[[ $1 < $2 ]] && { echo -1 ; return ; }
[[ $1 > $2 ]] && { echo 1 ; return ; }
echo 0
}
# given two (named) arrays containing NAT and/or ALPHANUM fields, compare them
# one by one according to semver 2.0.0 spec. Return -1, 0, 1 if left array ($1)
# is less-than, equal, or greater-than the right array ($2). The longer array
# is considered greater-than the shorter if the shorter is a prefix of the longer.
#
function compare-fields {
local l="$1[@]"
local r="$2[@]"
local leftfield=( "${!l}" )
local rightfield=( "${!r}" )
local left
local right
local i=$(( -1 ))
local order=$(( 0 ))
while true
do
[ $order -ne 0 ] && { echo $order ; return ; }
: $(( i++ ))
left="${leftfield[$i]}"
right="${rightfield[$i]}"
is-null "$left" && is-null "$right" && { echo 0 ; return ; }
is-null "$left" && { echo -1 ; return ; }
is-null "$right" && { echo 1 ; return ; }
is-nat "$left" && is-nat "$right" && { order=$(order-nat "$left" "$right") ; continue ; }
is-nat "$left" && { echo -1 ; return ; }
is-nat "$right" && { echo 1 ; return ; }
{ order=$(order-string "$left" "$right") ; continue ; }
done
}
# shellcheck disable=SC2206 # checked by "validate"; ok to expand prerel id's into array
function compare-version {
local order
validate-version "$1" V
validate-version "$2" V_
# compare major, minor, patch
local left=( "${V[0]}" "${V[1]}" "${V[2]}" )
local right=( "${V_[0]}" "${V_[1]}" "${V_[2]}" )
order=$(compare-fields left right)
[ "$order" -ne 0 ] && { echo "$order" ; return ; }
# compare pre-release ids when M.m.p are equal
local prerel="${V[3]:1}"
local prerel_="${V_[3]:1}"
local left=( ${prerel//./ } )
local right=( ${prerel_//./ } )
# if left and right have no pre-release part, then left equals right
# if only one of left/right has pre-release part, that one is less than simple M.m.p
[ -z "$prerel" ] && [ -z "$prerel_" ] && { echo 0 ; return ; }
[ -z "$prerel" ] && { echo 1 ; return ; }
[ -z "$prerel_" ] && { echo -1 ; return ; }
# otherwise, compare the pre-release id's
compare-fields left right
}
function command-bump {
local new; local version; local sub_version; local command;
case $# in
2) case $1 in
major|minor|patch|release) command=$1; version=$2;;
*) usage-help;;
esac ;;
3) case $1 in
prerel|build) command=$1; sub_version=$2 version=$3 ;;
*) usage-help;;
esac ;;
*) usage-help;;
esac
validate-version "$version" parts
# shellcheck disable=SC2154
local major="${parts[0]}"
local minor="${parts[1]}"
local patch="${parts[2]}"
local prere="${parts[3]}"
local build="${parts[4]}"
case "$command" in
major) new="$((major + 1)).0.0";;
minor) new="${major}.$((minor + 1)).0";;
patch) new="${major}.${minor}.$((patch + 1))";;
release) new="${major}.${minor}.${patch}";;
prerel) new=$(validate-version "${major}.${minor}.${patch}-${sub_version}");;
build) new=$(validate-version "${major}.${minor}.${patch}${prere}+${sub_version}");;
*) usage-help ;;
esac
echo "$new"
exit 0
}
function command-compare {
local v; local v_;
case $# in
2) v=$(validate-version "$1"); v_=$(validate-version "$2") ;;
*) usage-help ;;
esac
set +u # need unset array element to evaluate to null
compare-version "$v" "$v_"
exit 0
}
# shellcheck disable=SC2034
function command-get {
local part version
if [[ "$#" -ne "2" ]] || [[ -z "$1" ]] || [[ -z "$2" ]]; then
usage-help
exit 0
fi
part="$1"
version="$2"
validate-version "$version" parts
local major="${parts[0]}"
local minor="${parts[1]}"
local patch="${parts[2]}"
local prerel="${parts[3]:1}"
local build="${parts[4]:1}"
local release="${major}.${minor}.${patch}"
case "$part" in
major|minor|patch|release|prerel|build) echo "${!part}" ;;
*) usage-help ;;
esac
exit 0
}
case $# in
0) echo "Unknown command: $*"; usage-help;;
esac
case $1 in
--help|-h) echo -e "$USAGE"; exit 0;;
--version|-v) usage-version ;;
bump) shift; command-bump "$@";;
get) shift; command-get "$@";;
compare) shift; command-compare "$@";;
*) echo "Unknown arguments: $*"; usage-help;;
esac

View file

@ -0,0 +1,99 @@
# libmodulemd valgrind suppressions file
#
# This provides a list of suppressions for libmodulemd for valgrind for
# the false positives that are reported when running under valgrind.
#
# Pass this suppression file to valgrind using --suppressions=/path/to/this-file.supp
#
# See http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
# for details about the format of this file.
#
# Also see https://wiki.wxwidgets.org/Parse_valgrind_suppressions.sh for a
# handy script to extract suppression entries from the valgrind test log.
#
{
Handle PyMalloc confusing valgrind
Memcheck:Leak
fun:malloc
...
fun:_PyObject_GC_New
}
{
Handle PyMalloc confusing valgrind
Memcheck:Leak
fun:malloc
...
fun:_PyObject_GC_NewVar
}
{
Handle PyMalloc confusing valgrind
Memcheck:Leak
fun:realloc
...
fun:_PyObject_GC_Resize
}
{
Handle PyMalloc confusing valgrind
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:_PyMem_RawWcsdup
}
{
Handle PyMalloc confusing valgrind
Memcheck:Cond
fun:PyUnicode_Decode
fun:PyUnicode_FromEncodedObject
}
{
Handle PyMalloc confusing valgrind
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_strdup
...
fun:PyObject_SetAttr
}
{
Handle Python 3.9 PyMalloc confusing valgrind
Memcheck:Leak
fun:malloc
fun:PyThread_allocate_lock
...
fun:Py_InitializeFromConfig
...
fun:Py_BytesMain
}
{
Python3 Unicode uninitialized value
Memcheck:Cond
fun:PyUnicode_Decode
...
fun:_PyEval_EvalFrameDefault
}
{
Mageia string insert leak
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
...
fun:g_string_insert_len
}
{
Mageia girepo leak
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_irepository_find_by_gtype
}
{
Mageia loaddynamicmodule leak
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:_PyImport_LoadDynamicModuleWithSpec
}

View file

@ -0,0 +1,8 @@
%dir /usr/lib/debug
%dir /usr/lib/debug/usr
%dir /usr/lib/debug/usr/bin
%dir /usr/lib/debug/usr/lib64
%dir /usr/lib/debug/.dwz
/usr/lib/debug/usr/bin/modulemd-validator-2.9.4-1.20201104154140470811.sourcegit.32.g989c359.fc33.x86_64.debug
/usr/lib/debug/usr/lib64/libmodulemd.so.2.10.0-2.9.4-1.20201104154140470811.sourcegit.32.g989c359.fc33.x86_64.debug
/usr/lib/debug/.dwz/libmodulemd-2.9.4-1.20201104154140470811.sourcegit.32.g989c359.fc33.x86_64

View file

View file

@ -0,0 +1 @@
/usr/src/debug/libmodulemd-2.9.4-1.20201104154140470811.sourcegit.32.g989c359.fc33.x86_64

Binary file not shown.

View file

@ -0,0 +1,2 @@
.//usr/bin/modulemd-validator
.//usr/lib64/libmodulemd.so.2.10.0

View file

@ -0,0 +1,48 @@
/modulemd-0.1.0.tar.xz
/modulemd-0.2.0.tar.xz
/modulemd-0.2.1.tar.xz
/modulemd-0.2.2.tar.xz
/modulemd-1.0.0.tar.xz
/modulemd-1.0.1.tar.xz
/modulemd-1.0.2.tar.xz
/modulemd-1.0.3.tar.xz
/modulemd-1.0.4.tar.xz
/modulemd-1.1.0.tar.xz
/modulemd-1.1.1.tar.xz
/modulemd-1.1.2.tar.xz
/modulemd-1.1.3.tar.xz
/modulemd-1.2.0.tar.xz
/modulemd-1.3.0.tar.xz
/modulemd-1.4.0.tar.xz
/modulemd-1.4.1.tar.xz
/modulemd-1.5.0.tar.xz
/modulemd-1.5.1.tar.xz
/modulemd-1.5.2.tar.xz
/modulemd-1.6.0.tar.xz
/modulemd-1.6.1.tar.xz
/modulemd-1.6.2.tar.xz
/modulemd-1.6.3.tar.xz
/modulemd-1.6.4.tar.xz
/modulemd-1.7.0.tar.xz
/modulemd-2.0.0beta2.tar.xz
/modulemd-2.0.0.tar.xz
/modulemd-2.1.0.tar.xz
/modulemd-2.2.0.tar.xz
/modulemd-2.2.1.tar.xz
/modulemd-2.2.2.tar.xz
/modulemd-2.2.3.tar.xz
/modulemd-2.3.0.tar.xz
/modulemd-2.3.1.tar.xz
/modulemd-2.4.0.tar.xz
/modulemd-2.5.0.tar.xz
/modulemd-2.6.0.tar.xz
/modulemd-2.7.0.tar.xz
/modulemd-2.8.0.tar.xz
/modulemd-2.8.1.tar.xz
/modulemd-2.8.2.tar.xz
/modulemd-2.8.3.tar.xz
/modulemd-2.9.0.tar.xz
/modulemd-2.9.1.tar.xz
/modulemd-2.9.2.tar.xz
/modulemd-2.9.3.tar.xz
/modulemd-2.9.4.tar.xz

View file

@ -0,0 +1,5 @@
# libmodulemd
C Library for manipulating module metadata files
See https://github.com/fedora-modularity/libmodulemd for more details.

View file

@ -0,0 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.10.1.

View file

@ -0,0 +1,17 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: dist.abicheck}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: dist.abicheck}

View file

@ -0,0 +1,659 @@
%if 0%{?rhel} && 0%{?rhel} <= 7
%global meson_python_flags -Dwith_py2=true
%global build_python2 1
%else
%global meson_python_flags -Dwith_py2=false
%global build_python2 0
%endif
%global upstream_name libmodulemd
%if (0%{?rhel} && 0%{?rhel} <= 7)
%global v2_suffix 2
%endif
Name: %{upstream_name}%{?v2_suffix}
Version: 2.9.4
Release: 1.20201104141224488906.sourcegit.31.g3d6c829%{?dist}
Summary: Module metadata manipulation library
License: MIT
URL: https://github.com/fedora-modularity/libmodulemd
Source0: libmodulemd-2.9.4.tar.gz
BuildRequires: meson >= 0.47
BuildRequires: pkgconfig
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(yaml-0.1)
BuildRequires: pkgconfig(gtk-doc)
BuildRequires: glib2-doc
BuildRequires: rpm-devel
BuildRequires: file-devel
%if %{build_python2}
BuildRequires: python2-devel
BuildRequires: python-gobject-base
%endif
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-gobject-base
BuildRequires: help2man
# Patches
%description
C Library for manipulating module metadata files.
See https://github.com/fedora-modularity/libmodulemd/blob/master/README.md for
more details.
%if %{build_python2}
%package -n python2-%{name}
Summary: Python 2 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python-gobject-base
Requires: python-six
%description -n python2-%{name}
Python 2 bindings for %{name}
%endif
%package -n python%{python3_pkgversion}-%{name}
Summary: Python 3 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}-gobject-base
%if (0%{?rhel} && 0%{?rhel} <= 7)
# The py3_dist macro on EPEL 7 doesn't work right at the moment
Requires: python3.6dist(six)
%else
Requires: %{py3_dist six}
%endif
%description -n python%{python3_pkgversion}-%{name}
Python %{python3_pkgversion} bindings for %{name}
%package devel
Summary: Development files for libmodulemd
Requires: %{name}%{?_isa} = %{version}-%{release}
%if (0%{?rhel} && 0%{?rhel} <= 7)
Conflicts: libmodulemd1-devel
Conflicts: libmodulemd-devel
%endif
%description devel
Development files for libmodulemd.
%prep
%autosetup -p1 -n libmodulemd-2.9.4
%build
%meson -Ddeveloper_build=false \
%{meson_python_flags}
%meson_build
%check
export LC_CTYPE=C.utf8
# Don't run tests on ARM for now. There are problems with
# performance on the builders and often these time out.
%ifnarch %{arm} aarch64
# The tests sometimes time out in CI, so give them a little extra time
%{__meson} test -C %{_vpath_builddir} %{?_smp_mesonflags} --print-errorlogs -t 5
%endif
%install
%meson_install
%if ( 0%{?rhel} && 0%{?rhel} <= 7)
# Don't conflict with modulemd-validator from 1.x included in the official
# RHEL 7 repos
mv %{buildroot}%{_bindir}/modulemd-validator \
%{buildroot}%{_bindir}/modulemd-validator%{?v2_suffix}
mv %{buildroot}%{_mandir}/man1/modulemd-validator.1 \
%{buildroot}%{_mandir}/man1/modulemd-validator%{?v2_suffix}.1
%endif
%ldconfig_scriptlets
%files
%license COPYING
%doc README.md
%{_bindir}/modulemd-validator%{?v2_suffix}
%{_mandir}/man1/modulemd-validator%{?v2_suffix}.1*
%{_libdir}/%{upstream_name}.so.2*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/Modulemd-2.0.typelib
%files devel
%{_libdir}/%{upstream_name}.so
%{_libdir}/pkgconfig/modulemd-2.0.pc
%{_includedir}/modulemd-2.0/
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/Modulemd-2.0.gir
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/modulemd-2.0/
%if %{build_python2}
%files -n python2-%{name}
%{python2_sitearch}/gi/overrides/
%endif
%files -n python%{python3_pkgversion}-%{name}
%{python3_sitearch}/gi/overrides/
%changelog
* Wed Nov 04 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.4-1.20201104141224488906.sourcegit.31.g3d6c829
- Fix README (Stephen Gallagher)
- Enable source-git functionality for Fedora (Stephen Gallagher)
- Tools: Tag with bare version as well (Stephen Gallagher)
- Do not treat OpenMandriva tests as blocking (Stephen Gallagher)
- Enhance the travis build scripts and Dockerfile templates so that the common mmd_run_docker_tests() launcher function can also launch the Coverity scan. This enhancement made it a simple matter to switch the Coverity scan to run on CentOS 8 instead of Fedora. (Merlin Mathesius)
- Clarify difference between MMD_YAML_ERROR_UNPARSEABLE and MMD_YAML_ERROR_PARSE (Merlin Mathesius)
- Add tests for modulemd_load_string() (Merlin Mathesius)
- TRAVIS: Bump Fedora version used for Coverity scan (Merlin Mathesius)
- Address detected Coverity scan defects (Merlin Mathesius)
- Update documentation with eols and 2.10 index (Aleš Matěj)
- Convert modulemd-obsoletes dates to ISO 8601 format (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module-index/merger (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module-stream (Aleš Matěj)
- Add modulemd-obsoletes (Aleš Matěj)
- Add convenience functions for loading the index (Stephen Gallagher)
- Update python formatting with python-black 20.8 (Stephen Gallagher)
- Fix incorrect error type (Stephen Gallagher)
- Update test for newer bash versions (Stephen Gallagher)
- Correct typo in documentation (Stephen Gallagher)
- TRAVIS: Add Fedora 33 to test hosts (Stephen Gallagher)
- Disable LTO (Stephen Gallagher)
- Create rpmbuild directory (Stephen Gallagher)
- fixup! validator: Add support for compressed YAML (Stephen Gallagher)
- validator: Add support for compressed YAML (Stephen Gallagher)
- Docs must be on the 'master' branch due to Github limitations (Stephen Gallagher)
- Replace all references to the 'master' branch (Stephen Gallagher)
- CI: Fix installation of dependencies on openSUSE Tumbleweed (Neal Gompa)
- Drop custom valgrind test (Stephen Gallagher)
- Correct some typographical errors. (Peter Pentchev)
- Bump version in meson.build to 2.9.5 (Stephen Gallagher)
* Wed Nov 04 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.4-1.20201104134948550293.sourcegit.31.g3d6c829
- Fix README (Stephen Gallagher)
- Enable source-git functionality for Fedora (Stephen Gallagher)
- Tools: Tag with bare version as well (Stephen Gallagher)
- Do not treat OpenMandriva tests as blocking (Stephen Gallagher)
- Enhance the travis build scripts and Dockerfile templates so that the common mmd_run_docker_tests() launcher function can also launch the Coverity scan. This enhancement made it a simple matter to switch the Coverity scan to run on CentOS 8 instead of Fedora. (Merlin Mathesius)
- Clarify difference between MMD_YAML_ERROR_UNPARSEABLE and MMD_YAML_ERROR_PARSE (Merlin Mathesius)
- Add tests for modulemd_load_string() (Merlin Mathesius)
- TRAVIS: Bump Fedora version used for Coverity scan (Merlin Mathesius)
- Address detected Coverity scan defects (Merlin Mathesius)
- Update documentation with eols and 2.10 index (Aleš Matěj)
- Convert modulemd-obsoletes dates to ISO 8601 format (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module-index/merger (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module (Aleš Matěj)
- Add modulemd-obsoletes to modulemd-module-stream (Aleš Matěj)
- Add modulemd-obsoletes (Aleš Matěj)
- Add convenience functions for loading the index (Stephen Gallagher)
- Update python formatting with python-black 20.8 (Stephen Gallagher)
- Fix incorrect error type (Stephen Gallagher)
- Update test for newer bash versions (Stephen Gallagher)
- Correct typo in documentation (Stephen Gallagher)
- TRAVIS: Add Fedora 33 to test hosts (Stephen Gallagher)
- Disable LTO (Stephen Gallagher)
- Create rpmbuild directory (Stephen Gallagher)
- fixup! validator: Add support for compressed YAML (Stephen Gallagher)
- validator: Add support for compressed YAML (Stephen Gallagher)
- Docs must be on the 'master' branch due to Github limitations (Stephen Gallagher)
- Replace all references to the 'master' branch (Stephen Gallagher)
- CI: Fix installation of dependencies on openSUSE Tumbleweed (Neal Gompa)
- Drop custom valgrind test (Stephen Gallagher)
- Correct some typographical errors. (Peter Pentchev)
- Bump version in meson.build to 2.9.5 (Stephen Gallagher)
* Wed May 20 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.4-1
- new upstream release: 2.9.4
* Wed May 20 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.4-2.9.300520.1gitgc19757c
- new upstream release: 2.9.4
* Wed Apr 08 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.3-1
- new upstream release: 2.9.3
* Wed Apr 01 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.2-4
- Skip rpmdeplint from gating due to https://github.com/fedora-infra/bodhi/issues/3944
* Wed Apr 01 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.2-3
- Fix build against Python 3.9
- Resolves: rhbz#1817665
* Wed Mar 11 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.2-2
- new upstream release: 2.9.2
* Wed Mar 11 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.2-0.20200311.1gitg31bbd4e
- new upstream release: 2.9.2
* Wed Mar 11 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.2-0.20200311.1gitg31bbd4e
- new upstream release: 2.9.2
* Fri Feb 14 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.1-1
- new upstream release: 2.9.1
* Wed Feb 12 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.9.0-1
- new upstream release: 2.9.0
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jan 09 2020 Stephen Gallagher <sgallagh@redhat.com> - 2.8.3-1
- Update to 2.8.3
- Fix compilation issue with glib >= 2.63.3
- Improved modulemd document validation
- Numerous test enhancements
* Thu Oct 24 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.8.2-1
- Update to 2.8.2
- Use safer version of dup()
- Fix loading of YAML module stream with no module or stream name
* Tue Oct 15 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.8.1-1
- Improve the merge logic to handle third-party repos more sanely
* Wed Sep 18 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.8.0-2
- Improvements to ModuleIndex.update_from_defaults_directory()
* Import each file in the directory as a merge rather than an overwrite so
we can detect conflicts.
* Modify the meaning of the 'strict' argument to fail if the merge would
result in a conflict in the default stream setting of a module.
* Wed Sep 04 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.8.0-1
- Update to 2.8.0
- API Changes
* Add Modulemd.Module.get_translation() - Retrieve the translations
associated with a Modulemd.Module
* Add ModuleIndex.update_from_defaults_directory() - Import defaults from a
directory of yaml documents, such as fedora-module-defaults, optionally
providing a second path containing overrides.
- Enhancements
* Modulemd.ModuleIndex.update_from_file() now supports reading files
compressed with gzip, bzip2 or xz. (Issue: #208)
* Documentation updates
- Bugfixes
* Assorted minor issues discovered by static analysis tools.
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.0-2
- Rebuilt for Python 3.8
* Thu Aug 15 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.7.0-1
- Update to 2.7.0
- Drop libmodulemd1 subpackage which is now packaged separately
- Add support for 'buildroot' and 'srpm-buildroot' arguments to components
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jul 03 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.6.0-1
- Update to 2.6.0
- New function ModuleIndexMerger.resolve_ext() allowing for strict merging
- Profile.get_description() now properly returns available translations
- Numerous documentation fixes
- Test improvements
* Wed May 29 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.5.0-2
- Fix memory issue with Module.search_streams() in the python bindings
* Wed May 22 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.5.0-1
- Update to 2.5.0 and 1.8.11
- Ensure that XMD is always emitted in the same order
- Add .clear_*() functions for all .add_*() functions
- Add ModuleStream.equals()
- Add ModuleIndex.get_default_streams()
* Mon May 13 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.4.0-1
- Update to 2.4.0 and 1.8.10
- Add ModuleStreamV2.clear_dependencies() and .remove_dependencies()
- Fix bugs and memory issues with the XMD python bindings
- Assorted documentation enhancements
* Fri May 03 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.3.1-1
- Update to 2.3.1
- Make Modulemd.Component.set_*() functions accept NULL
- Fix segmentation fault in XMD code due to improper memory management
- Fix incompatibility in python2-libmodulemd GObject overrides
- Fix assorted documentation issues
* Mon Apr 22 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.3.0-1
- Add ModuleIndex.update_from_custom()
- Add ModuleIndex.dump_to_custom()
- Add Component.equals()
- Add Module.remove_streams_by_NSVCA()
- Fix bug with emitting lists of scalars in XMD
- Fix bug with deduplication in the ModuleIndexMerger
- Fix serious memory leak
* Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 2.2.3-3
- Rebuild with Meson fix for #1699099
* Wed Apr 03 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.3-2
- Fix accidental ABI break
* Mon Apr 01 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.3-1
- Update to 2.2.3 and 1.8.6
- Fix header issue with ModulemdRpmMapEntry
* Wed Mar 27 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.2-2
- Don't run tests on armv7hl/aarch64 since they have timeout problems
* Wed Mar 27 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.2-1
- Update to libmodulemd 2.2.2
- Add support for python2 on RHEL and Fedora < 31
- Make python subpackages archful for GObject overrides
* Tue Mar 26 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.1-1
- Update to libmodulemd 2.2.1
- Fixes builds on i686
- Fixes an accidental API error
* Tue Mar 26 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.2.0-1
- Update to libmodulemd 2.2.0
- Support for RPM checksums
- Adds a new directive: "buildafter" for specifying build dependencies
- Adds a new directive: "buildonly" to indicate that a component's built
artifacts should be listed in the "filter" field.
- Deprecate lookup functions by NSVC in favor of NSVCA (including the
architecture.
* Fri Mar 01 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.1.0-4
- Don't run tests on 32-bit ARM due to performance issues causing timeouts
* Fri Mar 01 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.1.0-3
- Have python3-libmodulemd1 properly Obsolete libmodulemd and
python3-libmodulemd < 2.
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jan 26 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.1.0-1
- Update to libmodulemd 2.1.0 and 1.8.2
- Drop upstreamed patches
- Add new API ModuleStream.depends_on_stream() and
ModuleStream.build_depends_on_stream() to help support auto-detection of
when a module stream may need to be rebuilt when its dependencies change.
- Don't fail merges when default streams differ, treat it as "no default for
this module"
- Fix error message
- Copy modified value when copying Modulemd.Defaults objects
- Fixes discovered by clang and coverity static analysis tools
- Test improvements
* Fri Jan 11 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.0.0-3
- Fix ordering issue with dependencies
- Use glib2 suppression file when running valgrind tests
* Fri Jan 11 2019 Stephen Gallagher <sgallagh@redhat.com> - 2.0.0-2
- Fix issue reading modified value for defaults from YAML streams
* Thu Dec 13 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.0.0-1
- Update to 2.0.0 final
- Assorted fixes for validation
- Add modulemd-validator tool based on v2 code
- Fix a crash when merging defaults
* Tue Dec 11 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.0.0-0.beta2
- Update to 2.0.0beta2
- Better validation of stored content during read and write operations
- ModuleIndex now returns FALSE if any subdocument fails
- Fix tests on 32-bit platforms
- Make unknown keys in YAML maps non-fatal for libmodulemd1
- Make unknown keys in YAML maps optionally fatal for libmodulemd 2.x
- Fix RPM version requirements for libmodulemd1
* Mon Dec 10 2018 Stephen Gallagher <sgallagh@redhat.com> - 2.0.0-0.beta1
- Update to 2.0.0beta1
- Total rewrite to 2.0 API
- https://sgallagh.fedorapeople.org/docs/libmodulemd/2.0/
* Fri Oct 26 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.7.0-1
- Update to 1.7.0
- Enhance YAML parser for use with `fedmod lint`
- Support running unit tests against installed packages
- Include all NSVCs for ModuleStreams in ImprovedModule
* Tue Sep 18 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.4-1
- Update to 1.6.4.
- Add Buildopts to the documentation.
- Deduplicate module streams when merging.
- Drop upstreamed patches.
* Thu Sep 06 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.3-2
- Fix generation of module component YAML
- Output NSVC information using decimal version
* Tue Sep 04 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.3-1
- Update to 1.6.3
- Drop upstreamed patch
- Don't return ModuleStream objects from modulemd_module_new_all_from_*_ext()
- Ensure that Component buildorder property is signed
- Work around optimization bug
- Don't crash dumping translation events without summary or desc
* Thu Aug 09 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.2-2
- Fix backwards-incompatible API change
- Resolves: rhbz#1607083
* Tue Aug 07 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.2-1
- Update to 1.6.2
- Make buildorder a signed integer to match modulemd specification
* Mon Jul 23 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.1-2
- Obsolete unsupported pythonX-modulemd packages
* Fri Jul 20 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.1-1
- Update to 1.6.1
- Fix header include ordering
- Suppress empty sections from .dump() ordering
* Wed Jul 18 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.0-1
- Update to 1.6.0
- Adds Modulemd.ModuleStream object, deprecating Modulemd.Module
- Adds Modulemd.Translation and Modulemd.TranslationEntry objects
- Adds Modulemd.ImprovedModule object that collects streams, defaults and
translations together
- Adds new Modulemd.index_from_*() funtions to get a hash table of
Modulemd.ImprovedModule objects for easier searching
- Moves function documentation to the public headers
- Corrects the license headers to MIT (they were incorrectly listed as MITNFA
in previous releases)
- Makes the "eol" field optional for Modulemd.ServiceLevel
- Clean up HTML documentation
- Fixes a type error on 32-bit systems
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Sat Jun 23 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.5.2-1
- Update to libdmodulemd 1.5.2
- Don't free uninitialized memory
* Fri Jun 22 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.5.1-2
- Fix buildopts property not being initialized
* Tue Jun 19 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.5.1-1
- Update to version 1.5.1
- Re-enable build-time tests
* Mon Jun 18 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.5.0-2
- Temporarily disable build-time tests
* Mon Jun 18 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.5.0-1
- Update to version 1.5.0
- Adds support for "intents" in Modulemd.Defaults
- Adds `Modulemd.get_version()`
- Adds support for RPM whitelists in the buildopts
- Adds a new object: Modulemd.Buildopts
- Deprecates Modulemd.Module.get_rpm_buildopts()
- Deprecates Modulemd.Module.set_rpm_buildopts()
- Fixes some missing license blurbs
* Tue May 08 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.4.1-1
- Update to version 1.4.1
- Improve output from modulemd-validator
- Drop upstreamed patches
* Wed Apr 25 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.4.0-2
- Fix pointer math error
- Fix compilation failure in Fedora build system
* Wed Apr 25 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.4.0-1
- Update to version 1.4.0
- Adds new API for returning failed YAML subdocuments
- Stop emitting log messages by default (polluting consumer logs)
- Validate RPM artifacts for proper NEVRA format
- Improve the validator tool
- Drop upstreamed patch
* Mon Apr 16 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.3.0-2
- Fix serious error in modulemd-defaults emitter
* Fri Apr 13 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.3.0-1
- Update to version 1.3.0
- New Public Objects:
* Modulemd.Prioritizer - tool to merge module defaults
- New Public Functions:
* Modulemd.SimpleSet.is_equal()
* Modulemd.Defaults.copy()
* Modulemd.Defaults.merge()
* Wed Apr 04 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.2.0-1
- Update to version 1.2.0
- New Functions:
* Modulemd.objects_from_file()
* Modulemd.objects_from_string()
* Modulemd.dump()
* Modulemd.dumps()
* Modulemd.Defaults.new_from_file()
* Modulemd.Defaults.new_from_string()
- Deprecated Functions:
* Modulemd.Module.new_all_from_file()
* Modulemd.Module.new_all_from_file_ext()
* Modulemd.Module.new_all_from_string()
* Modulemd.Module.new_all_from_string_ext()
* Modulemd.Module.dump_all()
* Modulemd.Module.dumps_all()
- Bugfixes
* Properly use G_BEGIN_DECLS and G_END_DECLS in headers
* Assorted fixes for memory ownership in GObject Introspection
* Fri Mar 23 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.1.3-2
- Fix missing G_END_DECL from public headers
* Mon Mar 19 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.1.3-1
- Fix numerous memory leaks
- Drop upstreamed patch
* Thu Mar 15 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.1.2-1
- Update to version 1.1.2
- Revert backwards-incompatible API change
- Fix version string in pkgconfig file
* Thu Mar 15 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.1.1-1
- Update to version 1.1.1
- Make default stream and profiles optional
- Fixes: https://github.com/fedora-modularity/libmodulemd/issues/25
- Fixes: https://github.com/fedora-modularity/libmodulemd/issues/26
- Fixes: https://github.com/fedora-modularity/libmodulemd/issues/27
* Wed Mar 14 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.1.0-1
- Update to version 1.1.0
- Adds support for handling modulemd-defaults YAML documents
- Adds peek()/dup() routines to all object properties
- Adds Modulemd.Module.dup_nsvc() to retrieve the canonical form of the unique module identifier.
- Adds support for boolean types in the XMD section
- Revert obsoletion of pythonX-modulemd packages for now
* Tue Mar 13 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.0.4-2
- Obsolete unsupported pythonX-modulemd packages
* Tue Feb 27 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.0.4-1
- Update to 1.0.4
- Rework version autodetection
- Avoid infinite loop on unparseable YAML
* Sun Feb 25 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.0.3-1
- RPM components are properly emitted when no module components exist
- Parser works around late determination of modulemd version
* Fri Feb 16 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.0.2-1
- Be more strict with certain parser edge-cases
- Replace popt argument processing with glib
- Drop upstreamed patches
* Thu Feb 15 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.0.1-2
- Handle certain unlikely format violations
* Thu Feb 15 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.0.1-1
- Support modulemd v2
- Add tool to do quick validation of modulemd
- Fix memory management
- Warn and ignore unparseable sub-documents in the YAML
- Fix several memory issues detected by Coverity scan
* Tue Feb 06 2018 Stephen Gallagher <sgallagh@redhat.com> - 0.2.2-1
- Update to libmodulemd 0.2.2
- Fix numerous minor memory leaks
- Fix issues with EOL/SL dates
* Tue Feb 06 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.2.1-3
- Own appropriate directories
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.2.1-2
- Switch to %%ldconfig_scriptlets
* Fri Jan 05 2018 Stephen Gallagher <sgallagh@redhat.com> - 0.2.1-1
- Update to libmodulemd 0.2.1
- Add 'name' property for Profiles
* Thu Oct 05 2017 Stephen Gallagher <sgallagh@redhat.com> - 0.2.0-2
- Add missing BuildRequires for gtk-doc
* Thu Oct 05 2017 Stephen Gallagher <sgallagh@redhat.com> - 0.2.0-1
- Update to libmodulemd 0.2.0
- Adds gtk-doc generated documentation
- (ABI-break) Makes all optional properties accept NULL as a value to clear
them
- (ABI-break) Modulemd.SimpleSet takes a STRV (char **) instead of a
GLib.PtrArray
- Fixes a bug where the name was not always set for components
- Adds support for dumping YAML from the introspected API
- Includes add/remove routines for profiles
* Sat Sep 30 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.0-5
- Use %%_isa in Requires for main package from devel
* Mon Sep 18 2017 Stephen Gallagher <sgallagh@redhat.com> - 0.1.0-4
- Correct the license to MIT
* Mon Sep 18 2017 Stephen Gallagher <sgallagh@redhat.com> - 0.1.0-3
- Modifications requested during package review
* Fri Sep 15 2017 Stephen Gallagher <sgallagh@redhat.com> - 0.1.0-2
- First public release

View file

@ -0,0 +1 @@
SHA512 (modulemd-2.9.4.tar.xz) = f1feec56507cf294ce01a24b77fb851671d331408ecf7dd453eb2b39dc5eb5548b6376b6b1b8e5ccbc75503e1260651e8c1995e2d3b29830e1c322451f861a11

View file

@ -0,0 +1,32 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- hosts: localhost
tags:
- classic
tasks:
- name: Make sure fedpkg and selinux bindings are installed
shell: dnf -y install fedpkg python{2,3}-libselinux libmodulemd-devel --skip-broken
- name: Copy spec file to remote machine
copy:
src: "{{ playbook_dir }}/../libmodulemd.spec"
dest: /tmp/libmodulemd.spec
- name: Install build deps
shell: dnf -y build-dep /tmp/libmodulemd.spec
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- build:
dir: .
run: meson -Dtest_installed_lib=true -Ddeveloper_build=false source
- unittests:
dir: .
run: ninja test

View file

@ -0,0 +1,168 @@
%if 0%{?rhel} && 0%{?rhel} <= 7
%global meson_python_flags -Dwith_py2=true
%global build_python2 1
%else
%global meson_python_flags -Dwith_py2=false
%global build_python2 0
%endif
%global upstream_name libmodulemd
%if (0%{?rhel} && 0%{?rhel} <= 7)
%global v2_suffix 2
%endif
# Rawhide builds currently fail when building with LTO
%define _lto_cflags %{nil}
Name: %{upstream_name}%{?v2_suffix}
Version: @VERSION@
Release: @RELEASE@
Summary: Module metadata manipulation library
License: MIT
URL: https://github.com/fedora-modularity/libmodulemd
Source0: %{url}/releases/download/%{upstream_name}-%{version}/modulemd-%{version}.tar.xz
BuildRequires: meson >= 0.47
BuildRequires: pkgconfig
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(yaml-0.1)
BuildRequires: pkgconfig(gtk-doc)
BuildRequires: glib2-doc
BuildRequires: rpm-devel
BuildRequires: file-devel
%if %{build_python2}
BuildRequires: python2-devel
BuildRequires: python-gobject-base
%endif
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-gobject-base
BuildRequires: help2man
# Patches
%description
C Library for manipulating module metadata files.
See https://github.com/fedora-modularity/libmodulemd/blob/master/README.md for
more details.
%if %{build_python2}
%package -n python2-%{name}
Summary: Python 2 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python-gobject-base
Requires: python-six
%description -n python2-%{name}
Python 2 bindings for %{name}
%endif
%package -n python%{python3_pkgversion}-%{name}
Summary: Python 3 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}-gobject-base
%if (0%{?rhel} && 0%{?rhel} <= 7)
# The py3_dist macro on EPEL 7 doesn't work right at the moment
Requires: python3.6dist(six)
%else
Requires: %{py3_dist six}
%endif
%description -n python%{python3_pkgversion}-%{name}
Python %{python3_pkgversion} bindings for %{name}
%package devel
Summary: Development files for libmodulemd
Requires: %{name}%{?_isa} = %{version}-%{release}
%if (0%{?rhel} && 0%{?rhel} <= 7)
Conflicts: libmodulemd1-devel
Conflicts: libmodulemd-devel
%endif
%description devel
Development files for libmodulemd.
%prep
%autosetup -p1 -n modulemd-%{version}
%build
%meson -Ddeveloper_build=false \
%{meson_python_flags}
%meson_build
%check
export LC_CTYPE=C.utf8
# Don't run tests on ARM for now. There are problems with
# performance on the builders and often these time out.
%ifnarch %{arm} aarch64
# The tests sometimes time out in CI, so give them a little extra time
%{__meson} test -C %{_vpath_builddir} %{?_smp_mesonflags} --print-errorlogs -t 5
%endif
%install
%meson_install
%if ( 0%{?rhel} && 0%{?rhel} <= 7)
# Don't conflict with modulemd-validator from 1.x included in the official
# RHEL 7 repos
mv %{buildroot}%{_bindir}/modulemd-validator \
%{buildroot}%{_bindir}/modulemd-validator%{?v2_suffix}
mv %{buildroot}%{_mandir}/man1/modulemd-validator.1 \
%{buildroot}%{_mandir}/man1/modulemd-validator%{?v2_suffix}.1
%endif
%ldconfig_scriptlets
%files
%license COPYING
%doc README.md
%{_bindir}/modulemd-validator%{?v2_suffix}
%{_mandir}/man1/modulemd-validator%{?v2_suffix}.1*
%{_libdir}/%{upstream_name}.so.2*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/Modulemd-2.0.typelib
%files devel
%{_libdir}/%{upstream_name}.so
%{_libdir}/pkgconfig/modulemd-2.0.pc
%{_includedir}/modulemd-2.0/
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/Modulemd-2.0.gir
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/modulemd-2.0/
%if %{build_python2}
%files -n python2-%{name}
%{python2_sitearch}/gi/overrides/
%endif
%files -n python%{python3_pkgversion}-%{name}
%{python3_sitearch}/gi/overrides/
%changelog

View file

@ -0,0 +1,211 @@
# This file is part of libmodulemd
# Copyright (C) 2017-2018 Stephen Gallagher
#
# 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>.
project(
'modulemd',
'c',
version : '2.10.0',
default_options : ['buildtype=debugoptimized', 'c_std=c11', 'warning_level=1', 'b_asneeded=true'],
license : 'MIT',
meson_version : '>=0.47.0'
)
libmodulemd_version = meson.project_version()
cc = meson.get_compiler('c')
test_cflags = [
'-Wpointer-arith',
'-Werror=missing-declarations',
'-Wmissing-prototypes',
'-Wstrict-prototypes',
'-Wuninitialized',
['-Werror=format-security', '-Werror=format=2'], # Must be checked together
'-Werror=implicit',
'-Werror=init-self',
'-Werror=main',
'-Werror=missing-braces',
'-Werror=return-type',
'-Werror=array-bounds',
'-Werror=write-strings',
'-D_GNU_SOURCE',
'-DG_LOG_USE_STRUCTURED',
'-DG_LOG_DOMAIN="libmodulemd"',
]
foreach cflag: test_cflags
if cc.has_multi_arguments(cflag)
add_project_arguments(cflag, language : 'c')
endif
endforeach
pymod = import('python')
gnome = import('gnome')
pkg = import('pkgconfig')
gobject = dependency('gobject-2.0')
yaml = dependency('yaml-0.1')
with_rpmio = get_option('rpmio')
with_libmagic = get_option('libmagic')
rpm = dependency('rpm', required : with_rpmio)
magic = cc.find_library('magic', required : with_libmagic)
glib = dependency('glib-2.0')
glib_prefix = glib.get_pkgconfig_variable('prefix')
bash = find_program('bash')
sed = find_program('sed')
test = find_program('test')
with_docs = get_option('with_docs')
if with_docs
gtkdoc = dependency('gtk-doc')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
ret = run_command ([test, '-e', join_paths(glib_docpath, 'glib/index.html')])
if ret.returncode() != 0
error('Missing documentation for GLib.')
endif
ret = run_command ([test, '-e', join_paths(glib_docpath, 'gobject/index.html')])
if ret.returncode() != 0
error('Missing documentation for GObject.')
endif
endif
with_manpages = get_option('with_manpages')
help2man = find_program('help2man', required: with_manpages)
if not help2man.found()
help2man = disabler()
endif
# Check whether this version of glib has the GDate autoptr defined
gdate_check = '''#include <glib.h>
int main (int argc, char **argv)
{
g_autoptr(GDate) date = NULL;
return 0;
}
'''
has_gdate_autoptr = cc.compiles(
gdate_check,
dependencies : [ glib ],
name : 'g_autoptr(GDate)')
# Check whether glib2 has g_ptr_array_extend_and_steal or if we
# need to bundle it.
has_extend_and_steal = cc.has_function(
'g_ptr_array_extend_and_steal',
dependencies : [ glib ])
python_name = get_option('python_name')
if python_name != ''
# If we've been instructed to use a specific python version
python3 = pymod.find_installation(python_name)
else
# Use the python installation that is running meson
python3 = pymod.find_installation()
endif
with_py2 = get_option('with_py2')
if with_py2
python2 = pymod.find_installation('python2')
else
python2 = disabler()
endif
rpm_cdata = configuration_data()
rpm_cdata.set('VERSION', meson.project_version())
rpm_cdata.set('BUILDFLAG', '-bb')
srpm_cdata = configuration_data()
srpm_cdata.set('VERSION', meson.project_version())
srpm_cdata.set('BUILDFLAG', '-bs')
subdir('modulemd')
subdir('bindings/python')
if meson.version().version_compare('>=0.53')
if magic.found()
if with_libmagic.enabled()
magic_status = 'Enabled'
elif with_libmagic.auto()
magic_status = 'Enabled (autodetected)'
else
error('libmagic state is unknown')
endif
else
if with_libmagic.disabled()
magic_status = 'Disabled'
elif with_libmagic.auto()
magic_status = 'Disabled (autodetection could not locate libmagic)'
else
error('libmagic state is unknown')
endif
endif
if rpm.found()
if with_rpmio.enabled()
rpmio_status = 'Enabled'
elif with_rpmio.auto()
rpmio_status = 'Enabled (autodetected)'
else
error('rpmio state is unknown')
endif
else
if with_rpmio.disabled()
rpmio_status = 'Disabled'
elif with_rpmio.auto()
rpmio_status = 'Disabled (autodetection could not locate librpm)'
else
error('rpmio state is unknown')
endif
endif
if help2man.found()
if with_manpages.enabled()
manpages_status = 'Enabled'
elif with_manpages.auto()
manpages_status = 'Enabled (autodetected)'
else
error('manpages state is unknown')
endif
else
if with_manpages.disabled()
manpages_status = 'Disabled'
elif with_rpmio.auto()
manpages_status = 'Disabled (autodetection could not locate help2man)'
else
error('manpages state is unknown')
endif
endif
summary({'prefix': get_option('prefix'),
'bindir': get_option('bindir'),
'libdir': get_option('libdir'),
'datadir': get_option('datadir'),
'Python 2 GObject Overrides': gobject_overrides_dir_py2,
'Python 3 GObject Overrides': gobject_overrides_dir_py3
}, section: 'Directories')
summary({'Developer Build': get_option('developer_build'),
'libmagic Support': magic_status,
'Custom Python': get_option('python_name'),
'RPMIO Support': rpmio_status,
'Generate Manpages': manpages_status,
'Generate HTML Documentation': get_option('with_docs'),
'Python 2 Support': get_option('with_py2'),
'Skip Formatters': skip_formatters,
'Skip Introspection': get_option('skip_introspection'),
'Test Dirty Git': get_option('test_dirty_git'),
'Test Installed Library': get_option('test_installed_lib'),
}, section: 'Build Configuration')
endif

View file

@ -0,0 +1,51 @@
# This file is part of libmodulemd
# Copyright (C) 2017-2018 Stephen Gallagher
#
# 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>.
#
# REMEMBER TO UPDATE THE SUMMARY() IN meson.build when adding options here
option('developer_build', type : 'boolean', value : true,
description : 'Enables automatic code formatters and memory leak checks. This option should be set to FALSE for release builds.')
option('libmagic', type : 'feature', value : 'enabled',
description : 'Enables the use of libmagic to detect compression of YAML files.')
option('python_name', type : 'string',
description : 'The name of the Python 3 interpreter to use for generating Python bindings and running tests. If left blank, it defaults to the version of Python 3 being used to run meson.')
option('rpmio', type : 'feature', value : 'enabled',
description : 'Use the rpmio library to automatically decompress gzip, bzip2 and xz YAML streams.')
option('skip_formatters', type : 'boolean', value : false,
description : 'Do not do any automatic formatting of source code.')
option('skip_introspection', type : 'boolean', value : false,
description : 'Do not generate GObject Introspection data.')
option('test_dirty_git', type : 'boolean', value : false,
description : 'Check whether the automatic formatting tools have made changes. Used during CI to verify coding style compliance.')
option('test_installed_lib', type : 'boolean', value : false,
description : 'Build only the test suite and run it against a copy of libmodulemd installed on the local system.')
option('with_docs', type : 'boolean', value : true,
description : 'Build API documentation.')
option('with_manpages', type : 'feature', value : 'auto',
description : 'Build manual pages for included executables.')
option('with_py2', type : 'boolean', value : false,
description : 'Build Python 2 language bindings and run Python 2 tests.')
option('gobject_overrides_dir_py2', type : 'string',
description : 'Path to Python 2 PyGObject overrides directory. Leave empty to determine it automatically.')
option('gobject_overrides_dir_py3', type : 'string',
description : 'Path to Python 3 PyGObject overrides directory. Leave empty to determine it automatically.')

View file

@ -0,0 +1,4 @@
#!/bin/sh
$1 --version | awk '/LLVM version/ {print $NF}' -

View file

@ -0,0 +1,201 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-buildopts
* @title: Modulemd.Buildopts
* @stability: stable
* @short_description: Provides hints to the build-system on how to build this module.
*/
#define MODULEMD_TYPE_BUILDOPTS (modulemd_buildopts_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdBuildopts, modulemd_buildopts, MODULEMD, BUILDOPTS, GObject)
/**
* modulemd_buildopts_new:
*
* Returns: (transfer full): A newly-allocated #ModulemdBuildopts object. This
* object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdBuildopts *
modulemd_buildopts_new (void);
/**
* modulemd_buildopts_equals:
* @self_1: A #ModulemdBuildopts object.
* @self_2: A #ModulemdBuildopts object.
*
* Check for equality for two #ModulemdBuildopts objects.
*
* Returns: TRUE if both objects are equal, FALSE otherwise.
*
* Since: 2.2
*/
gboolean
modulemd_buildopts_equals (ModulemdBuildopts *self_1,
ModulemdBuildopts *self_2);
/**
* modulemd_buildopts_copy:
* @self: This #ModulemdBuildopts object.
*
* Create a copy of this #ModulemdBuildopts object.
*
* Returns: (transfer full): A newly-allocated #ModulemdBuildopts object that
* is a copy of @self.
*
* Since: 2.0
*/
ModulemdBuildopts *
modulemd_buildopts_copy (ModulemdBuildopts *self);
/**
* modulemd_buildopts_set_rpm_macros:
* @self: This #ModulemdBuildopts object.
* @rpm_macros: A string containing RPM build macros in the form that they
* would appear in an RPM macros file on-disk.
*
* Since: 2.0
*/
void
modulemd_buildopts_set_rpm_macros (ModulemdBuildopts *self,
const gchar *rpm_macros);
/**
* modulemd_buildopts_get_rpm_macros:
* @self: This #ModulemdBuildopts object.
*
* Returns: (transfer none): A string containing RPM build macros in the form
* that they would appear in an RPM macros file on-disk.
*
* Since: 2.0
*/
const gchar *
modulemd_buildopts_get_rpm_macros (ModulemdBuildopts *self);
/**
* modulemd_buildopts_add_rpm_to_whitelist:
* @self: This #ModulemdBuildopts object.
* @rpm: An RPM name to add to the whitelist.
*
* Since: 2.0
*/
void
modulemd_buildopts_add_rpm_to_whitelist (ModulemdBuildopts *self,
const gchar *rpm);
/**
* modulemd_buildopts_remove_rpm_from_whitelist:
* @self: This #ModulemdBuildopts object.
* @rpm: An RPM name to remove from the whitelist.
*
* Since: 2.0
*/
void
modulemd_buildopts_remove_rpm_from_whitelist (ModulemdBuildopts *self,
const gchar *rpm);
/**
* modulemd_buildopts_clear_rpm_whitelist:
* @self: This #ModulemdBuildopts object.
*
* Remove all RPMs from the whitelist.
*
* Since: 2.5
*/
void
modulemd_buildopts_clear_rpm_whitelist (ModulemdBuildopts *self);
/**
* modulemd_buildopts_get_rpm_whitelist_as_strv: (rename-to modulemd_buildopts_get_rpm_whitelist)
* @self: This #ModulemdBuildopts object.
*
* Returns: (transfer full): An ordered #GStrv list of all RPMs in the whitelist.
*
* Since: 2.0
*/
GStrv
modulemd_buildopts_get_rpm_whitelist_as_strv (ModulemdBuildopts *self);
/**
* modulemd_buildopts_add_arch:
* @self: This #ModulemdBuildopts object.
* @arch: An architecture for which to build this module.
*
* Restrict the list of architectures for which to build this module. It may be
* called any number of times to indicate support on additional architectures.
* Use modulemd_buildopts_clear_arches() to return to "all architectures".
*
* Since: 2.9
*/
void
modulemd_buildopts_add_arch (ModulemdBuildopts *self, const gchar *arch);
/**
* modulemd_buildopts_remove_arch:
* @self: This #ModulemdBuildopts object.
* @arch: An architecture to remove from the list of architectures for which to
* build this module.
*
* Since: 2.9
*/
void
modulemd_buildopts_remove_arch (ModulemdBuildopts *self, const gchar *arch);
/**
* modulemd_buildopts_clear_arches:
* @self: This #ModulemdBuildopts object.
*
* Indicate that this module should be built for all architectures.
*
* Since: 2.9
*/
void
modulemd_buildopts_clear_arches (ModulemdBuildopts *self);
/**
* modulemd_buildopts_get_arches_as_strv: (rename-to modulemd_buildopts_get_arches)
* @self: This #ModulemdBuildopts object.
*
* Returns: (transfer full): A #GStrv list of architectures for which this
* module should be built. If empty, this module should be built for all
* architectures.
*
* Since: 2.9
*/
GStrv
modulemd_buildopts_get_arches_as_strv (ModulemdBuildopts *self);
G_END_DECLS

View file

@ -0,0 +1,96 @@
/*
* 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-component.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-component-module
* @title: Modulemd.ComponentModule
* @stability: stable
* @short_description: A module component that goes into a module stream.
*/
#define MODULEMD_TYPE_COMPONENT_MODULE (modulemd_component_module_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdComponentModule,
modulemd_component_module,
MODULEMD,
COMPONENT_MODULE,
ModulemdComponent)
/**
* modulemd_component_module_new:
* @key: (not nullable): The key of this module component. Used when looking up
* components from a #ModulemdModuleStream.
*
* Returns: (transfer full): A newly-allocated #ModulemdComponentModule object.
*
* Since: 2.0
*/
ModulemdComponentModule *
modulemd_component_module_new (const gchar *key);
/**
* modulemd_component_module_set_ref:
* @self: This #ModulemdComponentModule object.
* @ref: (in) (nullable): The commit ID in the SCM repository.
*
* Since: 2.0
*/
void
modulemd_component_module_set_ref (ModulemdComponentModule *self,
const gchar *ref);
/**
* modulemd_component_module_get_ref:
* @self: This #ModulemdComponentModule object.
*
* Returns: (transfer none): The commit ID in the SCM repository.
*
* Since: 2.0
*/
const gchar *
modulemd_component_module_get_ref (ModulemdComponentModule *self);
/**
* modulemd_component_module_set_repository:
* @self: This #ModulemdComponentModule object.
* @repository: (in) (nullable): The URI of the SCM repository.
*
* Since: 2.0
*/
void
modulemd_component_module_set_repository (ModulemdComponentModule *self,
const gchar *repository);
/**
* modulemd_component_module_get_repository:
* @self: This #ModulemdComponentModule object.
*
* Returns: (transfer none): The URI of the SCM repository.
*
* Since: 2.0
*/
const gchar *
modulemd_component_module_get_repository (ModulemdComponentModule *self);
G_END_DECLS

View file

@ -0,0 +1,281 @@
/*
* 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-component.h"
#include "modulemd-deprecated.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-component-rpm
* @title: Modulemd.ComponentRpm
* @stability: stable
* @short_description: An rpm component that goes into a module stream.
*/
#define MODULEMD_TYPE_COMPONENT_RPM (modulemd_component_rpm_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdComponentRpm,
modulemd_component_rpm,
MODULEMD,
COMPONENT_RPM,
ModulemdComponent)
/**
* modulemd_component_rpm_new:
* @key: (not nullable): The key of this module component. Used when looking up
* components from a #ModulemdModuleStream.
*
* Returns: (transfer full): A newly-allocated #ModulemdComponentRpm object.
*
* Since: 2.0
*/
ModulemdComponentRpm *
modulemd_component_rpm_new (const gchar *key);
/**
* modulemd_component_rpm_add_restricted_arch:
* @self: This #ModulemdComponentRpm object.
* @arch: An architecture on which this package should be available.
*
* Restrict the list of architectures on which this RPM will be available. It
* may be called any number of times to indicate support on additional
* architectures. Use modulemd_component_rpm_clear_arches() to return to "all
* architectures".
*
* Since: 2.0
*/
void
modulemd_component_rpm_add_restricted_arch (ModulemdComponentRpm *self,
const gchar *arch);
/**
* modulemd_component_rpm_reset_arches:
* @self: This #ModulemdComponentRpm object.
*
* Indicate that this RPM component is available on all arches.
*
* Since: 2.0
* Deprecated: 2.9: Use modulemd_component_rpm_clear_arches() instead.
*/
MMD_DEPRECATED_FOR (modulemd_component_rpm_clear_arches)
void
modulemd_component_rpm_reset_arches (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_clear_arches:
* @self: This #ModulemdComponentRpm object.
*
* Indicate that this RPM component is available on all arches.
*
* Since: 2.9
*/
void
modulemd_component_rpm_clear_arches (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_get_arches_as_strv: (rename-to modulemd_component_rpm_get_arches)
* @self: This #ModulemdComponentRpm object.
*
* Returns: (transfer full): A #GStrv list of architectures on which this RPM
* should be available.
*
* Since: 2.0
*/
GStrv
modulemd_component_rpm_get_arches_as_strv (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_add_multilib_arch:
* @self: This #ModulemdComponentRpm object.
* @arch: An architecture on which this package should be multilib.
*
* Add an architecture on which this RPM will be multilib. It may be called
* any number of times. Use modulemd_component_rpm_clear_multilib_arches() to
* return to "no architectures".
*
* Since: 2.0
*/
void
modulemd_component_rpm_add_multilib_arch (ModulemdComponentRpm *self,
const gchar *arch);
/**
* modulemd_component_rpm_reset_multilib_arches:
* @self: This #ModulemdComponentRpm object.
*
* Indicate that this RPM component is multilib on no architectures.
*
* Since: 2.0
* Deprecated: 2.9: Use modulemd_component_rpm_clear_multilib_arches() instead.
*/
MMD_DEPRECATED_FOR (modulemd_component_rpm_clear_multilib_arches)
void
modulemd_component_rpm_reset_multilib_arches (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_clear_multilib_arches:
* @self: This #ModulemdComponentRpm object.
*
* Indicate that this RPM component is multilib on no architectures.
*
* Since: 2.9
*/
void
modulemd_component_rpm_clear_multilib_arches (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_get_multilib_arches_as_strv: (rename-to modulemd_component_rpm_get_multilib_arches)
* @self: This #ModulemdComponentRpm object.
*
* Returns: (transfer full): A #GStrv list of architectures on which multilib
* should be available.
*
* Since: 2.0
*/
GStrv
modulemd_component_rpm_get_multilib_arches_as_strv (
ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_set_cache:
* @self: This #ModulemdComponentRpm object.
* @cache: (in) (nullable): The lookaside cache URL.
*
* Since: 2.0
*/
void
modulemd_component_rpm_set_cache (ModulemdComponentRpm *self,
const gchar *cache);
/**
* modulemd_component_rpm_get_cache:
* @self: This #ModulemdComponentRpm object.
*
* Returns: (transfer none): The lookaside cache URL.
*
* Since: 2.0
*/
const gchar *
modulemd_component_rpm_get_cache (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_set_ref:
* @self: This #ModulemdComponentRpm object.
* @ref: (in) (nullable): The commit ID in the SCM repository.
*
* Since: 2.0
*/
void
modulemd_component_rpm_set_ref (ModulemdComponentRpm *self, const gchar *ref);
/**
* modulemd_component_rpm_get_ref:
* @self: This #ModulemdComponentRpm object.
*
* Returns: (transfer none): The commit ID in the SCM repository.
*
* Since: 2.0
*/
const gchar *
modulemd_component_rpm_get_ref (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_set_repository:
* @self: This #ModulemdComponentRpm object.
* @repository: (in) (nullable): The URI of the SCM repository.
*
* Since: 2.0
*/
void
modulemd_component_rpm_set_repository (ModulemdComponentRpm *self,
const gchar *repository);
/**
* modulemd_component_rpm_get_repository:
* @self: This #ModulemdComponentRpm object.
*
* Returns: (transfer none): The URI of the SCM repository.
*
* Since: 2.0
*/
const gchar *
modulemd_component_rpm_get_repository (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_set_buildroot:
* @self: This #ModulemdComponentRpm object.
* @buildroot: (in): The #ModulemdComponentRpm:buildroot flag to set for @self.
*
* Since: 2.7
*/
void
modulemd_component_rpm_set_buildroot (ModulemdComponentRpm *self,
gboolean buildroot);
/**
* modulemd_component_rpm_get_buildroot:
* @self: This #ModulemdComponentRpm object.
*
* Returns: The #ModulemdComponentRpm:buildroot flag.
*
* Since: 2.7
*/
gboolean
modulemd_component_rpm_get_buildroot (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_set_srpm_buildroot:
* @self: This #ModulemdComponentRpm object.
* @srpm_buildroot: (in): The #ModulemdComponentRpm:srpm_buildroot flag to set
* for @self.
*
* Since: 2.7
*/
void
modulemd_component_rpm_set_srpm_buildroot (ModulemdComponentRpm *self,
gboolean srpm_buildroot);
/**
* modulemd_component_rpm_get_srpm_buildroot:
* @self: This #ModulemdComponentRpm object.
*
* Returns: The #ModulemdComponentRpm:srpm_buildroot flag.
*
* Since: 2.7
*/
gboolean
modulemd_component_rpm_get_srpm_buildroot (ModulemdComponentRpm *self);
G_END_DECLS

View file

@ -0,0 +1,249 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-component
* @title: Modulemd.Component
* @stability: stable
* @short_description: Pure virtual parent class for components that go into a module stream.
*/
#define MODULEMD_TYPE_COMPONENT (modulemd_component_get_type ())
G_DECLARE_DERIVABLE_TYPE (
ModulemdComponent, modulemd_component, MODULEMD, COMPONENT, GObject)
struct _ModulemdComponentClass
{
GObjectClass parent_class;
ModulemdComponent *(*copy) (ModulemdComponent *self, const gchar *key);
void (*set_name) (ModulemdComponent *self, const gchar *name);
const gchar *(*get_name) (ModulemdComponent *self);
gboolean (*validate) (ModulemdComponent *self, GError **error);
gboolean (*equals) (ModulemdComponent *self_1, ModulemdComponent *self_2);
/* Padding to allow adding up to 7 new virtual functions without
* breaking ABI. */
gpointer padding[7];
};
/**
* modulemd_component_equals:
* @self_1: A #ModulemdComponent object.
* @self_2: A #ModulemdComponent object.
*
* Returns: TRUE, if both the objects are equal. FALSE, otherwise.
*
* Since: 2.3
*/
gboolean
modulemd_component_equals (ModulemdComponent *self_1,
ModulemdComponent *self_2);
/**
* modulemd_component_copy:
* @self: This #ModulemdComponent object.
* @key: (in) (nullable): An optional new key for the copied component which is
* used as the lookup key when this component is attached to a
* #ModulemdModuleStream.
*
* Returns: (transfer full): A newly-allocated copy of @self.
*
* Since: 2.0
*/
ModulemdComponent *
modulemd_component_copy (ModulemdComponent *self, const gchar *key);
/**
* modulemd_component_validate:
* @self: (in): This #ModulemdComponent object.
* @error: (out): A #GError that will return the reason for a validation error.
*
* Verifies that all stored values are internally consistent and that the
* component is sufficiently-complete for emitting. This function is called
* implicitly before attempting to emit the contents.
*
* Returns: TRUE if the #ModulemdComponent passed validation. FALSE and sets
* @error appropriately if validation fails.
*
* Since: 2.2
*/
gboolean
modulemd_component_validate (ModulemdComponent *self, GError **error);
/**
* modulemd_component_add_buildafter:
* @self: This #ModulemdComponent object.
* @key: (in): A key representing another component in the
* #ModulemdModuleStream components map.
*
* Add a build dependency of this component.
*
* Since: 2.2
*/
void
modulemd_component_add_buildafter (ModulemdComponent *self, const gchar *key);
/**
* modulemd_component_clear_buildafter:
* @self: This #ModulemdComponent object.
*
* Remove all buildafter entries for this component.
*
* Since: 2.5
*/
void
modulemd_component_clear_buildafter (ModulemdComponent *self);
/**
* modulemd_component_get_buildafter_as_strv: (rename-to modulemd_component_get_buildafter)
* @self: This #ModulemdComponent object.
*
* Returns: (transfer full): The set of component keys that this component
* depends upon.
*
* Since: 2.2
*/
GStrv
modulemd_component_get_buildafter_as_strv (ModulemdComponent *self);
/**
* modulemd_component_set_buildonly:
* @self: This #ModulemdComponent object.
* @buildonly: Whether this component is used only for building this module. If
* set to TRUE, the build system should add any artifacts produced by this
* component to the data.filters section of the output modulemd.
*
* Since: 2.2
*/
void
modulemd_component_set_buildonly (ModulemdComponent *self, gboolean buildonly);
/**
* modulemd_component_get_buildonly:
* @self: This #ModulemdComponent object.
*
* Returns: TRUE if this component is used only for building this module.
*
* Since: 2.2
*/
gboolean
modulemd_component_get_buildonly (ModulemdComponent *self);
/**
* modulemd_component_set_buildorder:
* @self: This #ModulemdComponent object.
* @buildorder: The order this component should be built relative to others.
*
* Since: 2.0
*/
void
modulemd_component_set_buildorder (ModulemdComponent *self, gint64 buildorder);
/**
* modulemd_component_get_buildorder:
* @self: This #ModulemdComponent object.
*
* Returns: The value of the buildorder.
*
* Since: 2.0
*/
gint64
modulemd_component_get_buildorder (ModulemdComponent *self);
/**
* modulemd_component_set_name:
* @self: This #ModulemdComponent object.
* @name: (nullable): The name of this component. Note that this is different
* from the key used to save this component to a #ModulemdModuleStream. If this
* value is set, it adds a "name:" attribute to this component. This is used in
* bootstrapping cases where the key is a different name used to differentiate
* multiple ordered builds of the same component name. This function is
* currently only implemented for #ModulemdComponentRpm and has no effect on
* other #ModulemdComponent types.
*
* Since: 2.2
*/
void
modulemd_component_set_name (ModulemdComponent *self, const gchar *name);
/**
* modulemd_component_get_name:
* @self: This #ModulemdComponent object.
*
* Returns: (transfer none): The name of the component. Note that this may be
* different from the key used to save this component to a
* #ModulemdModuleStream. If you specifically need the key, use
* modulemd_component_get_key() instead.
*
* Since: 2.0
*/
const gchar *
modulemd_component_get_name (ModulemdComponent *self);
/**
* modulemd_component_get_key:
* @self: This #ModulemdComponent object.
*
* Returns: (transfer none): The name of the key used to attach this component
* to a #ModulemdModuleStream.
*
* Since: 2.2
*/
const gchar *
modulemd_component_get_key (ModulemdComponent *self);
/**
* modulemd_component_set_rationale:
* @self: This #ModulemdComponent object.
* @rationale: (in) (nullable): The reason that this component is part of the
* stream.
*
* Since: 2.0
*/
void
modulemd_component_set_rationale (ModulemdComponent *self,
const gchar *rationale);
/**
* modulemd_component_get_rationale:
* @self: This #ModulemdComponent object.
*
* Returns: (transfer none): The rationale.
*
* Since: 2.0
*/
const gchar *
modulemd_component_get_rationale (ModulemdComponent *self);
G_END_DECLS

View file

@ -0,0 +1,70 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2019 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 <glib.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-compression
* @title: Modulemd Compression Helpers
* @stability: stable
* @short_description: Utility functions for working with compressed files.
*/
/**
* ModulemdCompressionTypeEnum:
* @MODULEMD_COMPRESSION_TYPE_DETECTION_FAILED: Autodetection failure
* @MODULEMD_COMPRESSION_TYPE_UNKNOWN_COMPRESSION: Unknown compression
* @MODULEMD_COMPRESSION_TYPE_NO_COMPRESSION: No compression
* @MODULEMD_COMPRESSION_TYPE_GZ_COMPRESSION: gzip compression
* @MODULEMD_COMPRESSION_TYPE_BZ2_COMPRESSION: bzip2 compression
* @MODULEMD_COMPRESSION_TYPE_XZ_COMPRESSION: LZMA compression
* @MODULEMD_COMPRESSION_TYPE_ZCK_COMPRESSION: zchunk compression
* @MODULEMD_COMPRESSION_TYPE_SENTINEL: Enum list terminator
*
* Since: 2.8
*/
typedef enum
{
MODULEMD_COMPRESSION_TYPE_DETECTION_FAILED = -2,
MODULEMD_COMPRESSION_TYPE_UNKNOWN_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_NO_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_GZ_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_BZ2_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_XZ_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_ZCK_COMPRESSION,
MODULEMD_COMPRESSION_TYPE_SENTINEL,
} ModulemdCompressionTypeEnum;
/**
* modulemd_compression_type:
* @name: (in): The name of the compression type. Valid options are:
* "gz", "gzip", "bz2", "bzip2", "xz" and "zck".
*
* Returns: The #ModulemdCompressionTypeEnum value corresponding to the
* provided string if available or
* #MODULEMD_COMPRESSION_TYPE_UNKNOWN_COMPRESSION if the string does not match
* a known type.
*
* Since: 2.8
*/
ModulemdCompressionTypeEnum
modulemd_compression_type (const gchar *name);
G_END_DECLS

View file

@ -0,0 +1,177 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 Stephen Gallagher
*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-defaults-v1
* @title: Modulemd.DefaultsV1
* @stability: stable
* @short_description: Object representing a defaults document (version 1)
*/
#define MODULEMD_TYPE_DEFAULTS_V1 (modulemd_defaults_v1_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdDefaultsV1,
modulemd_defaults_v1,
MODULEMD,
DEFAULTS_V1,
ModulemdDefaults)
/**
* modulemd_defaults_v1_new:
* @module_name: (in): The name of the module to which these defaults apply.
*
* Returns: (transfer full): A newly-allocated #ModulemdDefaultsV1 object.
*
* Since: 2.0
*/
ModulemdDefaultsV1 *
modulemd_defaults_v1_new (const gchar *module_name);
/**
* modulemd_defaults_v1_set_default_stream:
* @self: (in): This #ModulemdDefaultsV1 object.
* @default_stream: (in) (nullable): The name of the default stream for this
* module. If NULL, it will remove the default stream.
* @intent: (in) (nullable): If non-NULL, this indicates the system-intent to
* apply this default stream. If NULL, it will be added as common defaults.
*
* Set the default stream for this module.
*
* Since: 2.0
*/
void
modulemd_defaults_v1_set_default_stream (ModulemdDefaultsV1 *self,
const gchar *default_stream,
const gchar *intent);
/**
* modulemd_defaults_v1_get_default_stream:
* @self: (in): This #ModulemdDefaultsV1 object.
* @intent: (in) (nullable): The name of the system intent whose default stream
* will be retrieved. If left NULL or the specified intent has no different
* default, it will return the generic default stream for this module.
*
* Returns: (transfer none): The name of the default stream for this module.
*
* Since: 2.0
*/
const gchar *
modulemd_defaults_v1_get_default_stream (ModulemdDefaultsV1 *self,
const gchar *intent);
/**
* modulemd_defaults_v1_get_streams_with_default_profiles_as_strv: (rename-to modulemd_defaults_v1_get_streams_with_default_profiles)
* @self: (in): This #ModulemdDefaultsV1 object.
* @intent: (in) (nullable): The name of the system intent whose stream
* profiles will be retrieved. If left NULL or the specified intent has no
* separate defaults for this module, it will return the generic stream
* profiles.
*
* Returns: (transfer full): A sorted #GStrv list of unique stream names for
* which default profiles have been assigned.
*
* Since: 2.0
*/
GStrv
modulemd_defaults_v1_get_streams_with_default_profiles_as_strv (
ModulemdDefaultsV1 *self, const gchar *intent);
/**
* modulemd_defaults_v1_add_default_profile_for_stream:
* @self: (in): This #ModulemdDefaultsV1 object.
* @stream_name: (in): The name of the module stream to which to add this
* default profile.
* @profile_name: (in): The name of the default profile to add.
* @intent: (in) (nullable): The name of the system intent to add profile
* defaults to. If NULL, this sets the generic fallback profiles for the
* stream.
*
* Add a profile that will be installed for this stream if none are explicitly
* specified by the user. This function may be called any number of times for
* the same stream and will deduplicate input.
*
* Since: 2.0
*/
void
modulemd_defaults_v1_add_default_profile_for_stream (ModulemdDefaultsV1 *self,
const gchar *stream_name,
const gchar *profile_name,
const gchar *intent);
/**
* modulemd_defaults_v1_set_empty_default_profiles_for_stream:
* @self: (in): This #ModulemdDefaultsV1 object.
* @stream_name: (in): The name of the module stream for which to empty
* default profiles.
* @intent: (in) (nullable): The name of the system intent from which to clear
* the profile defaults for this stream.
*
* Sets the default profiles for @stream_name to the empty set. When output to
* a file, it will appear as `stream_name: []`.
*
* Since: 2.0
*/
void
modulemd_defaults_v1_set_empty_default_profiles_for_stream (
ModulemdDefaultsV1 *self, const gchar *stream_name, const gchar *intent);
/**
* modulemd_defaults_v1_remove_default_profiles_for_stream:
* @self: (in): This #ModulemdDefaultsV1 object.
* @stream_name: (in): The name of the module stream from which to remove
* default profiles.
* @intent: (in) (nullable): The name of the system intent from which to remove
* the profile defaults for this stream.
*
* Removes this stream from the list of profiles entirely. It will not appear
* in the output document.
*
* Since: 2.0
*/
void
modulemd_defaults_v1_remove_default_profiles_for_stream (
ModulemdDefaultsV1 *self, const gchar *stream_name, const gchar *intent);
/**
* modulemd_defaults_v1_get_default_profiles_for_stream_as_strv: (rename-to modulemd_defaults_v1_get_default_profiles_for_stream)
* @self: (in): This #ModulemdDefaultsV1 object.
* @stream_name: (in): The name of the string to retrieve the default profiles
* for.
* @intent: (in) (nullable): The name of the system intent from which to
* retrieve the profile defaults for this stream.
*
* Returns: (transfer full): A sorted #GStrv list of unique profiles to be
* installed by default for this stream. NULL, if this stream_name is not
* present in the defaults.
*
* Since: 2.0
*/
GStrv
modulemd_defaults_v1_get_default_profiles_for_stream_as_strv (
ModulemdDefaultsV1 *self, const gchar *stream_name, const gchar *intent);
G_END_DECLS

View file

@ -0,0 +1,197 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 Stephen Gallagher
*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-defaults
* @title: Modulemd.Defaults
* @stability: stable
* @short_description: Parent class for Default documents.
* See #ModulemdDefaultsV1 for a specific type.
*/
/**
* ModulemdDefaultsVersionEnum:
* @MD_DEFAULTS_VERSION_ERROR: Represents an error handling mdversion.
* @MD_DEFAULTS_VERSION_UNSET: Represents an unset mdversion.
* @MD_DEFAULTS_VERSION_ONE: Represents v1 of the #ModulemdDefaults metadata
* format.
* @MD_DEFAULTS_VERSION_LATEST: Represents the highest-supported version of the
* #ModulemdDefaults metadata format.
*
* Since: 2.0
*/
typedef enum
{
MD_DEFAULTS_VERSION_ERROR = -1,
MD_DEFAULTS_VERSION_UNSET = 0,
MD_DEFAULTS_VERSION_ONE = 1,
MD_DEFAULTS_VERSION_LATEST = MD_DEFAULTS_VERSION_ONE,
} ModulemdDefaultsVersionEnum;
#define MODULEMD_TYPE_DEFAULTS (modulemd_defaults_get_type ())
G_DECLARE_DERIVABLE_TYPE (
ModulemdDefaults, modulemd_defaults, MODULEMD, DEFAULTS, GObject)
struct _ModulemdDefaultsClass
{
GObjectClass parent_class;
ModulemdDefaults *(*copy) (ModulemdDefaults *self);
gboolean (*validate) (ModulemdDefaults *self, GError **error);
guint64 (*get_mdversion) (ModulemdDefaults *self);
gboolean (*equals) (ModulemdDefaults *self_1, ModulemdDefaults *self_2);
/* Padding to allow adding up to 9 new virtual functions without
* breaking ABI. */
gpointer padding[9];
};
/**
* modulemd_defaults_new:
* @version: The version of the defaults metadata to create.
* @module_name: The name of the module to which these defaults apply.
*
* Create a new #ModulemdDefaults.
*
* Returns: (transfer full): A newly created #ModulemdDefaults subtype of the
* requested version.
*
* Since: 2.0
*/
ModulemdDefaults *
modulemd_defaults_new (guint64 version, const gchar *module_name);
/**
* modulemd_defaults_copy:
* @self: (in): This #ModulemdDefaults object.
*
* Returns: (transfer full): A newly-allocated copy of @self.
*
* Since: 2.0
*/
ModulemdDefaults *
modulemd_defaults_copy (ModulemdDefaults *self);
/**
* modulemd_defaults_validate:
* @self: (in): This #ModulemdDefaults object.
* @error: (out): A #GError that will return the reason for a validation error.
*
* Returns: TRUE if validation passed, FALSE and sets @error appropriately if
* validation failed.
*
* Since: 2.0
*/
gboolean
modulemd_defaults_validate (ModulemdDefaults *self, GError **error);
/**
* modulemd_defaults_equals:
* @self_1: (in): A #ModulemdDefaults object
* @self_2: (in): A #ModulemdDefaults object
*
* Returns: TRUE if both @self_1 and @self_2 contain equal values, FALSE if they differed.
*
* Since: 2.2
*/
gboolean
modulemd_defaults_equals (ModulemdDefaults *self_1, ModulemdDefaults *self_2);
/**
* modulemd_defaults_upgrade:
* @self: (in): This #ModulemdDefaults object.
* @mdversion: (in): The version to upgrade to.
* @error: (out): A #GError that will return the reason for an upgrade error.
*
* Returns: (transfer full): A newly-allocated copy of @self upgraded to the
* requested defaults version. NULL if the upgrade cannot be performed and sets
* @error appropriately. This function does not modify @self.
*
* Since: 2.0
*/
ModulemdDefaults *
modulemd_defaults_upgrade (ModulemdDefaults *self,
guint64 mdversion,
GError **error);
/**
* modulemd_defaults_get_module_name:
* @self: (in): This #ModulemdDefaults object.
*
* Returns: (transfer none): The name of the module to which these defaults
* apply.
*
* Since: 2.0
*/
const gchar *
modulemd_defaults_get_module_name (ModulemdDefaults *self);
/**
* modulemd_defaults_get_mdversion:
* @self: (in): This #ModulemdDefaults object.
*
* Returns: The metadata version of this defaults object.
*
* Since: 2.0
*/
guint64
modulemd_defaults_get_mdversion (ModulemdDefaults *self);
/**
* modulemd_defaults_set_modified:
* @self: (in): This #ModulemdDefaults object.
* @modified: (in): The last modified time represented as a 64-bit integer
* (such as 201807011200)
*
* Since: 2.0
*/
void
modulemd_defaults_set_modified (ModulemdDefaults *self, guint64 modified);
/**
* modulemd_defaults_get_modified:
* @self: (in): This #ModulemdDefaults object.
*
* Returns: The last modified time represented as a 64-bit integer
* (such as 201807011200)
*
* Since: 2.0
*/
guint64
modulemd_defaults_get_modified (ModulemdDefaults *self);
G_END_DECLS

View file

@ -0,0 +1,222 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-dependencies
* @title: Modulemd.Dependencies
* @stability: stable
* @short_description: Object to represent build-time and runtime dependencies of a module stream.
*/
#define MODULEMD_TYPE_DEPENDENCIES (modulemd_dependencies_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdDependencies, modulemd_dependencies, MODULEMD, DEPENDENCIES, GObject)
/**
* modulemd_dependencies_new:
*
* Returns: (transfer full): A newly-allocated #ModulemdDependencies object.
* This object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdDependencies *
modulemd_dependencies_new (void);
/**
* modulemd_dependencies_equals:
* @self_1: A #ModulemdDependencies object.
* @self_2: A #ModulemdDependencies object.
*
* Check if @self_1 and @self_2 are equal objects.
*
* Returns: TRUE, if the're equal. FALSE, otherwise.
*
* Since: 2.2
*/
gboolean
modulemd_dependencies_equals (ModulemdDependencies *self_1,
ModulemdDependencies *self_2);
/**
* modulemd_dependencies_copy:
* @self: This #ModulemdDependencies object.
*
* Create a copy of this #ModulemdDependencies object.
*
* Returns: (transfer full): The copied #ModulemdDependencies object.
*
* Since: 2.0
*/
ModulemdDependencies *
modulemd_dependencies_copy (ModulemdDependencies *self);
/**
* modulemd_dependencies_add_buildtime_stream:
* @self: This #ModulemdDependencies object.
* @module_name: The name of the module to depend on.
* @module_stream: The name of the module stream to depend on.
*
* Add a single stream of a module that is required to build another dependent
* module. The matrix of streams and module names will be calculated by the
* build-system. If the provided module name is already present, the streams
* will be added (with deduplication).
*
* Since: 2.0
*/
void
modulemd_dependencies_add_buildtime_stream (ModulemdDependencies *self,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_dependencies_set_empty_buildtime_dependencies_for_module:
* @self: This #ModulemdDependencies object.
* @module_name: The name of the module to add dependencies on.
*
* Adds a module and inserts an empty list for it as buildtime dependency.
*
* Since: 2.0
*/
void
modulemd_dependencies_set_empty_buildtime_dependencies_for_module (
ModulemdDependencies *self, const gchar *module_name);
/**
* modulemd_dependencies_clear_buildtime_dependencies:
* @self: This #ModulemdDependencies object.
*
* Remove all buildtime dependencies from this #ModulemdDependencies object.
*
* Since: 2.5
*/
void
modulemd_dependencies_clear_buildtime_dependencies (
ModulemdDependencies *self);
/**
* modulemd_dependencies_get_buildtime_modules_as_strv: (rename-to modulemd_dependencies_get_buildtime_modules)
* @self: This #ModulemdDependencies object.
*
* Returns: (transfer full): An ordered #GStrv list of module names of
* build-time dependencies.
*
* Since: 2.0
*/
GStrv
modulemd_dependencies_get_buildtime_modules_as_strv (
ModulemdDependencies *self);
/**
* modulemd_dependencies_get_buildtime_streams_as_strv: (rename-to modulemd_dependencies_get_buildtime_streams)
* @self: This #ModulemdDependencies object.
* @module: The name of the module.
*
* Returns: (transfer full) (nullable): An ordered #GStrv list of module
* streams associated with the specified module that are required at
* build-time.
*
* Since: 2.0
*/
GStrv
modulemd_dependencies_get_buildtime_streams_as_strv (
ModulemdDependencies *self, const gchar *module);
/**
* modulemd_dependencies_add_runtime_stream:
* @self: This #ModulemdDependencies object.
* @module_name: The name of the module to depend on.
* @module_stream: The name of the module stream to depend on.
*
* Adds a module and its stream that is required at runtime by a dependent
* module. The matrix of streams and module names will be calculated by the
* build-system. If the listed provided module name is already present, the
* streams will be added (with deduplication).
*
* Since: 2.0
*/
void
modulemd_dependencies_add_runtime_stream (ModulemdDependencies *self,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_dependencies_set_empty_runtime_dependencies_for_module:
* @self: This #ModulemdDependencies object.
* @module_name: The name of the module to add dependencies on.
*
* Adds a module and inserts an empty list for it as runtime dependency.
*
* Since: 2.0
*/
void
modulemd_dependencies_set_empty_runtime_dependencies_for_module (
ModulemdDependencies *self, const gchar *module_name);
/**
* modulemd_dependencies_clear_runtime_dependencies:
* @self: This #ModulemdDependencies object.
*
* Remove all runtime dependencies from this #ModulemdDependencies object.
*
* Since: 2.5
*/
void
modulemd_dependencies_clear_runtime_dependencies (ModulemdDependencies *self);
/**
* modulemd_dependencies_get_runtime_modules_as_strv: (rename-to modulemd_dependencies_get_runtime_modules)
* @self: This #ModulemdDependencies object.
*
* Returns: (transfer full): An ordered #GStrv list of module names of run-time
* dependencies.
*
* Since: 2.0
*/
GStrv
modulemd_dependencies_get_runtime_modules_as_strv (ModulemdDependencies *self);
/**
* modulemd_dependencies_get_runtime_streams_as_strv: (rename-to modulemd_dependencies_get_runtime_streams)
* @self: This #ModulemdDependencies object.
* @module: The name of the module.
*
* Returns: (transfer full) (nullable): An ordered #GStrv list of module streams
* associated with the specified module that are required at run-time.
*
* Since: 2.0
*/
GStrv
modulemd_dependencies_get_runtime_streams_as_strv (ModulemdDependencies *self,
const gchar *module);
G_END_DECLS

View file

@ -0,0 +1,32 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 Stephen Gallagher
*
* 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 <glib-object.h>
G_BEGIN_DECLS
#ifdef MMD_DISABLE_DEPRECATION_WARNINGS
#define MMD_DEPRECATED extern
#define MMD_DEPRECATED_FOR(f) extern
#define MMD_UNAVAILABLE(maj, min) extern
#define MMD_DEPRECATED_TYPE_FOR(f)
#else
#define MMD_DEPRECATED G_DEPRECATED extern
#define MMD_DEPRECATED_FOR(f) G_DEPRECATED_FOR (f) extern
#define MMD_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR (f)
#define MMD_UNAVAILABLE(maj, min) G_UNAVAILABLE (maj, min) extern
#endif
G_END_DECLS

View file

@ -0,0 +1,216 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2019 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 <glib.h>
#include "modulemd-deprecated.h"
G_BEGIN_DECLS
/**
* SECTION: modulemd-errors
* @title: Modulemd Errors
* @stability: stable
* @short_description: Error codes for libmodulemd.
*/
/**
* MODULEMD_ERROR:
*
* A convenience macro for identifying an error in the general modulemd domain.
*
* Since: 2.9
*/
#define MODULEMD_ERROR modulemd_error_quark ()
/**
* modulemd_error_quark:
*
* Returns: A #GQuark used to identify an error in the general modulemd domain.
*
* Since: 2.9
*/
GQuark
modulemd_error_quark (void);
/**
* ModulemdError:
* @MMD_ERROR_UPGRADE: Represents an error encountered while upgrading the
* metadata version of a module stream or module defaults.
* @MMD_ERROR_VALIDATE: Represents an error encountered while validating
* module metadata.
* @MMD_ERROR_FILE_ACCESS: Represents an error encountered when attempting
* to access a file.
* @MMD_ERROR_NO_MATCHES: Represents an error indicating that no streams
* matched when searching for a specific module stream.
* @MMD_ERROR_TOO_MANY_MATCHES: Represents an error indicating that
* multiple streams matched when searching for a specific module
* stream.
* @MMD_ERROR_MAGIC: Could not detect the mime type of a file for
* automatic detection of compression format.
* @MMD_ERROR_NOT_IMPLEMENTED: The requested function is not implemented
* on this platform, likely due to needing a newer version of a dependency
* library.
* @MMD_ERROR_MISSING_REQUIRED: The object is missing some data necessary
* for proper operation.
*
* Since: 2.9
*/
typedef enum
{
MMD_ERROR_UPGRADE,
MMD_ERROR_VALIDATE,
MMD_ERROR_FILE_ACCESS,
MMD_ERROR_NO_MATCHES,
MMD_ERROR_TOO_MANY_MATCHES,
MMD_ERROR_MAGIC,
MMD_ERROR_NOT_IMPLEMENTED,
MMD_ERROR_MISSING_REQUIRED
} ModulemdError;
/**
* ModulemdErrorEnum:
* @MODULEMD_ERROR_UPGRADE: Represents an error encountered while upgrading the
* metadata version of a module stream or module defaults.
* @MODULEMD_ERROR_VALIDATE: Represents an error encountered while validating
* module metadata.
* @MODULEMD_ERROR_FILE_ACCESS: Represents an error encountered when attempting
* to access a file.
* @MODULEMD_ERROR_NO_MATCHES: Represents an error indicating that no streams
* matched when searching for a specific module stream. Since: 2.2
* @MODULEMD_ERROR_TOO_MANY_MATCHES: Represents an error indicating that
* multiple streams matched when searching for a specific module
* stream. Since: 2.2
* @MODULEMD_ERROR_MAGIC: Could not detect the mime type of a file for
* automatic detection of compression format. Since: 2.8
* @MODULEMD_ERROR_NOT_IMPLEMENTED: The requested function is not implemented
* on this platform, likely due to needing a newer version of a dependency
* library. Since: 2.8
*
* Since: 2.0
* Deprecated: 2.9
* Use #ModulemdError instead.
*/
MMD_DEPRECATED_TYPE_FOR (ModulemdError)
typedef enum
{
MODULEMD_ERROR_UPGRADE,
MODULEMD_ERROR_VALIDATE,
MODULEMD_ERROR_FILE_ACCESS,
MODULEMD_ERROR_NO_MATCHES,
MODULEMD_ERROR_TOO_MANY_MATCHES,
MODULEMD_ERROR_MAGIC,
MODULEMD_ERROR_NOT_IMPLEMENTED
} ModulemdErrorEnum;
/**
* MODULEMD_YAML_ERROR:
*
* A convenience macro for identifying an error in the modulemd yaml domain.
*
* Since: 2.9
*/
#define MODULEMD_YAML_ERROR modulemd_yaml_error_quark ()
/**
* modulemd_yaml_error_quark:
*
* Returns: A #GQuark used to identify an error in the modulemd yaml domain.
*
* Since: 2.9
*/
GQuark
modulemd_yaml_error_quark (void);
/**
* ModulemdYamlError:
* @MMD_YAML_ERROR_OPEN: Represents an error encountered while opening a
* YAML file.
* @MMD_YAML_ERROR_PROGRAMMING: Represents an internal programming error
* encountered while parsing a YAML document.
* @MMD_YAML_ERROR_UNPARSEABLE: Represents an error indicating that
* unexpected data or some other parsing error that violates the YAML spec
* was encountered while parsing a YAML document.
* @MMD_YAML_ERROR_PARSE: Represents an error indicating invalid data
* violating the modulemd YAML spec was encountered while parsing a YAML
* document.
* @MMD_YAML_ERROR_EMIT: Represents an error encountered while writing a
* YAML file.
* @MMD_YAML_ERROR_MISSING_REQUIRED: Represents an error indicating that
* required elements are missing while parsing a YAML document.
* @MMD_YAML_ERROR_EVENT_INIT: Represents an error indicating that a YAML
* output event could not be initialized.
* @MMD_YAML_ERROR_INCONSISTENT: Represents a data inconsistency error
* encountered while parsing a YAML document.
* @MMD_YAML_ERROR_UNKNOWN_ATTRS: While parsing a document in strict mode, an
* attribute was encountered that does not belong in this document.
*
* Since: 2.9
*/
typedef enum
{
MMD_YAML_ERROR_OPEN,
MMD_YAML_ERROR_PROGRAMMING,
MMD_YAML_ERROR_UNPARSEABLE,
MMD_YAML_ERROR_PARSE,
MMD_YAML_ERROR_EMIT,
MMD_YAML_ERROR_MISSING_REQUIRED,
MMD_YAML_ERROR_EVENT_INIT,
MMD_YAML_ERROR_INCONSISTENT,
MMD_YAML_ERROR_UNKNOWN_ATTR
} ModulemdYamlError;
/**
* ModulemdYamlErrorEnum:
* @MODULEMD_YAML_ERROR_OPEN: Represents an error encountered while opening a
* YAML file.
* @MODULEMD_YAML_ERROR_PROGRAMMING: Represents an internal programming error
* encountered while parsing a YAML document.
* @MODULEMD_YAML_ERROR_UNPARSEABLE: Represents an error indicating that
* unexpected data or some other parsing error was encountered while parsing a
* YAML document.
* @MODULEMD_YAML_ERROR_PARSE: Represents an error indicating invalid data was
* encountered while parsing a YAML document.
* @MODULEMD_YAML_ERROR_EMIT: Represents an error encountered while writing a
* YAML file.
* @MODULEMD_YAML_ERROR_MISSING_REQUIRED: Represents an error indicating that
* required elements are missing while parsing a YAML document.
* @MODULEMD_YAML_ERROR_EVENT_INIT: Represents an error indicating that a YAML
* output event could not be initialized.
* @MODULEMD_YAML_ERROR_INCONSISTENT: Represents a data inconsistency error
* encountered while parsing a YAML document.
*
* Since: 2.0
* Deprecated: 2.9
* Use #ModulemdYamlError instead.
*/
MMD_DEPRECATED_TYPE_FOR (ModulemdYamlError)
typedef enum
{
MODULEMD_YAML_ERROR_OPEN,
MODULEMD_YAML_ERROR_PROGRAMMING,
MODULEMD_YAML_ERROR_UNPARSEABLE,
MODULEMD_YAML_ERROR_PARSE,
MODULEMD_YAML_ERROR_EMIT,
MODULEMD_YAML_ERROR_MISSING_REQUIRED,
MODULEMD_YAML_ERROR_EVENT_INIT,
MODULEMD_YAML_ERROR_INCONSISTENT
} ModulemdYamlErrorEnum;
G_END_DECLS

View file

@ -0,0 +1,231 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2018 Stephen Gallagher
*
* 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-module-index.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-module-index-merger
* @title: Modulemd.ModuleIndexMerger
* @stability: stable
* @short_description: Class to aid in merging metadata from multiple
* repositories.
*
* ModuleIndexMerger is used to resolve merges between multiple repository
* metadata sources, possibly with varying priorities.
*
* It is expected to be used as follows (python example) by tools such as `yum`:
*
* |[<!-- language="Python" -->
* merger = Modulemd.ModuleIndexMerger.new()
*
* merger.associate_index(fedora_repo_index, 0)
* merger.associate_index(updates_repo_index, 0)
* merger.associate_index(updates_testing_repo_index, 0)
*
* merged_index = merger.resolve()
*
* ]|
*
* In the above code, merged_index will be a complete, merged view of the
* metadata from all of the added #ModulemdModuleIndex instances.
*
* When merging module streams, entries will be deduplicated based on whether
* they share the same module name, stream name, version number, and context.
* If the repository configuration is broken and there exists two
* #ModulemdModuleStream entries that have different content for the same
* NSVCA, the behavior is undefined.
*
* Merging #ModulemdDefaults entries behaves as follows (note that this
* behavior has changed slightly as of 2.8.1):
*
* - Any module defaults object that is provided by a single
* #ModulemdModuleIndex will be the defaults object in the resulting merged
* #ModulemdModuleIndex.
* - If the #ModulemdModuleIndex inputs have different priorities (not common),
* then the defaults from the highest priority #ModulemdModuleIndex will be
* used and the others entirely discarded. The `modified` value will not be
* considered at all. (Priority is intended for providing a total override,
* including an on-disk configuration).
* - If the repos have the same priority (such as "fedora" and "updates" in the
* Fedora Project) and `modified` value, the entries will be merged as
* follows for default streams:
* - If both #ModulemdModuleIndex objects specify the same default stream for
* the module, that one will be used.
* - If either #ModulemdModuleIndex specifies a default stream for the module
* and the other does not, the provided one will be used.
* - If both #ModulemdModuleIndex objects specify different default streams
* and have different `modified` values, the default stream from the
* #ModulemdDefaults object with the higher `modified` value will be used.
* - If both #ModulemdModuleIndex objects specify different default streams
* and have the same `modified` value, the merge will unset the default
* stream and leave no default stream in the resulting merged
* #ModulemdModuleIndex. This behavior can be controlled by using
* modulemd_module_index_merger_resolve_ext() and setting
* `strict_default_streams` to #TRUE. In that case, an error will be
* returned if conflicting default streams have been provided.
* - and for profile defaults:
* - If both #ModulemdModuleIndex objects specify a set of default profiles
* for a particular module and stream and the sets are equivalent, use that
* set.
* - If one #ModulemdModuleIndex object specifies a set of default profiles
* for a module and stream and the other does not, use the provided set.
* - If both #ModulemdModuleIndex objects specify a set of default profiles
* for a stream, each are providing a different set and the `modified`
* value differs, the set from the object with the higher `modified` value
* will be used.
* - If both #ModulemdModuleIndex objects specify a set of default profiles
* for a stream, each are providing a different set and the `modified`
* value is the same, this is an unresolvable merge conflict and the merge
* resolution will fail and return an error.
* - Intents behave in exactly the same manner as described for the top-level
* defaults, except that they merge beneath each intent name.
*
* Merging #ModulemdTranslations entries behaves as follows:
*
* - For each translated summary, description and profile description, compare
* the `modified` value of the Translation document matching this module name
* and stream. Whichever has the higher value will be used. Any translation
* containing the empty string will be interpreted as removing the
* translation. Subsequent processing of a higher modified value may restore
* it.
*
* Merging #ModulemdObsoletes entries with identical module, stream, context
* and modified values behaves as follows (when accessed through module):
*
* - Any obsoletes object that is provided by a single #ModulemdModuleIndex
* will be the obsoletes object in the resulting merged #ModulemdModuleIndex.
* - If the #ModulemdModuleIndex inputs have different priorities (not common),
* then the obsoletes from the highest priority #ModulemdModuleIndex will be
* used and the others entirely discarded. (Priority is intended for providing
* a total override, including an on-disk configuration).
* - If the repos have the same priority (such as "fedora" and "updates" in the
* Fedora Project) the behaviour is undefined.
*/
#define MODULEMD_TYPE_MODULE_INDEX_MERGER \
(modulemd_module_index_merger_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdModuleIndexMerger,
modulemd_module_index_merger,
MODULEMD,
MODULE_INDEX_MERGER,
GObject)
/**
* modulemd_module_index_merger_new:
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndexMerger
* object.
*
* Since: 2.0
*/
ModulemdModuleIndexMerger *
modulemd_module_index_merger_new (void);
/**
* modulemd_module_index_merger_associate_index:
* @self: (in): This #ModulemdModuleIndexMerger object.
* @index: (in) (transfer none): A #ModulemdModuleIndex, usually constructed by
* reading the module metadata from a repository with
* modulemd_module_index_update_from_file(),
* modulemd_module_index_update_from_string(), or
* `modulemd_module_index_update_from_stream()`. This function take a reference
* on @index, so the caller must not modify it while the
* #ModulemdModuleIndexMerger is in use.
* @priority: (in): The priority of the repository that the entries in @index
* came from. This is used to determine when @index should override rather then
* merge. In most cases, this will be zero. See the Description section for the
* #ModulemdModuleIndexMerger class for details on the merge logic. Acceptable
* values are in the range of 0-1000.
*
* Enqueues a #ModulemdModuleIndex representing the parsed metadata from a
* repository into this #ModulemdModuleIndexMerger for merging and
* deduplication of other repositories.
*
* Once all repositories have been added, call
* modulemd_module_index_merger_resolve() to perform the merge.
*
* Since: 2.0
*/
void
modulemd_module_index_merger_associate_index (ModulemdModuleIndexMerger *self,
ModulemdModuleIndex *index,
gint32 priority);
/**
* modulemd_module_index_merger_resolve:
* @self: (in): This #ModulemdModuleIndexMerger object.
* @error: (out): A #GError containing the reason for a failure to resolve the
* merges.
*
* Merges all added #ModulemdModuleIndex objects according to their priority.
* The logic of this merge is described in the Description of
* #ModulemdModuleIndexMerger.
*
* Once this function has been called, the internal state of the
* #ModulemdModuleIndexMerger is undefined. The only valid action on it after
* that point is g_object_unref().
*
* This function is equivalent to calling
* modulemd_module_index_merger_resolve_ext() with
* `strict_default_streams=FALSE`.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndex object
* containing the merged results. If this function encounters an unresolvable
* merge conflict, it will return NULL and set @error appropriately.
*
* Since: 2.0
*/
ModulemdModuleIndex *
modulemd_module_index_merger_resolve (ModulemdModuleIndexMerger *self,
GError **error);
/**
* modulemd_module_index_merger_resolve_ext:
* @self: (in): This #ModulemdModuleIndexMerger object.
* @strict_default_streams: (in): If TRUE, merging two #ModulemdDefaults with
* conflicting default streams will raise an error. If FALSE, the module will
* have its default stream blocked.
* @error: (out): A #GError containing the reason for a failure to resolve the
* merges.
*
* Merges all added #ModulemdModuleIndex objects according to their priority.
* The logic of this merge is described in the Description of
* #ModulemdModuleIndexMerger.
*
* Once this function has been called, the internal state of the
* #ModulemdModuleIndexMerger is undefined. The only valid action on it after
* that point is g_object_unref().
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndex object
* containing the merged results. If this function encounters an unresolvable
* merge conflict, it will return NULL and set @error appropriately.
*
* Since: 2.6
*/
ModulemdModuleIndex *
modulemd_module_index_merger_resolve_ext (ModulemdModuleIndexMerger *self,
gboolean strict_default_streams,
GError **error);
G_END_DECLS

View file

@ -0,0 +1,634 @@
/*
* 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-module.h"
#include "modulemd-module-stream.h"
#include "modulemd-subdocument-info.h"
#include "modulemd-translation.h"
#include "modulemd-obsoletes.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-module-index
* @title: Modulemd.ModuleIndex
* @stability: stable
* @short_description: The primary interface to dealing with repodata in the
* module metadata format.
*
* This object provides an interface to the complete metadata read from a
* repository or manually added to this object.
*
* NOTE: When adding or updating this object from YAML, all objects imported
* will be automatically upgraded to match the highest version of that object
* that is seen. This means that if the repository has a mix of
* #ModulemdModuleStreamV1 and #ModulemdModuleStreamV2 objects, the index will
* contain only #ModulemdModuleStreamV2. You can check the versions the index
* upgraded to with the modulemd_module_index_get_stream_mdversion() and
* modulemd_module_index_get_defaults_mdversion(). If your application would
* prefer to always work with a particular stream or defaults version (such as
* to avoid extra branching logic), the modulemd_module_index_upgrade_streams()
* and modulemd_module_index_upgrade_defaults() functions can be used to force
* the contents of the index to upgrade to those versions.
*
* Interacting with #ModulemdModuleIndex is relatively simple. A common Python
* example for working with Fedora repodata might be (assuming the metadata has
* already been read into strings):
*
* |[<!-- language="Python" -->
* fedora_repo_index = Modulemd.ModuleIndex.new()
* fedora_repo_index.update_from_string(fedora_modulemd, True)
*
* # Get the list of all module names in the index
* module_names = fedora_repo_index.get_module_names()
*
* # Retrieve information about a particular module from the index
* module = fedora_repo_index.get_module('module_name')
* ]|
*
* See the #ModulemdModule documentation for details on retrieving information
* about specific modules, including how to get #ModulemdDefaults information
* and retrieve individual #ModulemdModuleStream objects.
*
* See the #ModulemdModuleIndexMerger documentation for details on merging
* #ModulemdModuleIndex objects from separate repositories together.
*/
#define MODULEMD_TYPE_MODULE_INDEX (modulemd_module_index_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdModuleIndex, modulemd_module_index, MODULEMD, MODULE_INDEX, GObject)
/**
* ModulemdReadHandler:
* @data: (inout): A private pointer to the data being read.
* @buffer: (out): The buffer to write the data from the source.
* @size: (in): The size of the buffer.
* @size_read: (out): The actual number of bytes read from the source.
*
* The prototype of a read handler.
*
* The read handler is called when the parser needs to read more bytes from the
* source. The handler should write not more than @size bytes to the @buffer.
* The number of written bytes should be set to the @size_read variable.
*
* This handler is identical to a
* [yaml_read_handler_t](https://github.com/yaml/libyaml/blob/master/include/yaml.h#L988)
* but is included here to avoid depending on yaml.h in modulemd headers.
*
* Returns: On success, the handler must return 1. If the handler failed,
* the returned value must be 0. On EOF, the handler must set the
* @size_read to 0 and return 1.
*
* Since: 2.3
*/
typedef gint (*ModulemdReadHandler) (void *data,
unsigned char *buffer,
size_t size,
size_t *size_read);
/**
* ModulemdWriteHandler:
* @data: (inout): A private pointer that includes the data source.
* @buffer: (out): The buffer with bytes to be written.
* @size: (in): The size of the buffer.
*
* The prototype of a write handler.
*
* The write handler is called when the emitter needs to flush the accumulated
* characters to the output. The handler should write @size bytes of the
* @buffer to the output.
*
* This handler is identical to a
* [yaml_write_handler_t](https://github.com/yaml/libyaml/blob/master/include/yaml.h#L1478)
* but is included here to avoid depending on yaml.h in modulemd headers.
*
* Returns: On success, the handler must return 1. If the handler failed,
* the returned value must be 0.
*
* Since: 2.3
*/
typedef gint (*ModulemdWriteHandler) (void *data,
unsigned char *buffer,
size_t size);
/**
* modulemd_module_index_new:
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndex object.
*
* Since: 2.0
*/
ModulemdModuleIndex *
modulemd_module_index_new (void);
/**
* modulemd_module_index_update_from_file:
* @self: This #ModulemdModuleIndex object.
* @yaml_file: (in): A YAML file containing the module metadata and other
* related information such as default streams.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @failures: (out) (element-type ModulemdSubdocumentInfo) (transfer container):
* An array containing any subdocuments from the YAML file that failed to parse.
* See #ModulemdSubdocumentInfo for more details.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* Returns: TRUE if the update was successful. Returns FALSE and sets @failures
* appropriately if any of the YAML subdocuments were invalid or sets @error if
* there was a fatal parse error.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_update_from_file (ModulemdModuleIndex *self,
const gchar *yaml_file,
gboolean strict,
GPtrArray **failures,
GError **error);
/**
* modulemd_module_index_update_from_string:
* @self: This #ModulemdModuleIndex object.
* @yaml_string: (in): A YAML string containing the module metadata and other
* related information such as default streams.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @failures: (out) (element-type ModulemdSubdocumentInfo) (transfer container):
* An array containing any subdocuments from the YAML file that failed to parse.
* See #ModulemdSubdocumentInfo for more details.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* Returns: TRUE if the update was successful. Returns FALSE and sets @failures
* appropriately if any of the YAML subdocuments were invalid or sets @error if
* there was a fatal parse error.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_update_from_string (ModulemdModuleIndex *self,
const gchar *yaml_string,
gboolean strict,
GPtrArray **failures,
GError **error);
/**
* modulemd_module_index_update_from_stream: (skip)
* @self: This #ModulemdModuleIndex object.
* @yaml_stream: (in): A YAML stream containing the module metadata and other
* related information such as default streams.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @failures: (out) (element-type ModulemdSubdocumentInfo) (transfer container):
* An array containing any subdocuments from the YAML file that failed to parse.
* See #ModulemdSubdocumentInfo for more details.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* Returns: TRUE if the update was successful. Returns FALSE and sets @failures
* appropriately if any of the YAML subdocuments were invalid or sets @error if
* there was a fatal parse error.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_update_from_stream (ModulemdModuleIndex *self,
FILE *yaml_stream,
gboolean strict,
GPtrArray **failures,
GError **error);
/**
* modulemd_module_index_update_from_custom: (skip)
* @self: This #ModulemdModuleIndex object.
* @custom_read_fn: (in): A #ModulemdReadHandler
* @custom_pvt_data: (inout): The private data needed by the #ModulemdReadHandler
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @failures: (out) (element-type ModulemdSubdocumentInfo) (transfer container):
* An array containing any subdocuments from the YAML file that failed to parse.
* See #ModulemdSubdocumentInfo for more details.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* Returns: TRUE if the update was successful. Returns FALSE and sets @failures
* appropriately if any of the YAML subdocuments were invalid or sets @error if
* there was a fatal parse error.
*
* Since: 2.3
*/
gboolean
modulemd_module_index_update_from_custom (ModulemdModuleIndex *self,
ModulemdReadHandler custom_read_fn,
void *custom_pvt_data,
gboolean strict,
GPtrArray **failures,
GError **error);
/**
* modulemd_module_index_update_from_defaults_directory:
* @self: This #ModulemdModuleIndex object.
* @path: (in): The path to a directory containing defaults documents.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or a conflict in module default streams.
* @overrides_path: (in) (nullable): If non-NULL, the path to a directory
* containing defaults documents that should override those in @path.
* @error: (out): A #GError indicating why this function failed.
*
* This function will open the directory at @path and iterate through it,
* adding any files with the suffix ".yaml" to @self. If @overrides_path is
* non-NULL, it will also open any files with the suffix ".yaml" in that
* location and import them, overriding any conflicts with the existing
* defaults.
*
* Note: If you need detailed information about what failed and why, it is
* better to implement the directory traversal yourself and use the
* modulemd_module_index_update_from_file() function, as it will return the
* failures information.
*
* Returns: TRUE if all ".yaml" files in the directory were imported
* successfully (this includes if no ".yaml" files were present). FALSE if one
* or more files could not be read successfully and sets @error appropriately.
*
* Since: 2.8
*/
gboolean
modulemd_module_index_update_from_defaults_directory (
ModulemdModuleIndex *self,
const gchar *path,
gboolean strict,
const gchar *overrides_path,
GError **error);
/**
* modulemd_module_index_dump_to_string:
* @self: This #ModulemdModuleIndex object.
* @error: (out): A #GError containing the reason the function failed, NULL if
* the function succeeded.
*
* Returns: (transfer full): A YAML representation of the index as a string. In
* the event of an error, sets @error appropriately and returns NULL.
*
* Since: 2.0
*/
gchar *
modulemd_module_index_dump_to_string (ModulemdModuleIndex *self,
GError **error);
/**
* modulemd_module_index_dump_to_stream: (skip)
* @self: This #ModulemdModuleIndex object.
* @yaml_stream: (in): A stream to write the module metadata and other related
* information to.
* @error: (out): A #GError containing the reason the function failed, NULL if
* the function succeeded.
*
* Returns: TRUE if written successfully, FALSE and sets @error appropriately in
* the event of an error.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_dump_to_stream (ModulemdModuleIndex *self,
FILE *yaml_stream,
GError **error);
/**
* modulemd_module_index_dump_to_custom: (skip)
* @self: This #ModulemdModuleIndex object.
* @custom_write_fn: (in): A #ModulemdWriteHandler
* @custom_pvt_data: (inout): The private data needed by the
* #ModulemdWriteHandler
* @error: (out): A #GError containing the reason the function failed, NULL if
* the function succeeded
*
* Returns: TRUE if written successfully, FALSE and sets @error appropriately in
* the event of an error.
*
* Since: 2.3
*/
gboolean
modulemd_module_index_dump_to_custom (ModulemdModuleIndex *self,
ModulemdWriteHandler custom_write_fn,
void *custom_pvt_data,
GError **error);
/**
* modulemd_module_index_get_module_names_as_strv: (rename-to modulemd_module_index_get_module_names)
* @self: This #ModulemdModuleIndex object.
*
* Returns: (transfer full): An ordered list of string keys in this index.
*
* Since: 2.0
*/
GStrv
modulemd_module_index_get_module_names_as_strv (ModulemdModuleIndex *self);
/**
* modulemd_module_index_get_module:
* @self: This #ModulemdModuleIndex object.
* @module_name: The module name to look up in the index.
*
* Returns: (transfer none): The #ModulemdModule object matching the provided
* module name or NULL if the key was not present in the index.
*
* Since: 2.0
*/
ModulemdModule *
modulemd_module_index_get_module (ModulemdModuleIndex *self,
const gchar *module_name);
/**
* modulemd_module_index_search_streams:
* @self: This #ModulemdModuleIndex object.
* @module_name: (nullable): The name of the module to retrieve. If NULL, will
* search all modules in the index.
* @stream_name: (nullable): The name of the stream to retrieve. If NULL, will
* search all streams in a module.
* @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_index_search_streams (ModulemdModuleIndex *self,
const gchar *module_name,
const gchar *stream_name,
const gchar *version,
const gchar *context,
const gchar *arch);
/**
* modulemd_module_index_search_streams_by_nsvca_glob:
* @self: This #ModulemdModuleIndex 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): 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_index_search_streams_by_nsvca_glob (
ModulemdModuleIndex *self, const gchar *nsvca_pattern);
/**
* modulemd_module_index_search_rpms:
* @self: This #ModulemdModuleIndex object.
* @nevra_pattern: (not nullable): A [glob](https://www.mankier.com/3/glob)
* pattern to match against the NEVRA strings of the rpm artifacts in the
* #ModulemdModuleStream objects in this module.
*
* 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 containing an RPM that matches the @nevra_pattern.
* 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_index_search_rpms (ModulemdModuleIndex *self,
const gchar *nevra_pattern);
/**
* modulemd_module_index_remove_module:
* @self: This #ModulemdModuleIndex object.
* @module_name: The name of the module to remove from the index.
*
* Remove a module, including all of its streams, its defaults and its
* translations from a #ModulemdModuleIndex.
*
* Returns: TRUE if the module name was present in the index. FALSE if it was
* not.
*
* Since: 2.2
*/
gboolean
modulemd_module_index_remove_module (ModulemdModuleIndex *self,
const gchar *module_name);
/**
* modulemd_module_index_add_module_stream:
* @self: This #ModulemdModuleIndex object.
* @stream: The #ModulemdModuleStream to add to the index. The stream added
* must have a module name and stream name set on it or it will be rejected.
* @error: (out): A #GError containing the reason the #ModulemdModuleStream
* object could not be added or NULL if the function succeeded.
*
* Add a #ModulemdModuleStream to the #ModulemdModuleIndex. While being added,
* the #ModulemdModuleStream will be upgraded to %MD_MODULESTREAM_VERSION_LATEST
* to ensure that merges done with #ModulemdModuleIndexMerger will always occur
* between streams of the same version. If this upgrade cannot be performed,
* the function will return @error set appropriately.
*
* Returns: TRUE if the #ModulemdModuleStream was added successfully. If the
* stream already existed in the index, it will be replaced by the new one. On
* failure, returns FALSE and sets @error appropriately.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_add_module_stream (ModulemdModuleIndex *self,
ModulemdModuleStream *stream,
GError **error);
/**
* modulemd_module_index_add_defaults:
* @self: This #ModulemdModuleIndex object.
* @defaults: The #ModulemdDefaults object to add to the index.
* @error: (out): A #GError containing the reason the #ModulemdDefaults object
* could not be added or NULL if the function succeeded.
*
* Returns: TRUE if the #ModulemdDefaults was added successfully. If the defaults
* already existed in the index, it will be replaced by the new one. On failure,
* returns FALSE and sets @error appropriately.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_add_defaults (ModulemdModuleIndex *self,
ModulemdDefaults *defaults,
GError **error);
/**
* modulemd_module_index_add_obsoletes:
* @self: This #ModulemdModuleIndex object.
* @obsoletes: (in): The #ModulemdObsoletes object to add to the index.
* @error: (out): A #GError containing the reason the #ModulemdObsoletes object
* could not be added or NULL if the function succeeded.
*
* Returns: TRUE if the #ModulemdObsoletes was added successfully. If the obsoletes
* already existed in the index, it will be replaced by the new one. On failure,
* returns FALSE and sets @error appropriately.
*
* Since: 2.10
*/
gboolean
modulemd_module_index_add_obsoletes (ModulemdModuleIndex *self,
ModulemdObsoletes *obsoletes,
GError **error);
/**
* modulemd_module_index_get_default_streams_as_hash_table: (rename-to modulemd_module_index_get_default_streams)
* @self: (in): This #ModulemdModuleIndex object.
* @intent: (in) (nullable): The name of the system intent whose default stream
* will be retrieved. If left NULL or the specified intent has no separate
* default, it will return the generic default stream for this module.
*
* Get a dictionary of all modules in the index that have a default stream.
*
* This function cannot fail, but may return an empty (non-NULL) #GHashTable.
*
* Returns: (transfer container) (element-type utf8 utf8): A #GHashTable with
* the module name as the key and the default stream as the value for all
* modules with a default stream in the index. Modules without a default stream
* will not appear in this table.
*
* Since: 2.5
*/
GHashTable *
modulemd_module_index_get_default_streams_as_hash_table (
ModulemdModuleIndex *self, const gchar *intent);
/**
* modulemd_module_index_add_translation:
* @self: This #ModulemdModuleIndex object.
* @translation: The #ModulemdTranslation object to add to the index.
* @error: (out): A #GError containing the reason the #ModulemdTranslation
* object could not be added or NULL if the function succeeded.
*
* Returns: TRUE if the #ModulemdTranslation was added successfully. If the
* translation already existed in the index, it will be replaced by the new one.
* On failure, returns FALSE and sets @error appropriately.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_add_translation (ModulemdModuleIndex *self,
ModulemdTranslation *translation,
GError **error);
/**
* modulemd_module_index_get_defaults_mdversion:
* @self: This #ModulemdModuleIndex object.
*
* Returns: The metadata version of #ModulemdDefaults in use for this index.
*
* Since: 2.0
*/
ModulemdDefaultsVersionEnum
modulemd_module_index_get_defaults_mdversion (ModulemdModuleIndex *self);
/**
* modulemd_module_index_get_stream_mdversion:
* @self: This #ModulemdModuleIndex object.
*
* Returns: The metadata version of #ModulemdModuleStream in use for this
* index.
*
* Since: 2.0
*/
ModulemdModuleStreamVersionEnum
modulemd_module_index_get_stream_mdversion (ModulemdModuleIndex *self);
/**
* modulemd_module_index_upgrade_streams:
* @self: This #ModulemdModuleIndex object.
* @mdversion: The #ModulemdModuleStream metadata version to upgrade to.
* @error: (out): A #GError that contains information on why the index could
* not be upgraded in the event of an error.
*
* Upgrades all #ModulemdModuleStream objects in this index to @mdversion if
* they are not already at that version.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_upgrade_streams (
ModulemdModuleIndex *self,
ModulemdModuleStreamVersionEnum mdversion,
GError **error);
/**
* modulemd_module_index_upgrade_defaults:
* @self: This #ModulemdModuleIndex object.
* @mdversion: The #ModulemdDefaults metadata version to upgrade to.
* @error: (out): A #GError that contains information on why the index could
* not be upgraded in the event of an error.
*
* Upgrades all #ModulemdDefaults objects in this index to @mdversion if they
* are not already at that version.
*
* Since: 2.0
*/
gboolean
modulemd_module_index_upgrade_defaults (ModulemdModuleIndex *self,
ModulemdDefaultsVersionEnum mdversion,
GError **error);
G_END_DECLS

View file

@ -0,0 +1,962 @@
/*
* 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-buildopts.h"
#include "modulemd-component-module.h"
#include "modulemd-component-rpm.h"
#include "modulemd-component.h"
#include "modulemd-deprecated.h"
#include "modulemd-module-stream.h"
#include "modulemd-profile.h"
#include "modulemd-service-level.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-module-stream-v1
* @title: Modulemd.ModuleStreamV1
* @stability: stable
* @short_description: The data to represent a stream of a module as described
* by a modulemd YAML document of version 1.
*/
#define MODULEMD_TYPE_MODULE_STREAM_V1 (modulemd_module_stream_v1_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdModuleStreamV1,
modulemd_module_stream_v1,
MODULEMD,
MODULE_STREAM_V1,
ModulemdModuleStream)
/**
* modulemd_module_stream_v1_new:
* @module_name: (in) (nullable): The name of this module.
* @module_stream: (in) (nullable): The name of this module stream.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStreamV1 object,
* with the specified module and stream names, if provided.
*
* Since: 2.0
*/
ModulemdModuleStreamV1 *
modulemd_module_stream_v1_new (const gchar *module_name,
const gchar *module_stream);
/* ===== Properties ====== */
/**
* modulemd_module_stream_v1_set_arch:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @arch: (in): The module artifact architecture.
*
* Set the module artifact architecture.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_arch (ModulemdModuleStreamV1 *self,
const gchar *arch);
/**
* modulemd_module_stream_v1_get_arch:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The module artifact architecture.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_arch (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_set_buildopts:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @buildopts: (in) (transfer none): A #ModulemdBuildopts object describing
* build options that apply globally to components in this module.
*
* Set build options for this module's components.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_buildopts (ModulemdModuleStreamV1 *self,
ModulemdBuildopts *buildopts);
/**
* modulemd_module_stream_v1_get_buildopts:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The build options for this module's components.
*
* Since: 2.0
*/
ModulemdBuildopts *
modulemd_module_stream_v1_get_buildopts (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_set_community:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @community: (in): The upstream community website for this module.
*
* Set the module community website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_community (ModulemdModuleStreamV1 *self,
const gchar *community);
/**
* modulemd_module_stream_v1_get_community:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The module community website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_community (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_set_description:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @description: (in) (nullable): The untranslated description of this module.
*
* Set the module description.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_description (ModulemdModuleStreamV1 *self,
const gchar *description);
/**
* modulemd_module_stream_v1_get_description:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @locale: (in) (nullable): The name of the locale to use when translating
* the string. If NULL, it will determine the locale with a system call to
* `setlocale(LC_MESSAGES, NULL)` and return that. If the caller wants the
* untranslated string, they should pass `"C"` for the locale.
*
* Returns: (transfer none): The module description, translated to the
* requested locale if available. Translation information is managed by the
* #ModulemdTranslation and #ModulemdTranslationEntry objects.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_description (ModulemdModuleStreamV1 *self,
const gchar *locale);
/**
* modulemd_module_stream_v1_set_documentation:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @documentation: (in): The upstream documentation website for this module.
*
* Set the module documentation website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_documentation (ModulemdModuleStreamV1 *self,
const gchar *documentation);
/**
* modulemd_module_stream_v1_get_documentation:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The module documentation website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_documentation (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_set_summary:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @summary: (in) (nullable): The untranslated summary of this module.
*
* Set the module summary.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_summary (ModulemdModuleStreamV1 *self,
const gchar *summary);
/**
* modulemd_module_stream_v1_get_summary:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @locale: (in) (nullable): The name of the locale to use when translating
* the string. If NULL, it will determine the locale with a system call to
* `setlocale(LC_MESSAGES, NULL)` and return that. If the caller wants the
* untranslated string, they should pass `"C"` for the locale.
*
* Returns: (transfer none): The module summary, translated to the requested
* locale if available. Translation information is managed by the
* #ModulemdTranslation and #ModulemdTranslationEntry objects.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_summary (ModulemdModuleStreamV1 *self,
const gchar *locale);
/**
* modulemd_module_stream_v1_set_tracker:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @tracker: (in): The upstream bug tracker website for this module.
*
* Set the module bug tracker website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_tracker (ModulemdModuleStreamV1 *self,
const gchar *tracker);
/**
* modulemd_module_stream_v1_get_tracker:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The module bug tracker website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_tracker (ModulemdModuleStreamV1 *self);
/* ===== Non-property Methods ===== */
/**
* modulemd_module_stream_v1_add_component:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @component: (in) (transfer none): A #ModulemdComponent to be added to this
* module stream.
*
* Add a component definition to the module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_component (ModulemdModuleStreamV1 *self,
ModulemdComponent *component);
/**
* modulemd_module_stream_v1_remove_module_component:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @component_name: (in): The name of the component to remove from the module
* stream.
*
* Remove a component from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_module_component (
ModulemdModuleStreamV1 *self, const gchar *component_name);
/**
* modulemd_module_stream_v1_clear_module_components:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all module components from this module stream.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_module_components (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_remove_rpm_component:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @component_name: (in): The name of the component to remove from the module
* stream.
*
* Remove a component from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_rpm_component (ModulemdModuleStreamV1 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v1_clear_rpm_components:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all RPM components from this module stream.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_rpm_components (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_module_component_names_as_strv: (rename-to modulemd_module_stream_v1_get_module_component_names)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of module component names
* included in this stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_module_component_names_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_component_names_as_strv: (rename-to modulemd_module_stream_v1_get_rpm_component_names)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of RPM component names
* included in this stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_rpm_component_names_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_module_component:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @component_name: (in): The name of the component to retrieve.
*
* Returns: (transfer none): The module component matching @component_name if
* it exists, else NULL.
*
* Since: 2.0
*/
ModulemdComponentModule *
modulemd_module_stream_v1_get_module_component (ModulemdModuleStreamV1 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v1_get_rpm_component:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @component_name: (in): The name of the component to retrieve.
*
* Returns: (transfer none): The RPM component matching @component_name if it
* exists, else NULL.
*
* Since: 2.0
*/
ModulemdComponentRpm *
modulemd_module_stream_v1_get_rpm_component (ModulemdModuleStreamV1 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v1_add_content_license:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @license: (in): A license under which one or more of the components of this
* module stream are distributed.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_content_license (ModulemdModuleStreamV1 *self,
const gchar *license);
/**
* modulemd_module_stream_v1_add_module_license:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @license: (in): A license under which this module stream is distributed.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_module_license (ModulemdModuleStreamV1 *self,
const gchar *license);
/**
* modulemd_module_stream_v1_remove_content_license:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @license: (in): A license to remove from the list. Has no effect if the
* license is not present.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_content_license (ModulemdModuleStreamV1 *self,
const gchar *license);
/**
* modulemd_module_stream_v1_clear_content_licenses:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all content licenses.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_content_licenses (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_remove_module_license:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @license: (in): A license to remove from the list. Has no effect if the
* license is not present.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_module_license (ModulemdModuleStreamV1 *self,
const gchar *license);
/**
* modulemd_module_stream_v1_clear_module_licenses:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all module licenses.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_module_licenses (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_content_licenses_as_strv: (rename-to modulemd_module_stream_v1_get_content_licenses)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of licenses under which one
* or more components of this module stream are released.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_content_licenses_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_module_licenses_as_strv: (rename-to modulemd_module_stream_v1_get_module_licenses)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of licenses under which
* this module stream is released.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_module_licenses_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_add_profile:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @profile: (in) (transfer none): A #ModulemdProfile for this module stream.
*
* Adds a profile definition to this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_profile (ModulemdModuleStreamV1 *self,
ModulemdProfile *profile);
/**
* modulemd_module_stream_v1_clear_profiles:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all profiles from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_clear_profiles (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_profile_names_as_strv: (rename-to modulemd_module_stream_v1_get_profile_names)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of profile names associated
* with this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_profile_names_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_profile:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @profile_name: (in): The name of a profile to retrieve.
*
* Returns: (transfer none): The requested profile definition if present in the
* module stream. NULL otherwise.
*
* Since: 2.0
*/
ModulemdProfile *
modulemd_module_stream_v1_get_profile (ModulemdModuleStreamV1 *self,
const gchar *profile_name);
/**
* modulemd_module_stream_v1_add_rpm_api:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @rpm: (in): The name of a binary RPM present in this module that is
* considered stable public API.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_rpm_api (ModulemdModuleStreamV1 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v1_remove_rpm_api:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @rpm: (in): A binary RPM name to remove from the list of stable public API.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_rpm_api (ModulemdModuleStreamV1 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v1_clear_rpm_api:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all RPMs from the list of stable public API.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_rpm_api (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_api_as_strv: (rename-to modulemd_module_stream_v1_get_rpm_api)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of binary RPM names that
* forms the public API of this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_rpm_api_as_strv (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_add_rpm_artifact:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @nevr: (in): The NEVR of a binary RPM present in this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_rpm_artifact (ModulemdModuleStreamV1 *self,
const gchar *nevr);
/**
* modulemd_module_stream_v1_remove_rpm_artifact:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @nevr: (in): An RPM NEVR to remove from the list of artifacts.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_rpm_artifact (ModulemdModuleStreamV1 *self,
const gchar *nevr);
/**
* modulemd_module_stream_v1_clear_rpm_artifacts:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all RPM NEVRs from the list of artifacts.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_rpm_artifacts (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_artifacts_as_strv: (rename-to modulemd_module_stream_v1_get_rpm_artifacts)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of RPM NEVRs are included
* in this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_rpm_artifacts_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_add_rpm_filter:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @rpm: (in): The name of a binary RPM to filter out of this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_rpm_filter (ModulemdModuleStreamV1 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v1_remove_rpm_filter:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @rpm: (in): A binary RPM name to remove from the filter list.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_rpm_filter (ModulemdModuleStreamV1 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v1_clear_rpm_filters:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all RPMs from the filter list.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_rpm_filters (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_filters_as_strv: (rename-to modulemd_module_stream_v1_get_rpm_filters)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of binary RPM names that
* are filtered out of this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_rpm_filters_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_add_servicelevel:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @servicelevel: (in) (transfer none): A #ModulemdServiceLevel for this module stream.
*
* Adds a servicelevel definition to this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_servicelevel (
ModulemdModuleStreamV1 *self, ModulemdServiceLevel *servicelevel);
/**
* modulemd_module_stream_v1_clear_servicelevels:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all servicelevels from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_clear_servicelevels (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_servicelevel_names_as_strv: (rename-to modulemd_module_stream_v1_get_servicelevel_names)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of servicelevel names
* associated with this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_servicelevel_names_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_servicelevel:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @servicelevel_name: (in): The name of a servicelevel to retrieve.
*
* Returns: (transfer none): The requested servicelevel definition if present in the
* module stream. NULL otherwise.
*
* Since: 2.0
*/
ModulemdServiceLevel *
modulemd_module_stream_v1_get_servicelevel (ModulemdModuleStreamV1 *self,
const gchar *servicelevel_name);
/**
* modulemd_module_stream_v1_set_eol:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @eol: (in): The end-of-life date for the "rawhide" service level.
*
* Comptibility function with early iterations of modulemd v1. This function is
* a wrapper for `modulemd_module_stream_v1_add_servicelevel("rawhide", eol)`.
*
* Since: 2.0
* Deprecated: 2.0: Use modulemd_module_stream_v1_add_servicelevel() instead.
*/
MMD_DEPRECATED_FOR (modulemd_module_stream_v1_add_servicelevel)
void
modulemd_module_stream_v1_set_eol (ModulemdModuleStreamV1 *self, GDate *eol);
/**
* modulemd_module_stream_v1_get_eol:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Compatibility function with early iterations of modulemd v1. This function
* is a wrapper for `modulemd_module_stream_v1_get_servicelevel("rawhide")`.
*
* Returns: (transfer none): The end-of-life date for the "rawhide" service
* level.
*
* Since: 2.0
* Deprecated: 2.0: Use modulemd_module_stream_v1_get_servicelevel() instead.
*/
MMD_DEPRECATED_FOR (modulemd_module_stream_v1_get_servicelevel)
GDate *
modulemd_module_stream_v1_get_eol (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_add_buildtime_requirement:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module to depend on.
* @module_stream: (in): The name of the module stream to depend on.
*
* Add a build-time dependency for this module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_buildtime_requirement (
ModulemdModuleStreamV1 *self,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_module_stream_v1_add_runtime_requirement:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module to depend on.
* @module_stream: (in): The name of the module stream to depend on.
*
* Add a runtime dependency for this module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_add_runtime_requirement (
ModulemdModuleStreamV1 *self,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_module_stream_v1_remove_buildtime_requirement:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module to be removed.
*
* Remove a build-time dependency for this module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_buildtime_requirement (
ModulemdModuleStreamV1 *self, const gchar *module_name);
/**
* modulemd_module_stream_v1_remove_runtime_requirement:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module to be removed.
*
* Remove a runtime dependency for this module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_remove_runtime_requirement (
ModulemdModuleStreamV1 *self, const gchar *module_name);
/**
* modulemd_module_stream_v1_clear_buildtime_requirements
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all buildtime dependencies for this module.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_buildtime_requirements (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_clear_runtime_requirements
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all runtime dependencies for this module.
*
* Since: 2.5
*/
void
modulemd_module_stream_v1_clear_runtime_requirements (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_buildtime_modules_as_strv: (rename-to modulemd_module_stream_v1_get_buildtime_modules)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of module names that this
* module depends on at build-time.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_buildtime_modules_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_runtime_modules_as_strv: (rename-to modulemd_module_stream_v1_get_runtime_modules)
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer full): An ordered #GStrv list of module names that this
* module depends on at runtime.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v1_get_runtime_modules_as_strv (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_buildtime_requirement_stream:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module this module depends on.
*
* Returns: (transfer none): The name of the stream matching this module name
* in the build-time dependencies.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_buildtime_requirement_stream (
ModulemdModuleStreamV1 *self, const gchar *module_name);
/**
* modulemd_module_stream_get_runtime_requirement_stream:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @module_name: (in): The name of the module this module depends on.
*
* Returns: (transfer none): The name of the stream matching this module name
* in the runtime dependencies.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v1_get_runtime_requirement_stream (
ModulemdModuleStreamV1 *self, const gchar *module_name);
/**
* modulemd_module_stream_v1_set_xmd:
* @self: (in): This #ModulemdModuleStreamV1 object.
* @xmd: (in) (transfer none): A #GVariant representing arbitrary YAML.
*
* Sets the eXtensible MetaData (XMD) for this module. XMD is arbitrary YAML
* data that will be set and returned as-is (with the exception that the
* ordering of mapping keys is not defined). Useful for carrying private data.
*
* This function assumes ownership of the XMD #GVariant and thus should not be
* freed by the caller.
*
* Since: 2.0
*/
void
modulemd_module_stream_v1_set_xmd (ModulemdModuleStreamV1 *self,
GVariant *xmd);
/**
* modulemd_module_stream_v1_get_xmd:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Returns: (transfer none): The extensible metadata block as a #GVariant.
*/
GVariant *
modulemd_module_stream_v1_get_xmd (ModulemdModuleStreamV1 *self);
G_END_DECLS

View file

@ -0,0 +1,907 @@
/*
* 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-buildopts.h"
#include "modulemd-component-module.h"
#include "modulemd-component-rpm.h"
#include "modulemd-component.h"
#include "modulemd-dependencies.h"
#include "modulemd-module-stream.h"
#include "modulemd-profile.h"
#include "modulemd-rpm-map-entry.h"
#include "modulemd-service-level.h"
#include "modulemd-obsoletes.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-module-stream-v2
* @title: Modulemd.ModuleStreamV2
* @stability: stable
* @short_description: The data to represent a stream of a module as described
* by a modulemd YAML document of version 2.
*/
#define MODULEMD_TYPE_MODULE_STREAM_V2 (modulemd_module_stream_v2_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdModuleStreamV2,
modulemd_module_stream_v2,
MODULEMD,
MODULE_STREAM_V2,
ModulemdModuleStream)
/**
* modulemd_module_stream_v2_new:
* @module_name: (in) (nullable): The name of this module.
* @module_stream: (in) (nullable): The name of this module stream.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStreamV2 object,
* with the specified module and stream names, if provided.
*
* Since: 2.0
*/
ModulemdModuleStreamV2 *
modulemd_module_stream_v2_new (const gchar *module_name,
const gchar *module_stream);
/* ===== Properties ====== */
/**
* modulemd_module_stream_v2_set_arch:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @arch: (in): The module artifact architecture.
*
* Set the module artifact architecture.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_arch (ModulemdModuleStreamV2 *self,
const gchar *arch);
/**
* modulemd_module_stream_v2_get_arch:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The module artifact architecture.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_arch (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_buildopts:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @buildopts: (in) (transfer none): A #ModulemdBuildopts object describing
* build options that apply globally to components in this module.
*
* Set build options for this module's components.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_buildopts (ModulemdModuleStreamV2 *self,
ModulemdBuildopts *buildopts);
/**
* modulemd_module_stream_v2_get_buildopts:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The build options for this module's components.
*
* Since: 2.0
*/
ModulemdBuildopts *
modulemd_module_stream_v2_get_buildopts (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_community:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @community: (in): The upstream community website for this module.
*
* Set the module community website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_community (ModulemdModuleStreamV2 *self,
const gchar *community);
/**
* modulemd_module_stream_v2_get_community:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The module community website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_community (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_description:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @description: (in) (nullable): The untranslated description of this module.
*
* Set the module description.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_description (ModulemdModuleStreamV2 *self,
const gchar *description);
/**
* modulemd_module_stream_v2_get_description:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @locale: (in) (nullable): The name of the locale to use when translating
* the string. If NULL, it will determine the locale with a system call to
* `setlocale(LC_MESSAGES, NULL)` and return that. If the caller wants the
* untranslated string, they should pass `"C"` for the locale.
*
* Returns: (transfer none): The module description, translated to the
* requested locale if available. Translation information is managed by the
* #ModulemdTranslation and #ModulemdTranslationEntry objects.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_description (ModulemdModuleStreamV2 *self,
const gchar *locale);
/**
* modulemd_module_stream_v2_set_documentation:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @documentation: (in): The upstream documentation website for this module.
*
* Set the module documentation website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_documentation (ModulemdModuleStreamV2 *self,
const gchar *documentation);
/**
* modulemd_module_stream_v2_get_documentation:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The module documentation website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_documentation (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_summary:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @summary: (in) (nullable): The untranslated summary of this module.
*
* Set the module summary.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_summary (ModulemdModuleStreamV2 *self,
const gchar *summary);
/**
* modulemd_module_stream_v2_get_summary:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @locale: (in) (nullable): The name of the locale to use when translating
* the string. If NULL, it will determine the locale with a system call to
* `setlocale(LC_MESSAGES, NULL)` and return that. If the caller wants the
* untranslated string, they should pass `"C"` for the locale.
*
* Returns: (transfer none): The module summary, translated to the requested
* locale if available. Translation information is managed by the
* #ModulemdTranslation and #ModulemdTranslationEntry objects.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_summary (ModulemdModuleStreamV2 *self,
const gchar *locale);
/**
* modulemd_module_stream_v2_set_tracker:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @tracker: (in): The upstream bug tracker website for this module.
*
* Set the module bug tracker website address.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_tracker (ModulemdModuleStreamV2 *self,
const gchar *tracker);
/**
* modulemd_module_stream_v2_get_tracker:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The module bug tracker website address.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_v2_get_tracker (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_obsoletes_resolved:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The #ModulemdObsoletes information associated with
* this object. If the associated obsoletes has reset attribute set, this
* function doesn't return it. From outside obsoletes with reset looks like
* there is no obsoletes set for this stream. Every obsoletes (even with reset) can
* be accessed from the streams module.
*
* Since: 2.10
*/
ModulemdObsoletes *
modulemd_module_stream_v2_get_obsoletes_resolved (
ModulemdModuleStreamV2 *self);
/* ===== Non-property Methods ===== */
/**
* modulemd_module_stream_v2_add_component:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @component: (in) (transfer none): A #ModulemdComponent to be added to this
* module stream.
*
* Add a component definition to the module.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_component (ModulemdModuleStreamV2 *self,
ModulemdComponent *component);
/**
* modulemd_module_stream_v2_remove_module_component:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @component_name: (in): The name of the component to remove from the module
* stream.
*
* Remove a component from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_module_component (
ModulemdModuleStreamV2 *self, const gchar *component_name);
/**
* modulemd_module_stream_v2_clear_module_components:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all module components from this module stream.
*/
void
modulemd_module_stream_v2_clear_module_components (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_remove_rpm_component:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @component_name: (in): The name of the component to remove from the module
* stream.
*
* Remove a component from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_rpm_component (ModulemdModuleStreamV2 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v2_clear_rpm_components:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all RPM components from this module stream.
*/
void
modulemd_module_stream_v2_clear_rpm_components (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_module_component_names_as_strv: (rename-to modulemd_module_stream_v2_get_module_component_names)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of module component names
* included in this stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_module_component_names_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_component_names_as_strv: (rename-to modulemd_module_stream_v2_get_rpm_component_names)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of RPM component names
* included in this stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_rpm_component_names_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_module_component:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @component_name: (in): The name of the component to retrieve.
*
* Returns: (transfer none): The module component matching @component_name if
* it exists, else NULL.
*
* Since: 2.0
*/
ModulemdComponentModule *
modulemd_module_stream_v2_get_module_component (ModulemdModuleStreamV2 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v2_get_rpm_component:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @component_name: (in): The name of the component to retrieve.
*
* Returns: (transfer none): The RPM component matching @component_name if it
* exists, else NULL.
*
* Since: 2.0
*/
ModulemdComponentRpm *
modulemd_module_stream_v2_get_rpm_component (ModulemdModuleStreamV2 *self,
const gchar *component_name);
/**
* modulemd_module_stream_v2_add_content_license:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @license: (in): A license under which one or more of the components of this
* module stream are distributed.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_content_license (ModulemdModuleStreamV2 *self,
const gchar *license);
/**
* modulemd_module_stream_v2_add_module_license:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @license: (in): A license under which this module stream is distributed.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_module_license (ModulemdModuleStreamV2 *self,
const gchar *license);
/**
* modulemd_module_stream_v2_remove_content_license:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @license: (in): A license to remove from the list. Has no effect if the
* license is not present.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_content_license (ModulemdModuleStreamV2 *self,
const gchar *license);
/**
* modulemd_module_stream_v2_remove_module_license:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @license: (in): A license to remove from the list. Has no effect if the
* license is not present.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_module_license (ModulemdModuleStreamV2 *self,
const gchar *license);
/**
* modulemd_module_stream_v2_clear_content_licenses:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all content licenses.
*
* Since: 2.5
*/
void
modulemd_module_stream_v2_clear_content_licenses (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_clear_module_licenses:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all module licenses.
*
* Since: 2.5
*/
void
modulemd_module_stream_v2_clear_module_licenses (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_content_licenses_as_strv: (rename-to modulemd_module_stream_v2_get_content_licenses)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of licenses under which one
* or more components of this module stream are released.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_content_licenses_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_module_licenses_as_strv: (rename-to modulemd_module_stream_v2_get_module_licenses)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of licenses under which
* this module stream is released.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_module_licenses_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_add_profile:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @profile: (in) (transfer none): A #ModulemdProfile for this module stream.
*
* Adds a profile definition to this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_profile (ModulemdModuleStreamV2 *self,
ModulemdProfile *profile);
/**
* modulemd_module_stream_v2_clear_profiles:
* @self: (in): This #ModulemdModuleStreamV1 object.
*
* Remove all profiles from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_clear_profiles (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_profile_names_as_strv: (rename-to modulemd_module_stream_v2_get_profile_names)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of profile names associated
* with this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_profile_names_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_profile:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @profile_name: (in): The name of a profile to retrieve.
*
* Returns: (transfer none): The requested profile definition if present in the
* module stream. NULL otherwise.
*
* Since: 2.0
*/
ModulemdProfile *
modulemd_module_stream_v2_get_profile (ModulemdModuleStreamV2 *self,
const gchar *profile_name);
/**
* modulemd_module_stream_v2_search_profiles:
* @self: This #ModulemdModuleStreamV2 object.
* @profile_pattern: (nullable): A globbing pattern to locate one or more
* profiles in this #ModulemdModuleStreamV2 object. The names will be compared
* using [fnmatch(3)](https://www.mankier.com/3/fnmatch).
*
* Returns: (transfer container) (element-type ModulemdProfile): The list of
* #ModulemdProfile objects whose name matched @profile_pattern. This function
* cannot fail, but it may return a zero-length list if no matches were found.
* The returned profiles will be sorted alphabetically by profile name.
*/
GPtrArray *
modulemd_module_stream_v2_search_profiles (ModulemdModuleStreamV2 *self,
const gchar *profile_pattern);
/**
* modulemd_module_stream_v2_add_rpm_api:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @rpm: (in): The name of a binary RPM present in this module that is
* considered stable public API.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_rpm_api (ModulemdModuleStreamV2 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v2_remove_rpm_api:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @rpm: (in): A binary RPM name to remove from the list of stable public API.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_rpm_api (ModulemdModuleStreamV2 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v2_clear_rpm_api:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all RPMs from the list of stable public API.
*
* Since: 2.5
*/
void
modulemd_module_stream_v2_clear_rpm_api (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_api_as_strv: (rename-to modulemd_module_stream_v2_get_rpm_api)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of binary RPM names that
* form the public API of this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_rpm_api_as_strv (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_add_rpm_artifact:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @nevr: (in): The NEVR of a binary RPM present in this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_rpm_artifact (ModulemdModuleStreamV2 *self,
const gchar *nevr);
/**
* modulemd_module_stream_v2_remove_rpm_artifact:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @nevr: (in): An RPM NEVR to remove from the list of artifacts.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_rpm_artifact (ModulemdModuleStreamV2 *self,
const gchar *nevr);
/**
* modulemd_module_stream_v2_clear_rpm_artifacts:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all NPM NEVRs from the list of artifacts.
*
* Since: 2.5
*/
void
modulemd_module_stream_v2_clear_rpm_artifacts (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_artifacts_as_strv: (rename-to modulemd_module_stream_v2_get_rpm_artifacts)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of RPM NEVRs that are
* included in this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_rpm_artifacts_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_rpm_artifact_map_entry:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @entry: (in): The RPM map entry to save to the stream.
* @digest: (in): A string representing the digest algorithm used to generate
* the @checksum.
* @checksum: (in): An RPM artifact checksum.
*
* Since: 2.2
*/
void
modulemd_module_stream_v2_set_rpm_artifact_map_entry (
ModulemdModuleStreamV2 *self,
ModulemdRpmMapEntry *entry,
const gchar *digest,
const gchar *checksum);
/**
* modulemd_module_stream_v2_get_rpm_artifact_map_entry:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @digest: (in): A string representing the digest algorithm used to generate
* the @checksum.
* @checksum: (in): An RPM artifact checksum.
*
* Returns: (transfer none): The #ModulemdRpmMapEntry object associated with
* the provided @checksum generated by the provided @digest.
*
* Since: 2.2
*/
ModulemdRpmMapEntry *
modulemd_module_stream_v2_get_rpm_artifact_map_entry (
ModulemdModuleStreamV2 *self, const gchar *digest, const gchar *checksum);
/**
* modulemd_module_stream_v2_add_rpm_filter:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @rpm: (in): The name of a binary RPM to filter out of this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_rpm_filter (ModulemdModuleStreamV2 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v2_remove_rpm_filter:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @rpm: (in): A binary RPM name to remove from the filter list.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_remove_rpm_filter (ModulemdModuleStreamV2 *self,
const gchar *rpm);
/**
* modulemd_module_stream_v2_clear_rpm_filters:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all RPMs from the filter list.
*
* Since: 2.5
*/
void
modulemd_module_stream_v2_clear_rpm_filters (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_filters_as_strv: (rename-to modulemd_module_stream_v2_get_rpm_filters)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of binary RPM names that
* are filtered out of this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_rpm_filters_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_add_servicelevel:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @servicelevel: (in) (transfer none): A #ModulemdServiceLevel for this module stream.
*
* Adds a servicelevel definition to this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_servicelevel (
ModulemdModuleStreamV2 *self, ModulemdServiceLevel *servicelevel);
/**
* modulemd_module_stream_v2_clear_servicelevels:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Remove all servicelevels from this module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_clear_servicelevels (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_servicelevel_names_as_strv: (rename-to modulemd_module_stream_v2_get_servicelevel_names)
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer full): An ordered #GStrv list of servicelevel names
* associated with this module stream.
*
* Since: 2.0
*/
GStrv
modulemd_module_stream_v2_get_servicelevel_names_as_strv (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_servicelevel:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @servicelevel_name: (in): The name of a servicelevel to retrieve.
*
* Returns: (transfer none): The requested servicelevel definition if present in the
* module stream. NULL otherwise.
*
* Since: 2.0
*/
ModulemdServiceLevel *
modulemd_module_stream_v2_get_servicelevel (ModulemdModuleStreamV2 *self,
const gchar *servicelevel_name);
/**
* modulemd_module_stream_v2_add_dependencies:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @deps: (in): A #ModulemdDependencies object to add to the list for this
* module stream.
*
* Add a #ModulemdDependencies object to the list of dependencies for this
* module stream.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_add_dependencies (ModulemdModuleStreamV2 *self,
ModulemdDependencies *deps);
/**
* modulemd_module_stream_v2_clear_dependencies:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Empties the list of dependencies for this #ModulemdModuleStream.
*
* Since: 2.4
*/
void
modulemd_module_stream_v2_clear_dependencies (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_remove_dependencies:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @deps: (in): A #ModulemdDependencies object to remove from the list for this
* module stream.
*
* Removes all entries matching @deps from the array of #ModulemdDependencies
* objects.
*
* Since: 2.4
*/
void
modulemd_module_stream_v2_remove_dependencies (ModulemdModuleStreamV2 *self,
ModulemdDependencies *deps);
/**
* modulemd_module_stream_v2_get_dependencies:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Return the list of #ModulemdDependencies objects as a #GPtrArray.
*
* Returns: (transfer none) (element-type ModulemdDependencies): A list of
* all #ModulemdDependencies objects associated with this module stream.
*/
GPtrArray *
modulemd_module_stream_v2_get_dependencies (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_set_xmd:
* @self: (in): This #ModulemdModuleStreamV2 object.
* @xmd: (in) (transfer none): A #GVariant representing arbitrary YAML.
*
* Sets the eXtensible MetaData (XMD) for this module. XMD is arbitrary YAML
* data that will be set and returned as-is (with the exception that the
* ordering of mapping keys is not defined). Useful for carrying private data.
*
* This function assumes ownership of the XMD #GVariant and thus should not be
* freed by the caller.
*
* Since: 2.0
*/
void
modulemd_module_stream_v2_set_xmd (ModulemdModuleStreamV2 *self,
GVariant *xmd);
/**
* modulemd_module_stream_v2_get_xmd:
* @self: (in): This #ModulemdModuleStreamV2 object.
*
* Returns: (transfer none): The extensible metadata block as a #GVariant.
*/
GVariant *
modulemd_module_stream_v2_get_xmd (ModulemdModuleStreamV2 *self);
G_END_DECLS

View file

@ -0,0 +1,471 @@
/*
* 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 <glib-object.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "modulemd-deprecated.h"
G_BEGIN_DECLS
/**
* SECTION: modulemd-module-stream
* @title: Modulemd.ModuleStream
* @stability: stable
* @short_description: A parent class for all versions of #ModulemdModuleStream
* objects.
*/
/**
* ModulemdModuleStreamVersionEnum:
* @MD_MODULESTREAM_VERSION_ERROR: Represents an error handling module stream
* version.
* @MD_MODULESTREAM_VERSION_UNSET: Represents an unset module stream version.
* @MD_MODULESTREAM_VERSION_ONE: Represents v1 of the #ModulemdModuleStream
* metadata format.
* @MD_MODULESTREAM_VERSION_TWO: Represents v2 of the #ModulemdModuleStream
* metadata format.
* @MD_MODULESTREAM_VERSION_LATEST: Represents the highest-supported version of
* the #ModulemdModuleStream metadata format.
*
* Since: 2.0
*/
typedef enum
{
MD_MODULESTREAM_VERSION_ERROR = -1,
MD_MODULESTREAM_VERSION_UNSET = 0,
MD_MODULESTREAM_VERSION_ONE = 1,
MD_MODULESTREAM_VERSION_TWO = 2,
MD_MODULESTREAM_VERSION_LATEST = MD_MODULESTREAM_VERSION_TWO
} ModulemdModuleStreamVersionEnum;
#define MODULEMD_TYPE_MODULE_STREAM (modulemd_module_stream_get_type ())
G_DECLARE_DERIVABLE_TYPE (ModulemdModuleStream,
modulemd_module_stream,
MODULEMD,
MODULE_STREAM,
GObject)
struct _ModulemdModuleStreamClass
{
GObjectClass parent_class;
ModulemdModuleStream *(*copy) (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *module_stream);
gboolean (*validate) (ModulemdModuleStream *self, GError **error);
guint64 (*get_mdversion) (ModulemdModuleStream *self);
gboolean (*depends_on_stream) (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *stream_name);
gboolean (*build_depends_on_stream) (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *stream_name);
gboolean (*equals) (ModulemdModuleStream *self_1,
ModulemdModuleStream *self_2);
/* Padding to allow adding up to 7 new virtual functions without
* breaking ABI. */
gpointer padding[7];
};
/**
* modulemd_module_stream_new:
* @mdversion: (in): The metadata version of #ModulemdModuleStream to create.
* @module_name: (in) (nullable): The name of the module.
* @module_stream: (in) (nullable): The name of this stream. Optional.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream object of
* the requested metadata version.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_new (guint64 mdversion,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_module_stream_read_file:
* @path: (in): The path to a YAML document containing a module stream
* definition.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @module_name: (in) (nullable): An optional module name to override the
* document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @module_stream: (in) (nullable): An optional module stream name to override
* the document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @error: (out): A #GError that will return the reason for a failed read.
*
* Create a #ModulemdModuleStream object from a YAML file.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream object if
* the YAML file was valid and contained exactly one `document: modulemd`
* subdocument. NULL if the document fails validation or multiple documents are
* encountered and sets @error appropriately. See #ModulemdModuleIndex for
* functions to read in multiple-subdocument YAML.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_read_file (const gchar *path,
gboolean strict,
const gchar *module_name,
const gchar *module_stream,
GError **error);
/**
* modulemd_module_stream_read_string:
* @yaml_string: (in): A YAML document string containing a module stream
* definition.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @module_name: (in) (nullable): An optional module name to override the
* document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @module_stream: (in) (nullable): An optional module stream name to override
* the document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @error: (out): A #GError that will return the reason for a failed read.
*
* Create a #ModulemdModuleStream object from a YAML string.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream object if
* the YAML string was valid and contained exactly one `document: modulemd`
* subdocument. NULL if the document fails validation or multiple documents are
* encountered and sets @error appropriately. See #ModulemdModuleIndex for
* functions to read in multiple-subdocument YAML.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_read_string (const gchar *yaml_string,
gboolean strict,
const gchar *module_name,
const gchar *module_stream,
GError **error);
/**
* modulemd_module_stream_read_stream: (skip)
* @stream: (in): A YAML document as a FILE * containing a module stream
* definition.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @module_name: (in) (nullable): An optional module name to override the
* document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @module_stream: (in) (nullable): An optional module stream name to override
* the document on disk. Mostly useful in cases where the name is being
* auto-detected from git.
* @error: (out): A #GError that will return the reason for a failed read.
*
* Create a #ModulemdModuleStream object from a YAML file.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream object if
* the YAML file was valid and contained exactly one `document: modulemd`
* subdocument. NULL if the document fails validation or multiple documents are
* encountered and sets NULL appropriately. See #ModulemdModuleIndex for
* functions to read in multiple-subdocument YAML.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_read_stream (FILE *stream,
gboolean strict,
const gchar *module_name,
const gchar *module_stream,
GError **error);
/**
* modulemd_module_stream_equals:
* @self_1: (in): A #ModulemdModuleStream object.
* @self_2: (in): A #ModulemdModuleStream object.
*
* Checks if @self_1 and @self_2 are identical objects.
*
* Returns: TRUE, If both objects are equal. FALSE, otherwise.
*
* Since: 2.3
*/
gboolean
modulemd_module_stream_equals (ModulemdModuleStream *self_1,
ModulemdModuleStream *self_2);
/**
* modulemd_module_stream_copy:
* @self: (in): This #ModulemdModuleStream object.
* @module_name: (in) (nullable): An optional new name for the module of the
* copied stream.
* @module_stream: (in) (nullable): An optional new name for the copied stream.
*
* Copies a #ModulemdModuleStream, optionally assigning it a new stream name in
* the process.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream object
* that is a complete copy of @self, optionally with a new stream name.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_copy (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *module_stream);
/**
* modulemd_module_stream_upgrade:
* @self: (in): This #ModulemdModuleStream object.
* @mdversion: (in): The metadata version to upgrade to. If zero, upgrades to
* the highest-supported version.
* @error: (out): A #GError that will return the reason for an upgrade error.
*
* Return an upgraded copy of this object. Does not modify the original.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleStream copy of
* this object upgraded to the requested version. Returns NULL and sets @error
* appropriately if the upgrade could not be completed automatically.
*
* Since: 2.0
*/
ModulemdModuleStream *
modulemd_module_stream_upgrade (ModulemdModuleStream *self,
guint64 mdversion,
GError **error);
/**
* modulemd_module_stream_validate:
* @self: (in): This #ModulemdModuleStream object.
* @error: (out): A #GError that will return the reason for a validation error.
*
* Verifies that all stored values are internally consistent and that the
* module is sufficiently-complete for emitting. This function is called
* implicitly before attempting to emit the contents.
*
* Returns: TRUE if the #ModulemdModuleStream passed validation. FALSE and sets
* @error appropriately if validation fails.
*
* Since: 2.0
*/
gboolean
modulemd_module_stream_validate (ModulemdModuleStream *self, GError **error);
/**
* modulemd_module_stream_get_mdversion:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: The metadata version of this #ModulemdModuleStream.
*
* Since: 2.0
*/
guint64
modulemd_module_stream_get_mdversion (ModulemdModuleStream *self);
/**
* modulemd_module_stream_get_module_name:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: (transfer none): The name of the module.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_get_module_name (ModulemdModuleStream *self);
/**
* modulemd_module_stream_get_stream_name:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: (transfer none): The name of this stream.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_get_stream_name (ModulemdModuleStream *self);
/**
* modulemd_module_stream_set_version:
* @self: (in): This #ModulemdModuleStream object.
* @version: (in): The version of this #ModulemdModuleStream.
*
* Since: 2.0
*/
void
modulemd_module_stream_set_version (ModulemdModuleStream *self,
guint64 version);
/**
* modulemd_module_stream_get_version:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: The version of this #ModulemdModuleStream.
*/
guint64
modulemd_module_stream_get_version (ModulemdModuleStream *self);
/**
* modulemd_module_stream_set_context:
* @self: (in): This #ModulemdModuleStream object.
* @context: (in) (nullable): Module context flag.
* The context flag serves to distinguish module builds with the same name,
* stream and version and plays an important role in automatic module stream
* name expansion.
*
* Since: 2.0
*/
void
modulemd_module_stream_set_context (ModulemdModuleStream *self,
const gchar *context);
/**
* modulemd_module_stream_get_context:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: (transfer none): Module context flag.
* The context flag serves to distinguish module builds with the same name,
* stream and version and plays an important role in automatic module stream
* name expansion.
*
* Since: 2.0
*/
const gchar *
modulemd_module_stream_get_context (ModulemdModuleStream *self);
/**
* modulemd_module_stream_set_arch:
* @self: (in): This #ModulemdModuleStream object.
* @arch: (in) (nullable): Module architecture.
* Indicates to which processor architecture this #ModulemdModuleStream
* applies.
*
* Since: 2.2
*/
void
modulemd_module_stream_set_arch (ModulemdModuleStream *self,
const gchar *arch);
/**
* modulemd_module_stream_get_arch:
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: (transfer none): Module architecture object.
* Indicates to which processor architecture this #ModulemdModuleStream
* applies.
*
* Since: 2.2
*/
const gchar *
modulemd_module_stream_get_arch (ModulemdModuleStream *self);
/**
* modulemd_module_stream_get_nsvc_as_string: (rename-to modulemd_module_stream_get_nsvc)
* @self: (in): This #ModulemdModuleStream object.
*
* Retrieves a representation of the module name, stream name, version and
* context of this #ModulemdModuleStream in the form
* `module_name:stream_name:version:context`. Note that this excludes the
* architecture of the module stream and as such is not guaranteed to be unique
* within a repository.
*
* Returns: (transfer full): The NSVC (name:stream:version[:context]) of this
* module stream. NULL if module name or stream stream is unknown.
*
* Since: 2.0
*/
gchar *
modulemd_module_stream_get_nsvc_as_string (ModulemdModuleStream *self);
/**
* modulemd_module_stream_get_NSVCA_as_string: (rename-to modulemd_module_stream_get_NSVCA)
* @self: (in): This #ModulemdModuleStream object.
*
* Returns: (transfer full): The NSVCA of this module stream. The returned
* format is described
* [here](https://docs.fedoraproject.org/en-US/modularity/architecture/consuming/naming-policy/#_forms).
* NULL if module name or stream stream is unknown.
*
* Since: 2.2
*/
gchar *
modulemd_module_stream_get_NSVCA_as_string (ModulemdModuleStream *self);
/**
* modulemd_module_stream_depends_on_stream:
* @self: (not nullable): This #ModulemdModuleStream object.
* @module_name: (not nullable): A module name.
* @stream_name: (not nullable): The stream of the module.
*
* Returns: TRUE if any of the #ModulemdDependencies objects associated with
* this module applies to the provided module name and stream in the runtime
* dependencies.
*
* Since: 2.1
*
* Stability: unstable
*/
gboolean
modulemd_module_stream_depends_on_stream (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *stream_name);
/**
* modulemd_module_stream_build_depends_on_stream:
* @self: (not nullable): This #ModulemdModuleStream object.
* @module_name: (not nullable): A module name.
* @stream_name: (not nullable): The stream of the module.
*
* Returns: TRUE if any of the #ModulemdDependencies objects associated with
* this module applies to the provided module name and stream in the build-time
* dependencies.
*
* Since: 2.1
*
* Stability: unstable
*/
gboolean
modulemd_module_stream_build_depends_on_stream (ModulemdModuleStream *self,
const gchar *module_name,
const gchar *stream_name);
G_END_DECLS

View file

@ -0,0 +1,339 @@
/*
* 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.
*
* 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 occured
* 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);
G_END_DECLS

View file

@ -0,0 +1,257 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2020 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-obsoletes
* @title: Modulemd.Obsoletes
* @stability: stable
* @short_description: Obsoletes information for a module stream.
*/
#define MODULEMD_TYPE_OBSOLETES (modulemd_obsoletes_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdObsoletes, modulemd_obsoletes, MODULEMD, OBSOLETES, GObject)
/**
* ModulemdObsoletesVersionEnum:
* @MD_OBSOLETES_VERSION_ERROR: Represents an error handling mdversion.
* @MD_OBSOLETES_VERSION_UNSET: Represents an unset mdversion.
* @MD_OBSOLETES_VERSION_ONE: Represents v1 of the #ModulemdObsoletes metadata
* format.
* @MD_OBSOLETES_VERSION_LATEST: Represents the highest-supported version of the
* #ModulemdObsoletes metadata format.
*
* Since: 2.10
*/
typedef enum
{
MD_OBSOLETES_VERSION_ERROR = -1,
MD_OBSOLETES_VERSION_UNSET = 0,
MD_OBSOLETES_VERSION_ONE = 1,
MD_OBSOLETES_VERSION_LATEST = MD_OBSOLETES_VERSION_ONE,
} ModulemdObsoletesVersionEnum;
/**
* modulemd_obsoletes_new:
* @mdversion: (in): The metadata version of this #ModulemdObsoletes.
* @modified: (in): The last modified time represented as a 64-bit integer (such as
* 201807011200).
* @module_name: (in): The name of the module to which this obsoletes applies.
* @module_stream: (in): The name of the module stream to which this obsoletes applies.
* @message: (in): A string describing the change, reason, etc.
*
* Returns: (transfer full): A newly-allocated #ModulemdObsoletes object.
* This object must be freed with g_object_unref().
*
* Since: 2.10
*/
ModulemdObsoletes *
modulemd_obsoletes_new (guint64 mdversion,
guint64 modified,
const gchar *module_name,
const gchar *module_stream,
const gchar *message);
/**
* modulemd_obsoletes_copy:
* @self: (in): This #ModulemdObsoletes object.
*
* Create a copy of this #ModulemdObsoletes object.
*
* Returns: (transfer full): The copied #ModulemdObsoletes object.
*
* Since: 2.10
*/
ModulemdObsoletes *
modulemd_obsoletes_copy (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_validate:
* @self: (in): This #ModulemdObsoletes object.
* @error: (out): If the object is not valid, it will return the reason.
*
* This method ensures that the obsoletes is internally consistent for usage
* or dumping to YAML. It will be run implicitly prior to emitting YAML. This
* is not a complete linter, merely a sanity check that the values are not
* impossible.
*
* Since: 2.10
*/
gboolean
modulemd_obsoletes_validate (ModulemdObsoletes *self, GError **error);
/**
* modulemd_obsoletes_get_module_context:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: (transfer none): The context name to which this #ModulemdObsoletes object applies.
*
* Since: 2.10
*/
const gchar *
modulemd_obsoletes_get_module_context (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_set_module_context:
* @self: This #ModulemdObsoletes object.
* @module_context: (in) (nullable): The name of the module context to which this obsoletes
* applies.
*
* Since: 2.10
*/
void
modulemd_obsoletes_set_module_context (ModulemdObsoletes *self,
const gchar *module_context);
/**
* modulemd_obsoletes_set_modified:
* @self: This #ModulemdObsoletes object.
* @modified: (in): The last modified time represented as a 64-bit integer (such as
* 201807011200).
*
* Since: 2.10
*/
void
modulemd_obsoletes_set_modified (ModulemdObsoletes *self, guint64 modified);
/**
* modulemd_obsoletes_set_reset:
* @self: This #ModulemdObsoletes object.
* @reset: (in): Whether to reset/cancel all previously specified obsoletes.
*
* Sets the reset attribute on #ModulemdObsoletes object. With this boolean attribute set the
* obsoletes resets (cancels out) all previously specified obsoletes.
*
* Since: 2.10
*/
void
modulemd_obsoletes_set_reset (ModulemdObsoletes *self, gboolean reset);
/**
* modulemd_obsoletes_get_reset:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: Whether this #ModulemdObsoletes object cancels/resets all previously specified obsoletes.
*
* Since: 2.10
*/
gboolean
modulemd_obsoletes_get_reset (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_set_eol_date:
* @self: This #ModulemdObsoletes object.
* @eol_date: (in): The end-of-life date for this stream. If set to zero, the stream is
* EOLed immediately.
*
* Since: 2.10
*/
void
modulemd_obsoletes_set_eol_date (ModulemdObsoletes *self, guint64 eol_date);
/**
* modulemd_obsoletes_get_eol_date:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: A date represented as a 64-bit integer (such as 201807011200).
*
* Since: 2.10
*/
guint64
modulemd_obsoletes_get_eol_date (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_get_message:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: (transfer none): The message associated with this #ModulemdObsoletes object
*
* Since: 2.10
*/
const gchar *
modulemd_obsoletes_get_message (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_set_obsoleted_by:
* @self: This #ModulemdObsoletes object.
* @obsoleted_by_module_name: (in): The module name of obsoleting stream.
* @obsoleted_by_module_stream: (in): The module stream of obsoleting stream.
*
* Sets both obsoleted by module name and stream because having one without
* the other is invalid.
*
* Since: 2.10
*/
void
modulemd_obsoletes_set_obsoleted_by (ModulemdObsoletes *self,
const gchar *obsoleted_by_module_name,
const gchar *obsoleted_by_module_stream);
/**
* modulemd_obsoletes_get_obsoleted_by_module_name:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: (transfer none): The module name of obsoleting stream.
*
* Since: 2.10
*/
const gchar *
modulemd_obsoletes_get_obsoleted_by_module_name (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_get_obsoleted_by_module_stream:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: (transfer none): The module stream of obsoleting stream.
*
* Since: 2.10
*/
const gchar *
modulemd_obsoletes_get_obsoleted_by_module_stream (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_get_modified:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: The last modified time of this #ModulemdObsoletes object
* represented as a 64-bit integer (such as 201807011200).
*
* Since: 2.10
*/
guint64
modulemd_obsoletes_get_modified (ModulemdObsoletes *self);
/**
* modulemd_obsoletes_is_active:
* @self: (in): This #ModulemdObsoletes object.
*
* Returns: If this #ModulemdObsoletes object has eol_date set and the
* date has not occured yet it returns false otherwise it returns true.
* (When eol_date is not set or it already occured the obsoletes is active.)
*
* Since: 2.10
*/
gboolean
modulemd_obsoletes_is_active (ModulemdObsoletes *self);
G_END_DECLS

View file

@ -0,0 +1,164 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-profile
* @title: Modulemd.Profile
* @stability: stable
* @short_description: Stores profile information for a module stream.
*/
#define MODULEMD_TYPE_PROFILE (modulemd_profile_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdProfile, modulemd_profile, MODULEMD, PROFILE, GObject)
/**
* modulemd_profile_equals:
* @self_1: A #ModulemdProfile object.
* @self_2: A #ModulemdProfile object.
*
* Returns: TRUE, if all elements of @self_1 and @self_2 are equal. FALSE,
* otherwise.
*
* Since: 2.2
*/
gboolean
modulemd_profile_equals (ModulemdProfile *self_1, ModulemdProfile *self_2);
/**
* modulemd_profile_new:
* @name: (not nullable): The name of this profile.
*
* Returns: (transfer full): A newly-allocated #ModulemdProfile object. This
* object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdProfile *
modulemd_profile_new (const gchar *name);
/**
* modulemd_profile_copy:
* @self: This #ModulemdProfile object.
*
* Create a copy of this #ModulemdProfile object.
*
* Returns: (transfer full): The copied #ModulemdProfile object.
*
* Since: 2.0
*/
ModulemdProfile *
modulemd_profile_copy (ModulemdProfile *self);
/**
* modulemd_profile_get_name:
* @self: This #ModulemdProfile object.
*
* Returns: (transfer none): The name of this profile.
*
* Since: 2.0
*/
const gchar *
modulemd_profile_get_name (ModulemdProfile *self);
/**
* modulemd_profile_set_description:
* @self: This #ModulemdProfile object.
* @description: (nullable): The untranslated description of this profile.
*
* Since: 2.0
*/
void
modulemd_profile_set_description (ModulemdProfile *self,
const gchar *description);
/**
* modulemd_profile_get_description:
* @self: This #ModulemdProfile object.
* @locale: (in) (nullable): The name of the locale to use when translating
* the string. If NULL, it will determine the locale with a system call to
* `setlocale(LC_MESSAGES, NULL)` and return that. If the caller wants the
* untranslated string, they should pass `"C"` for the locale.
*
* Returns: (transfer none): The description of this profile translated into
* the language specified by the locale if it is available, otherwise it
* returns the C.UTF-8 original. Translation information is managed by the
* #ModulemdTranslation and #ModulemdTranslationEntry objects.
*
* Since: 2.0
*/
const gchar *
modulemd_profile_get_description (ModulemdProfile *self, const gchar *locale);
/**
* modulemd_profile_add_rpm:
* @self: This #ModulemdProfile object.
* @rpm: The name of a binary RPM that should be installed when this profile is
* selected for installation.
*
* Since: 2.0
*/
void
modulemd_profile_add_rpm (ModulemdProfile *self, const gchar *rpm);
/**
* modulemd_profile_remove_rpm:
* @self: This #ModulemdProfile object.
* @rpm: The name of a binary RPM to remove from this profile.
*
* Since: 2.0
*/
void
modulemd_profile_remove_rpm (ModulemdProfile *self, const gchar *rpm);
/**
* modulemd_profile_clear_rpms:
* @self: This #ModulemdProfile object.
*
* Remove all RPMs from this profile.
*
* Since: 2.5
*/
void
modulemd_profile_clear_rpms (ModulemdProfile *self);
/**
* modulemd_profile_get_rpms_as_strv: (rename-to modulemd_profile_get_rpms)
* @self: This #ModulemdProfile object.
*
* Returns: (transfer full): An ordered #GStrv list of binary RPMS that would be
* installed when this profile is selected for installation.
*
* Since: 2.0
*/
GStrv
modulemd_profile_get_rpms_as_strv (ModulemdProfile *self);
G_END_DECLS

View file

@ -0,0 +1,228 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-rpm-map-entry
* @title: Modulemd.RpmMapEntry
* @stability: stable
* @short_description: Provides an exploded and unexploded view of the NEVRA of
* an RPM artifact.
*/
#define MODULEMD_TYPE_RPM_MAP_ENTRY (modulemd_rpm_map_entry_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdRpmMapEntry,
modulemd_rpm_map_entry,
MODULEMD,
RPM_MAP_ENTRY,
GObject)
/**
* modulemd_rpm_map_entry_new:
* @name: The name of the package.
* @epoch: The epoch of the package.
* @version: The version of the package.
* @release: The release string of the package.
* @arch: The processor architecture of the package.
*
* Create a new rpm-map entry. This will contain the decomposed NEVRA of an
* RPM artifact.
*
* Returns: (transfer full): A newly-allocated #ModulemdRpmMapEntry object with
* the provided values.
*/
ModulemdRpmMapEntry *
modulemd_rpm_map_entry_new (const gchar *name,
guint64 epoch,
const gchar *version,
const gchar *release,
const gchar *arch);
/**
* modulemd_rpm_map_entry_copy:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer full): A deep copy of this #ModulemdRpmMapEntry object.
*
* Since: 2.2
*/
ModulemdRpmMapEntry *
modulemd_rpm_map_entry_copy (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_equals:
* @self: A #ModulemdRpmMapEntry object.
* @other: Another #ModulemdRpmMapEntry object.
*
* Returns: TRUE if the two entries contain equivalent data. FALSE if they
* differ.
*
* Since: 2.2
*/
gboolean
modulemd_rpm_map_entry_equals (ModulemdRpmMapEntry *self,
ModulemdRpmMapEntry *other);
/**
* modulemd_rpm_map_entry_validate:
* @self: This #ModulemdRpmMapEntry object.
* @error: (out): A #GError containing the reason the object failed validation.
* NULL if the validation passed.
*
* Since: 2.2
*/
gboolean
modulemd_rpm_map_entry_validate (ModulemdRpmMapEntry *self, GError **error);
/**
* modulemd_rpm_map_entry_set_name:
* @self: This #ModulemdRpmMapEntry object.
* @name: The package name of this RPM.
*
* Since: 2.2
*/
void
modulemd_rpm_map_entry_set_name (ModulemdRpmMapEntry *self, const gchar *name);
/**
* modulemd_rpm_map_entry_get_name:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer none): The package name of this RPM.
*
* Since: 2.2
*/
const gchar *
modulemd_rpm_map_entry_get_name (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_set_epoch:
* @self: This #ModulemdRpmMapEntry object.
* @epoch: The package epoch of this RPM.
*
* Since: 2.2
*/
void
modulemd_rpm_map_entry_set_epoch (ModulemdRpmMapEntry *self, guint64 epoch);
/**
* modulemd_rpm_map_entry_get_epoch:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: The package epoch of this RPM.
*
* Since: 2.2
*/
guint64
modulemd_rpm_map_entry_get_epoch (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_set_version:
* @self: This #ModulemdRpmMapEntry object.
* @version: The package version of this RPM.
*
* Since: 2.2
*/
void
modulemd_rpm_map_entry_set_version (ModulemdRpmMapEntry *self,
const gchar *version);
/**
* modulemd_rpm_map_entry_get_version:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer none): The package version of this RPM.
*
* Since: 2.2
*/
const gchar *
modulemd_rpm_map_entry_get_version (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_set_release:
* @self: This #ModulemdRpmMapEntry object.
* @release: The package release string of this RPM.
*
* Since: 2.2
*/
void
modulemd_rpm_map_entry_set_release (ModulemdRpmMapEntry *self,
const gchar *release);
/**
* modulemd_rpm_map_entry_get_release:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer none): The package release of this RPM.
*
* Since: 2.2
*/
const gchar *
modulemd_rpm_map_entry_get_release (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_set_arch:
* @self: This #ModulemdRpmMapEntry object.
* @arch: The package architecture of this RPM.
*
* Since: 2.2
*/
void
modulemd_rpm_map_entry_set_arch (ModulemdRpmMapEntry *self, const gchar *arch);
/**
* modulemd_rpm_map_entry_get_arch:
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer none): The package architecture of this RPM.
*
* Since: 2.2
*/
const gchar *
modulemd_rpm_map_entry_get_arch (ModulemdRpmMapEntry *self);
/**
* modulemd_rpm_map_entry_get_nevra_as_string: (rename-to modulemd_rpm_map_entry_get_nevra)
* @self: This #ModulemdRpmMapEntry object.
*
* Returns: (transfer full): A newly-allocated string containing the complete
* N-E:V-R.A constructed from the component parts. NULL if any field is
* missing.
*
* Since: 2.2
*/
gchar *
modulemd_rpm_map_entry_get_nevra_as_string (ModulemdRpmMapEntry *self);
G_END_DECLS

View file

@ -0,0 +1,155 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 Stephen Gallagher
*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-service-level
* @title: Modulemd.ServiceLevel
* @stability: stable
* @short_description: Provides lifecycle information for a module stream.
*/
#define MODULEMD_TYPE_SERVICE_LEVEL (modulemd_service_level_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdServiceLevel,
modulemd_service_level,
MODULEMD,
SERVICE_LEVEL,
GObject)
/**
* modulemd_service_level_new:
* @name: (not nullable): The name of the service level.
*
* Returns: (transfer full): A newly-allocated #ModulemdServiceLevel object.
* This object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdServiceLevel *
modulemd_service_level_new (const gchar *name);
/**
* modulemd_service_level_copy:
* @self: This #ModulemdServiceLevel object.
*
* Create a copy of this #ModulemdServiceLevel object.
*
* Returns: (transfer full): The copied #ModulemdServiceLevel object.
*
* Since: 2.0
*/
ModulemdServiceLevel *
modulemd_service_level_copy (ModulemdServiceLevel *self);
/**
* modulemd_service_level_get_name:
* @self: This #ModulemdServiceLevel object.
*
* Get the name of this service level.
*
* Returns: (transfer none): The name of this service level. This is a pointer
* to the internal memory location and must not be freed.
*
* Since: 2.0
*/
const gchar *
modulemd_service_level_get_name (ModulemdServiceLevel *self);
/**
* modulemd_service_level_set_eol:
* @self: This #ModulemdServiceLevel object.
* @date: (nullable): The date this service level ends.
*
* Sets the end date of the service level. If the #GDate passed in is invalid
* or NULL, the EOL will be unset.
*
* Since: 2.0
*/
void
modulemd_service_level_set_eol (ModulemdServiceLevel *self, GDate *date);
/**
* modulemd_service_level_set_eol_ymd:
* @self: This #ModulemdServiceLevel object.
* @year: The year this service level ends.
* @month: The month this service level ends.
* @day: The day of the month this service level ends.
*
* Since: 2.0
*/
void
modulemd_service_level_set_eol_ymd (ModulemdServiceLevel *self,
GDateYear year,
GDateMonth month,
GDateDay day);
/**
* modulemd_service_level_remove_eol:
* @self: This #ModulemdServiceLevel object.
*
* Remove the EOL from this Service Level.
*
* Since: 2.0
*/
void
modulemd_service_level_remove_eol (ModulemdServiceLevel *self);
/**
* modulemd_service_level_get_eol:
* @self: This #ModulemdServiceLevel object.
*
* Returns: (transfer none): The end date of the service level as a #GDate.
*
* Since: 2.0
*/
GDate *
modulemd_service_level_get_eol (ModulemdServiceLevel *self);
/**
* modulemd_service_level_get_eol_as_string:
* @self: This #ModulemdServiceLevel object.
*
* Returns: (transfer full) (nullable): The end date of the service level as a
* string of the form "YYYY-MM-DD" or NULL if the date is unset or invalid.
*
* Since: 2.0
*/
gchar *
modulemd_service_level_get_eol_as_string (ModulemdServiceLevel *self);
/**
* modulemd_service_level_equals:
* @self_1: A #ModulemdServiceLevel object.
* @self_2: A #ModulemdServiceLevel object.
*
* Returns: TRUE if both the dates are either NULL or valid, FALSE otherwise.
*
* Since: 2.2
*/
gboolean
modulemd_service_level_equals (ModulemdServiceLevel *self_1,
ModulemdServiceLevel *self_2);
G_END_DECLS

View file

@ -0,0 +1,60 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-subdocument-info
* @title: Modulemd.SubdocumentInfo
* @stability: stable
* @short_description: Stores information regarding a YAML subdocument in a stream.
*/
#define MODULEMD_TYPE_SUBDOCUMENT_INFO (modulemd_subdocument_info_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdSubdocumentInfo,
modulemd_subdocument_info,
MODULEMD,
SUBDOCUMENT_INFO,
GObject)
/**
* modulemd_subdocument_info_get_yaml:
* @self: This #ModulemdSubdocumentInfo object.
*
* Returns: (transfer none): The associated YAML subdocument.
*
* Since: 2.0
*/
const gchar *
modulemd_subdocument_info_get_yaml (ModulemdSubdocumentInfo *self);
/**
* modulemd_subdocument_info_get_gerror:
* @self: This #ModulemdSubdocumentInfo object.
*
* Returns: (transfer none): A #GError containing an error code and message
* about why this subdocument failed parsing.
*
* Since: 2.0
*/
const GError *
modulemd_subdocument_info_get_gerror (ModulemdSubdocumentInfo *self);
G_END_DECLS

View file

@ -0,0 +1,181 @@
/*
* 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 <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-translation-entry
* @title: Modulemd.TranslationEntry
* @stability: stable
* @short_description: Contains the translated strings of a module stream for a specific locale.
*/
#define MODULEMD_TYPE_TRANSLATION_ENTRY \
(modulemd_translation_entry_get_type ())
G_DECLARE_FINAL_TYPE (ModulemdTranslationEntry,
modulemd_translation_entry,
MODULEMD,
TRANSLATION_ENTRY,
GObject)
/**
* modulemd_translation_entry_new:
* @locale: (not nullable): The locale for this translation entry.
* It must correspond to the format specified by libc locale names.
*
* Returns: (transfer full): A newly-allocated #ModulemdTranslationEntry
* object. This object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdTranslationEntry *
modulemd_translation_entry_new (const gchar *locale);
/**
* modulemd_translation_entry_copy:
* @self: This #ModulemdTranslationEntry object.
*
* Create a copy of this #ModulemdTranslationEntry object.
*
* Returns: (transfer full): The copied #ModulemdTranslationEntry object.
*
* Since: 2.0
*/
ModulemdTranslationEntry *
modulemd_translation_entry_copy (ModulemdTranslationEntry *self);
/**
* modulemd_translation_entry_get_locale:
* @self: This #ModulemdTranslationEntry object.
*
* Get the locale of this translation entry.
*
* Returns: (transfer none): The locale of this translation entry. This is a pointer
* to the internal memory location and must not be freed.
*
* Since: 2.0
*/
const gchar *
modulemd_translation_entry_get_locale (ModulemdTranslationEntry *self);
/**
* modulemd_translation_entry_set_summary:
* @self: This #ModulemdTranslationEntry object.
* @summary: (nullable): The summary of this module translated appropriately
* for this locale.
*
* Since: 2.0
*/
void
modulemd_translation_entry_set_summary (ModulemdTranslationEntry *self,
const gchar *summary);
/**
* modulemd_translation_entry_get_summary:
* @self: This #ModulemdTranslationEntry object.
*
* Get the summary of this translation entry.
*
* Returns: (transfer none): The summary of this module stream translated into
* the language specified by locale.
*
* Since: 2.0
*/
const gchar *
modulemd_translation_entry_get_summary (ModulemdTranslationEntry *self);
/**
* modulemd_translation_entry_set_description:
* @self: This #ModulemdTranslationEntry object.
* @description: (nullable): The description of this module stream translated
* into the language specified by locale.
*
* Since: 2.0
*/
void
modulemd_translation_entry_set_description (ModulemdTranslationEntry *self,
const char *description);
/**
* modulemd_translation_entry_get_description:
* @self: This #ModulemdTranslationEntry object.
*
* Get the description of this translation entry.
*
* Returns: (transfer none): The description of this module stream translated
* into the language specified by locale.
*
* Since: 2.0
*/
const gchar *
modulemd_translation_entry_get_description (ModulemdTranslationEntry *self);
/**
* modulemd_translation_entry_get_profiles_as_strv: (rename-to modulemd_translation_entry_get_profiles)
* @self: This #ModulemdTranslationEntry object.
*
* Get a list of profiles that have descriptions.
*
* Returns: (transfer full): An ordered #GStrv list of profiles for which
* descriptions have been translated for this locale.
*
* Since: 2.0
*/
GStrv
modulemd_translation_entry_get_profiles_as_strv (
ModulemdTranslationEntry *self);
/**
* modulemd_translation_entry_set_profile_description:
* @self: This #ModulemdTranslationEntry object.
* @profile_name: The name of the profile.
* @profile_description: (nullable): The translated description of the profile.
*
* Adds a profile name translation.
*
* Since: 2.0
*/
void
modulemd_translation_entry_set_profile_description (
ModulemdTranslationEntry *self,
const gchar *profile_name,
const gchar *profile_description);
/**
* module_translation_entry_get_profile_description:
* @self: This #ModulemdTranslationEntry object.
* @profile_name: The name of the profile whose description is being translated.
*
* Returns: (transfer none): The description for the specified profile.
*
* Since: 2.0
*/
const gchar *
modulemd_translation_entry_get_profile_description (
ModulemdTranslationEntry *self, const gchar *profile_name);
G_END_DECLS

View file

@ -0,0 +1,134 @@
/*
* 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-translation-entry.h"
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION: modulemd-translation
* @title: Modulemd.Translation
* @stability: stable
* @short_description: Translation information for a module stream.
*/
#define MODULEMD_TYPE_TRANSLATION (modulemd_translation_get_type ())
G_DECLARE_FINAL_TYPE (
ModulemdTranslation, modulemd_translation, MODULEMD, TRANSLATION, GObject)
/**
* modulemd_translation_new:
* @version: The metadata version of this #ModulemdTranslation.
* @module_name: The name of the module to which these translations apply.
* @module_stream: The name of the module stream to which these translations apply.
* @modified: The last modified time represented as a 64-bit integer (such as
* 201807011200).
*
* Returns: (transfer full): A newly-allocated #ModulemdTranslation object.
* This object must be freed with g_object_unref().
*
* Since: 2.0
*/
ModulemdTranslation *
modulemd_translation_new (guint64 version,
const gchar *module_name,
const gchar *module_stream,
guint64 modified);
/**
* modulemd_translation_copy:
* @self: This #ModulemdTranslation object.
*
* Create a copy of this #ModulemdTranslation object.
*
* Returns: (transfer full): The copied #ModulemdTranslation object.
*
* Since: 2.0
*/
ModulemdTranslation *
modulemd_translation_copy (ModulemdTranslation *self);
/**
* modulemd_translation_validate:
* @self: This #ModulemdTranslation object.
* @error: (out): If the object is not valid, it will return the reason.
*
* This method ensures that the translation is internally consistent for usage
* or dumping to YAML. It will be run implicitly prior to emitting YAML. This
* is not a complete linter, merely a sanity check that the values are not
* impossible.
*
* Since: 2.0
*/
gboolean
modulemd_translation_validate (ModulemdTranslation *self, GError **error);
/**
* modulemd_translation_set_modified:
* @self: This #ModulemdTranslation object.
* @modified: The last modified time represented as a 64-bit integer (such as
* 201807011200).
*
* Since: 2.0
*/
void
modulemd_translation_set_modified (ModulemdTranslation *self,
guint64 modified);
/**
* modulemd_translation_get_locales_as_strv: (rename-to modulemd_translation_get_locales)
* @self: This #ModulemdTranslation object.
*
* Returns: (transfer full): An ordered #GStrv list of locales known to this
* #ModulemdTranslation.
*
* Since: 2.0
*/
GStrv
modulemd_translation_get_locales_as_strv (ModulemdTranslation *self);
/**
* modulemd_translation_set_translation_entry:
* @self: This #ModulemdTranslation object.
* @translation_entry: A set of translations of this module stream for a particular locale.
*
* Since: 2.0
*/
void
modulemd_translation_set_translation_entry (
ModulemdTranslation *self, ModulemdTranslationEntry *translation_entry);
/**
* modulemd_translation_get_translation_entry:
* @self: This #ModulemdTranslation object.
* @locale: The locale of the translation to retrieve.
*
* Returns: (transfer none): The translation entry for the requested locale, or NULL if the locale was unknown.
*
* Since: 2.0
*/
ModulemdTranslationEntry *
modulemd_translation_get_translation_entry (ModulemdTranslation *self,
const gchar *locale);
G_END_DECLS

View file

@ -0,0 +1,343 @@
/*
* 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-buildopts.h"
#include "modulemd-component-module.h"
#include "modulemd-component-rpm.h"
#include "modulemd-component.h"
#include "modulemd-compression.h"
#include "modulemd-defaults-v1.h"
#include "modulemd-defaults.h"
#include "modulemd-dependencies.h"
#include "modulemd-deprecated.h"
#include "modulemd-errors.h"
#include "modulemd-module-index-merger.h"
#include "modulemd-module-index.h"
#include "modulemd-module-stream-v1.h"
#include "modulemd-module-stream-v2.h"
#include "modulemd-module-stream.h"
#include "modulemd-module.h"
#include "modulemd-profile.h"
#include "modulemd-rpm-map-entry.h"
#include "modulemd-service-level.h"
#include "modulemd-subdocument-info.h"
#include "modulemd-translation-entry.h"
#include "modulemd-translation.h"
G_BEGIN_DECLS
/**
* SECTION: modulemd
* @title: Modulemd
* @stability: stable
* @short_description: User's Guide for libmodulemd
*
* # Working with repodata (DNF use-case)
* The libmodulemd API provides a number of convenience tools for interacting
* with repodata (that is, streams of YAML that contains information on multiple
* streams, default data and translations). The documentation will use two
* repositories, called "fedora" and "updates" for demonstrative purposes. It
* will assume that the content of the YAML module metadata from those two
* repositories have been loaded into string variables `fedora_yaml` and
* `updates_yaml`, respectively.
*
* First step is to load the metadata from these two repositories into
* #ModulemdModuleIndex objects. This is done as follows:
*
* In C:
* |[<!-- language="C" -->
* ModulemdModuleIndex *fedora_index = modulemd_module_index_new ();
* gboolean ret = modulemd_module_index_update_from_string (
* fedora_index, fedora_yaml, TRUE, &failures, &error);
*
* ModulemdModuleIndex *updates_index = modulemd_module_index_new ();
* gboolean ret2 = modulemd_module_index_update_from_string (
* updates_index, updates_yaml, TRUE, &failures, &error);
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* fedora_index = Modulemd.ModuleIndex.new()
* ret, failures = fedora_index.update_from_string(fedora_yaml, True)
*
* updates_index = Modulemd.ModuleIndex.new()
* ret, failures = updates_index.update_from_string(updates_yaml, True)
* ]|
*
* The @failures are a list of subdocuments in the YAML that failed parsing,
* along with the reason they failed. Hence, by checking the return value of
* @failures we will know if the YAML parsing was successful or not.
*
* Since it doesn't really make sense to view the contents from separate
* repositories in isolation (in most cases), the next step is to merge the two
* indexes into a combined one:
*
* In C:
* |[<!-- language="C" -->
* ModulemdModuleIndexMerger *merger = modulemd_module_index_merger_new ();
*
* modulemd_module_index_merger_associate_index (merger, fedora_index, 0);
* modulemd_module_index_merger_associate_index (merger, updates_index, 0);
*
* ModulemdModuleIndex *merged_index =
* modulemd_module_index_merger_resolve (merger, &error);
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* merger = Modulemd.ModuleIndexMerger.new()
*
* merger.associate_index(fedora_index, 0)
* merger.associate_index(updates_index, 0)
*
* merged_index = merger.resolve()
* ]|
*
* At this point, you now have either a complete view of the merged repodata,
* or else have received an error describing why the merge was unable to
* complete successfully. Additionally, it should be noted that the combined
* metadata in any #ModulemdModuleIndex will have all of its component parts
* upgraded to match the highest version of those objects seen. So for example
* if the repodata has a mix of v1 and v2 #ModulemdModuleStream objects, the
* index will contain only v2 objects (with the v1 objects automatically
* upgraded internally).
*
* Now, we can start operating on the retrieved data. This guide will
* give only a brief overview of the most common operations. See the API
* specification for a full list of information that can be retrieved.
*
* ## Discover the default stream for a particular module.
*
* In C:
* |[<!-- language="C" -->
* ModulemdModule *module =
* modulemd_module_index_get_module (merged_index, "modulename");
* ModulemdDefaults *defaults = modulemd_module_get_defaults (module);
* printf ("Default stream for modulename is %s\n",
* modulemd_defaults_v1_get_default_stream (
* MODULEMD_DEFAULTS_V1 (defaults), NULL));
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* module = merged_index.get_module("modulename")
* defaults = module.get_defaults()
* print("Default stream for modulename is %s" % defaults.get_default_stream())
* ]|
*
* ## Get the list of RPMs defining the public API for a particular module NSVCA
* First, query the #ModulemdModuleIndex for the module with a given name.
*
* In C:
* |[<!-- language="C" -->
* ModulemdModule *module =
* modulemd_module_index_get_module (merged_index, "modulename");
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* module = merged_index.get_module("modulename")
* ]|
*
* Then, query the #ModulemdModule for the #ModulemdModuleStream associated with the
* provided NSVCA (name-stream-version-context-architecture identifier).
*
* In C:
* |[<!-- language="C" -->
* ModulemdModuleStream *stream = modulemd_module_get_stream_by_NSVCA (
* module, "modulestream", 0, "deadbeef", "coolarch", &error);
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* stream = module.get_stream_by_NSVCA("modulestream", 0, "deadbeef", "coolarch")
* ]|
*
* Lastly, read the RPM API from the #ModulemdModuleStream. Here, `api_list` is
* a list of strings containing package names.
*
* In C:
* |[<!-- language="C" -->
* GStrv api_list = modulemd_module_stream_v2_get_rpm_api_as_strv (
* MODULEMD_MODULE_STREAM_V2 (stream));
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* api_list = stream.get_rpm_api()
* ]|
*
* Also note that in addition to accessor API methods, many objects also have
* properties that can be accessed directly.
*
* In C:
* |[<!-- language="C" -->
* printf ("Documentation for module stream is at %s\n",
* modulemd_module_stream_v2_get_documentation (
* MODULEMD_MODULE_STREAM_V2 (stream)));
* g_autofree gchar *doc;
* g_object_get (MODULEMD_MODULE_STREAM_V2 (stream), "documentation", &doc, NULL);
* printf ("Documentation for module stream is at %s\n", doc);
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* print("Documentation for module stream is at %s" % stream.get_documentation())
* print("Documentation for module stream is at %s" % stream.props.documentation)
* ]|
*
* ## Retrieve the modular runtime dependencies for a particular module NSVCA
*
* In C:
* |[<!-- language="C" -->
* ModulemdModule *module =
* modulemd_module_index_get_module (merged_index, "modulename");
* ModulemdModuleStream *stream = modulemd_module_get_stream_by_NSVCA (
* module, "modulestream", 0, "deadbeef", "coolarch", &error);
* GPtrArray *deps_list = modulemd_module_stream_v2_get_dependencies (
* MODULEMD_MODULE_STREAM_V2 (stream));
*
* for (gint i = 0; i < deps_list->len; i++)
* {
* GStrv depmodules_list =
* modulemd_dependencies_get_runtime_modules_as_strv (
* g_ptr_array_index (deps_list, i));
*
* for (gint j = 0; j < g_strv_length (depmodules_list); j++)
* {
* GStrv depstreams_list =
* modulemd_dependencies_get_runtime_streams_as_strv (
* g_ptr_array_index (deps_list, i), depmodules_list[j]);
*
* for (gint k = 0; k < g_strv_length (depstreams_list); k++)
* {
* // do stuff with depmodules_list[j], depstreams_list[k]
* }
* }
* }
* ]|
*
* In Python:
* |[<!-- language="Python" -->
* module = merged_index.get_module("modulename")
* stream = module.get_stream_by_NSVCA("modulestream", 0, "deadbeef", "coolarch")
* deps_list = stream.get_dependencies()
* for dep in deps_list:
* depmodules_list = dep.get_runtime_modules()
* for depmod in depmodules_list:
* depstream_list = dep.get_runtime_streams(depmod)
* for depstream in depstream_list:
* # do stuff with depmod, depstream
* ]|
*
* # Working with a single module stream (Packager/MBS use-case)
* One limitation of the #ModulemdModuleIndex format is that it requires that
* all module streams loaded into it have both a name and a stream name.
* This however is not possible when dealing with streams such as a packager
* would be using (since the build-system auto-generates the module name and
* stream name from the git repository information. In this case, we need to
* work with a single module stream document at a time. For this, we will
* use the #ModulemdModuleStream interface.
*
* This example will assume that the module name and stream name have
* already been determined from the repodata and that they are stored in
* string variables named `module_name` and `stream_name`, respectively.
*
* In Python:
* |[<!-- language="Python" -->
* stream = Modulemd.ModuleStream.read_file(
* "/path/to/module_name.yaml", True, module_name, stream_name
* )
* v2_stream = stream.upgrade(Modulemd.ModuleStreamVersionEnum.TWO)
* v2_stream.validate()
* ]|
* In the example above, we upgraded the stream to v2, in case we were reading
* from v1 metadata. This will allow us to avoid having to manage multiple
* code-paths and support only the latest we understand. After that, it calls
* validate() to ensure that the content that was read in was valid both
* syntactically and referentially.
*
* Also available is `Modulemd.ModuleStreamVersionEnum.LATEST` which will
* always represent the highest-supported version of the
* #ModulemdModuleStream metadata format. This may change at any time.
*/
/**
* modulemd_get_version:
*
* Returns: (transfer none): A string describing the version of libmodulemd.
*
* Since: 2.0
*/
const gchar *
modulemd_get_version (void);
/**
* modulemd_load_file:
* @yaml_file: (in): A YAML file containing the module metadata and other
* related information such as default streams.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* This is a convenience function that is a wrapper around
* modulemd_module_index_new() and modulemd_module_index_update_from_file()
* with `strict=False`.
*
* It will return the imported module metadata if all subdocuments are
* parseable and valid. If any part of the document is unreadable or fails
* validation, it will return NULL and set @error appropriately. If you need
* more detail about which parts of the document failed, use the lower-level
* functions.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndex object
* initialized with the content from @yaml_file. Returns NULL and sets @error
* if the file is not completely valid.
*
* Since: 2.10
*/
ModulemdModuleIndex *
modulemd_load_file (const gchar *yaml_file, GError **error);
/**
* modulemd_load_string:
* @yaml_string: (in): A YAML string containing the module metadata and other
* related information such as default streams.
* @error: (out): A #GError containing additional information if this function
* fails in a way that prevents program continuation.
*
* This is a convenience function that is a wrapper around
* modulemd_module_index_new() and modulemd_module_index_update_from_string()
* with `strict=False`.
*
* It will return the imported module metadata if all subdocuments are
* parseable and valid. If any part of the document is unreadable or fails
* validation, it will return NULL and set @error appropriately. If you need
* more detail about which parts of the document failed, use the lower-level
* functions.
*
* Returns: (transfer full): A newly-allocated #ModulemdModuleIndex object
* initialized with the content from @yaml_file. Returns NULL and sets @error
* if the metadata is not completely valid.
*
* Since: 2.10
*/
ModulemdModuleIndex *
modulemd_load_string (const gchar *yaml_string, GError **error);
G_END_DECLS

View file

@ -0,0 +1,287 @@
/*
* 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>.
*/
/*
* This file contains empty "target" functions for renames.
* This is required because gobject-introspection requires a defined target for
* any renames, but they don't have to be implemented.
*/
#pragma once
#include <glib-object.h>
G_BEGIN_DECLS
/**
* modulemd_buildopts_get_arches: (skip)
*/
GStrv
modulemd_buildopts_get_arches (ModulemdBuildopts *self);
/**
* modulemd_buildopts_get_rpm_whitelist: (skip)
*/
GStrv
modulemd_buildopts_get_rpm_whitelist (ModulemdBuildopts *self);
/**
* modulemd_component_get_buildafter: (skip)
*/
GStrv
modulemd_component_get_buildafter (ModulemdComponent *self);
/**
* modulemd_component_rpm_get_arches: (skip)
*/
GStrv
modulemd_component_rpm_get_arches (ModulemdComponentRpm *self);
/**
* modulemd_component_rpm_get_multilib_arches: (skip)
*/
GStrv
modulemd_component_rpm_get_multilib_arches (ModulemdComponentRpm *self);
/**
* modulemd_defaults_v1_get_streams_with_default_profiles: (skip)
*/
GStrv
modulemd_defaults_v1_get_streams_with_default_profiles (
ModulemdDefaultsV1 *self, const gchar *intent);
/**
* modulemd_defaults_v1_get_default_profiles_for_stream: (skip)
*/
GStrv
modulemd_defaults_v1_get_default_profiles_for_stream (ModulemdDefaultsV1 *self,
const gchar *stream_name,
const gchar *intent);
/**
* modulemd_dependencies_get_buildtime_modules: (skip)
*/
GStrv
modulemd_dependencies_get_buildtime_modules (ModulemdDependencies *self);
/**
* modulemd_dependencies_get_buildtime_streams: (skip)
*/
GStrv
modulemd_dependencies_get_buildtime_streams (ModulemdDependencies *self,
const gchar *module);
/**
* modulemd_dependencies_get_runtime_modules: (skip)
*/
GStrv
modulemd_dependencies_get_runtime_modules (ModulemdDependencies *self);
/**
* modulemd_dependencies_get_runtime_streams: (skip)
*/
GStrv
modulemd_dependencies_get_runtime_streams (ModulemdDependencies *self,
const gchar *module);
/**
* modulemd_module_get_stream_names: (skip)
*/
GStrv
modulemd_module_get_stream_names (ModulemdModule *self);
/**
* modulemd_module_get_streams_by_stream_name: (skip)
*/
GPtrArray *
modulemd_module_get_streams_by_stream_name (ModulemdModule *self,
const gchar *stream_name);
/**
* modulemd_module_stream_get_nsvc: (skip)
*/
gchar *
modulemd_module_stream_get_nsvc (ModulemdModuleStream *self);
/**
* modulemd_module_stream_get_NSVCA: (skip)
*/
gchar *
modulemd_module_stream_get_NSVCA (ModulemdModuleStream *self);
/**
* modulemd_module_stream_v1_get_module_component_names: (skip)
*/
GStrv
modulemd_module_stream_v1_get_module_component_names (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_component_names: (skip)
*/
GStrv
modulemd_module_stream_v1_get_rpm_component_names (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_content_licenses: (skip)
*/
GStrv
modulemd_module_stream_v1_get_content_licenses (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_module_licenses: (skip)
*/
GStrv
modulemd_module_stream_v1_get_module_licenses (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_profile_names: (skip)
*/
GStrv
modulemd_module_stream_v1_get_profile_names (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_api: (skip)
*/
GStrv
modulemd_module_stream_v1_get_rpm_api (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_artifacts: (skip)
*/
GStrv
modulemd_module_stream_v1_get_rpm_artifacts (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_rpm_filters: (skip)
*/
GStrv
modulemd_module_stream_v1_get_rpm_filters (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_servicelevel_names: (skip)
*/
GStrv
modulemd_module_stream_v1_get_servicelevel_names (
ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_buildtime_modules: (skip)
*/
GStrv
modulemd_module_stream_v1_get_buildtime_modules (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v1_get_runtime_modules: (skip)
*/
GStrv
modulemd_module_stream_v1_get_runtime_modules (ModulemdModuleStreamV1 *self);
/**
* modulemd_module_stream_v2_get_module_component_names: (skip)
*/
GStrv
modulemd_module_stream_v2_get_module_component_names (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_component_names: (skip)
*/
GStrv
modulemd_module_stream_v2_get_rpm_component_names (
ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_content_licenses: (skip)
*/
GStrv
modulemd_module_stream_v2_get_content_licenses (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_module_licenses: (skip)
*/
GStrv
modulemd_module_stream_v2_get_module_licenses (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_profile_names: (skip)
*/
GStrv
modulemd_module_stream_v2_get_profile_names (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_api: (skip)
*/
GStrv
modulemd_module_stream_v2_get_rpm_api (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_artifacts: (skip)
*/
GStrv
modulemd_module_stream_v2_get_rpm_artifacts (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_rpm_filters: (skip)
*/
GStrv
modulemd_module_stream_v2_get_rpm_filters (ModulemdModuleStreamV2 *self);
/**
* modulemd_module_stream_v2_get_servicelevel_names: (skip)
*/
GStrv
modulemd_module_stream_v2_get_servicelevel_names (
ModulemdModuleStreamV2 *self);
/**
* modulemd_profile_get_rpms: (skip)
*/
GStrv
modulemd_profile_get_rpms (ModulemdProfile *self);
/**
* modulemd_translation_entry_get_profiles: (skip)
*/
GStrv
modulemd_translation_entry_get_profiles (ModulemdTranslationEntry *self);
/**
* modulemd_translation_get_locales: (skip)
*/
GStrv
modulemd_translation_get_locales (ModulemdTranslation *self);
/**
* modulemd_module_index_get_module_names: (skip)
*/
GStrv
modulemd_module_index_get_module_names (ModulemdModuleIndex *self);
/**
* modulemd_module_index_get_default_streams: (skip)
*/
GHashTable *
modulemd_module_index_get_default_streams (ModulemdModuleIndex *self,
const gchar *intent);
/**
* modulemd_rpm_map_entry_get_nevra: (skip)
*/
gchar *
modulemd_rpm_map_entry_get_nevra (ModulemdRpmMapEntry *self);
G_END_DECLS

View file

@ -0,0 +1,55 @@
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 Stephen Gallagher
*
* 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 <glib.h>
#include <glib/gtypes.h>
#include "config.h"
/* GDate autoptr cleanup was finally added in GLib 2.63.3. */
#ifndef HAVE_GDATE_AUTOPTR
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDate, g_date_free)
#endif
#ifndef HAVE_EXTEND_AND_STEAL
void
g_ptr_array_extend (GPtrArray *array_to_extend,
GPtrArray *array,
GCopyFunc func,
gpointer user_data);
/*
* g_ptr_array_extend_and_steal:
* @array_to_extend: (transfer none): a #GPtrArray.
* @array: (transfer container): a #GPtrArray to add to the end of
* @array_to_extend.
*
* Adds all the pointers in @array to the end of @array_to_extend, transferring
* ownership of each element from @array to @array_to_extend and modifying
* @array_to_extend in-place. @array is then freed.
*
* As with g_ptr_array_free(), @array will be destroyed if its reference count
* is 1. If its reference count is higher, it will be decremented and the
* length of @array set to zero.
*
* Since: glib 2.62
*/
void
g_ptr_array_extend_and_steal (GPtrArray *array_to_extend, GPtrArray *array);
#endif

View file

@ -0,0 +1,65 @@
/*
* 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 <glib-object.h>
#include <yaml.h>
#include "modulemd-buildopts.h"
/**
* SECTION: modulemd-buildopts-private
* @title: Modulemd.Buildopts (Private)
* @stability: Private
* @short_description: #ModulemdBuildopts methods that should be used only
* by internal consumers.
*/
/**
* modulemd_buildopts_parse_yaml:
* @parser: (inout): A libyaml parser object positioned at the beginning of a
* Buildopts entry in the YAML document.
* @strict: (in): Whether the parser should return failure if it encounters an
* unknown mapping key or if it should ignore it.
* @error: (out): A #GError that will return the reason for a parsing or
* validation error.
*
* Returns: (transfer full): A newly-allocated #ModulemdBuildopts object
* read from the YAML. NULL if a parse or validation error occurred and sets
* @error appropriately.
*
* Since: 2.0
*/
ModulemdBuildopts *
modulemd_buildopts_parse_yaml (yaml_parser_t *parser,
gboolean strict,
GError **error);
/**
* modulemd_buildopts_emit_yaml:
* @self: This #ModulemdBuildopts object.
* @emitter: (inout): A libyaml emitter object positioned where a Buildopts
* belongs in the YAML document.
* @error: (out): A #GError that will return the reason for an emission or
* validation error.
*
* Returns: TRUE if the buildopts was emitted successfully. FALSE and sets
* @error appropriately if the YAML could not be emitted.
*
* Since: 2.0
*/
gboolean
modulemd_buildopts_emit_yaml (ModulemdBuildopts *self,
yaml_emitter_t *emitter,
GError **error);

Some files were not shown because too many files have changed in this diff Show more