rpm UPDATE packaging from Fedora
Fedora package sources:
https://src.fedoraproject.org/rpms/libyang
diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml
index 203013e..1eaa087 100644
--- a/distro/config/apkg.toml
+++ b/distro/config/apkg.toml
@@ -3,8 +3,8 @@
make_archive_script = "distro/scripts/make-archive.sh"
[upstream]
-archive_url = "https://github.com/CESNET/libyang/archive/v{{ version }}.tar.gz"
+archive_url = "https://github.com/CESNET/libyang/archive/v{{ version }}/libyang-{{ version }}.tar.gz"
version_script = "distro/scripts/upstream-version.sh"
[apkg]
-compat = 1
+compat = 2
diff --git a/distro/pkg/rpm/libyang.spec b/distro/pkg/rpm/libyang.spec
index e49d8a6..c6d7251 100644
--- a/distro/pkg/rpm/libyang.spec
+++ b/distro/pkg/rpm/libyang.spec
@@ -3,11 +3,13 @@
Release: {{ release }}%{?dist}
Summary: YANG data modeling language library
Url: https://github.com/CESNET/libyang
-Source: libyang-%{version}.tar.gz
+Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
License: BSD
BuildRequires: cmake
+BuildRequires: doxygen
BuildRequires: gcc
+BuildRequires: cmake(cmocka) >= 1.0.1
BuildRequires: make
BuildRequires: pkgconfig(libpcre2-8) >= 10.21
@@ -16,6 +18,10 @@
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pcre2-devel
+%package devel-doc
+Summary: Documentation of libyang API
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
%package tools
Summary: YANG validator tools
Requires: %{name}%{?_isa} = %{version}-%{release}
@@ -25,6 +31,9 @@
%description devel
Headers of libyang library.
+%description devel-doc
+Documentation of libyang API.
+
%description tools
YANG validator tools.
@@ -34,21 +43,27 @@
%prep
%autosetup -p1
-mkdir build
%build
-cd build
-cmake \
- -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
- -DCMAKE_BUILD_TYPE:String="Release" \
- -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
- -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
- ..
-make
+%cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
+%cmake_build
+
+%if "x%{?suse_version}" == "x"
+cd redhat-linux-build
+%endif
+make doc
+
+%check
+%if "x%{?suse_version}" == "x"
+cd redhat-linux-build
+%endif
+ctest --output-on-failure -V %{?_smp_mflags}
%install
-cd build
-make DESTDIR=%{buildroot} install
+%cmake_install
+
+mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang
+cp -a doc/html %{buildroot}/%{_docdir}/libyang/html
%files
%license LICENSE
@@ -67,6 +82,9 @@
%{_includedir}/libyang/*.h
%dir %{_includedir}/libyang/
+%files devel-doc
+%{_docdir}/libyang
+
%changelog
-* Fri Aug 06 2021 Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
+* {{ now }} Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
- upstream package