rpm REFACTOR update libyang.spec from Fedora
libyang maintainer desired continuing with libyang package as opposed to
libyang2 - sync libyang.spec from Fedora upstream.
diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml
index 95f92ed..a11781e 100644
--- a/distro/config/apkg.toml
+++ b/distro/config/apkg.toml
@@ -1,9 +1,9 @@
[project]
-name = "libyang2"
+name = "libyang"
make_archive_script = "tools/make-dev-archive.sh"
[upstream]
-archive_url = "https://github.com/CESNET/libyang/archive/refs/tags/v{{ version }}.tar.gz"
+archive_url = "https://github.com/CESNET/libyang/archive/v{{ version }}.tar.gz"
version_script = "tools/upstream-version.sh"
[apkg]
diff --git a/distro/pkg/rpm/libyang.spec b/distro/pkg/rpm/libyang.spec
new file mode 100644
index 0000000..217bdec
--- /dev/null
+++ b/distro/pkg/rpm/libyang.spec
@@ -0,0 +1,75 @@
+Name: libyang
+Version: {{ version }}
+Release: {{ release }}%{?dist}
+Summary: YANG data modeling language library
+Url: https://github.com/CESNET/libyang
+Source: libyang-%{version}.tar.gz
+License: BSD
+
+BuildRequires: cmake
+BuildRequires: gcc
+BuildRequires: make
+BuildRequires: pkgconfig(libpcre2-8) >= 10.21
+
+%package devel
+Summary: Development files for libyang
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: pcre2-devel
+
+%package tools
+Summary: YANG validator tools
+Requires: %{name}%{?_isa} = %{version}-%{release}
+# This was not properly split out before
+Conflicts: %{name} < 1.0.225-3
+
+%description devel
+Headers of libyang library.
+
+%description tools
+YANG validator tools.
+
+%description
+Libyang is YANG data modeling language parser and toolkit
+written (and providing API) in C.
+
+%prep
+%autosetup -p1
+mkdir build
+
+%build
+cd build
+cmake \
+ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
+ -DCMAKE_BUILD_TYPE:String="Package" \
+ -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
+ -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
+ ..
+make
+
+%check
+cd build
+ctest --output-on-failure
+
+%install
+cd build
+make DESTDIR=%{buildroot} install
+
+%files
+%license LICENSE
+%{_libdir}/libyang.so.2
+%{_libdir}/libyang.so.2.*
+
+%files tools
+%{_bindir}/yanglint
+%{_bindir}/yangre
+%{_datadir}/man/man1/yanglint.1.gz
+
+%files devel
+%{_libdir}/libyang.so
+%{_libdir}/pkgconfig/libyang.pc
+%{_includedir}/libyang/*.h
+%dir %{_includedir}/libyang/
+
+%changelog
+* Fri Aug 06 2021 Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
+- upstream package
diff --git a/distro/pkg/rpm/libyang2.spec b/distro/pkg/rpm/libyang2.spec
deleted file mode 100644
index 6dd4586..0000000
--- a/distro/pkg/rpm/libyang2.spec
+++ /dev/null
@@ -1,85 +0,0 @@
-Name: libyang2
-Version: {{ version }}
-Release: {{ release }}%{?dist}
-Summary: YANG data modeling language library
-Url: https://github.com/CESNET/libyang
-Source: libyang-%{version}.tar.gz
-License: BSD-3-Clause
-
-BuildRequires: cmake
-BuildRequires: gcc
-BuildRequires: make
-BuildRequires: pcre2-devel
-
-%if "x%{?suse_version}" == "x"
-Requires: pcre2
-%else
-Requires: libpcre2-posix2
-%endif
-
-%package -n libyang2-devel
-Summary: Headers of libyang library
-Conflicts: libyang-devel
-Requires: %{name} = %{version}-%{release}
-Requires: pcre2-devel
-
-%package -n libyang2-tools
-Summary: Helper Tools and examples for libyang library
-Conflicts: libyang
-Provides: libyang-tools
-Requires: %{name} = %{version}-%{release}
-
-%description -n libyang2-devel
-Headers of libyang library.
-
-%description -n libyang2-tools
-Helper Tools and examples for libyang library.
-
-%description
-libyang is a YANG data modelling language parser and toolkit
-written (and providing API) in C.
-
-%prep
-%setup -n libyang-%{version}
-mkdir build
-
-%build
-cd build
-cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \
- -DCMAKE_BUILD_TYPE:String="Release" \
- -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
- -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
- ..
-make
-
-%check
-cd build
-ctest --output-on-failure
-
-%install
-cd build
-make DESTDIR=%{buildroot} install
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%files
-%defattr(-,root,root)
-%{_libdir}/libyang.so.2*
-
-%files -n libyang2-devel
-%defattr(-,root,root)
-%{_libdir}/libyang.so
-%{_libdir}/pkgconfig/libyang.pc
-%{_includedir}/libyang/*.h
-%dir %{_includedir}/libyang/
-
-%files -n libyang2-tools
-%{_bindir}/yanglint
-%{_bindir}/yangre
-%{_mandir}/man1/yanglint.1.gz
-
-%changelog
-* Fri Apr 30 2021 Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
-- upstream package