distro UPDATE separate package for YANG modules

Currently, YANG modules are installed as part of the main libyang
deb/rpm package. This makes it impossible to install both libyang2 and
libyang3 at the same time, because package managers don't allow to
simultaneously install packages that provide the same files.

As the YANG modules are already embedded into libyang binaries and not
needed for libyang operation, we can move them to a separate
libyang-modules optional package. It allows to install both libyang2 and
libyang3 at the same time.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
diff --git a/distro/pkg/deb/control b/distro/pkg/deb/control
index 2a19c80..35cb549 100644
--- a/distro/pkg/deb/control
+++ b/distro/pkg/deb/control
@@ -63,3 +63,11 @@
  during the creation of IETF YANG schemas.  The tools are not generally
  useful for normal operation where libyang primarily processes configuration
  data, not schemas.
+
+Package: libyang-modules
+Section: devel
+Architecture: all
+Description: parser toolkit for IETF YANG data modeling - YANG modules
+ This package provides the IETF YANG modules used by libyang. These modules
+ are embedded into libyang so this package is not necessary for libyang
+ operation.
diff --git a/distro/pkg/deb/libyang-modules.install b/distro/pkg/deb/libyang-modules.install
new file mode 100644
index 0000000..04b1c2d
--- /dev/null
+++ b/distro/pkg/deb/libyang-modules.install
@@ -0,0 +1 @@
+usr/share/yang/modules/libyang
diff --git a/distro/pkg/deb/libyang3.install b/distro/pkg/deb/libyang3.install
index 9d72c7e..3de3b10 100644
--- a/distro/pkg/deb/libyang3.install
+++ b/distro/pkg/deb/libyang3.install
@@ -1,2 +1 @@
 usr/lib/*/*.so.*
-usr/share/yang/modules/libyang
diff --git a/distro/pkg/rpm/libyang.spec b/distro/pkg/rpm/libyang.spec
index 5af0cad..bef1596 100644
--- a/distro/pkg/rpm/libyang.spec
+++ b/distro/pkg/rpm/libyang.spec
@@ -17,6 +17,9 @@
 BuildRequires:  make
 BuildRequires:  pkgconfig(libpcre2-8) >= 10.21
 
+%package modules
+Summary:    YANG modules for libyang
+
 %package devel
 Summary:    Development files for libyang
 Requires:   %{name}%{?_isa} = %{version}-%{release}
@@ -32,6 +35,9 @@
 # This was not properly split out before
 Conflicts:      %{name} < 1.0.225-3
 
+%description modules
+YANG modules for libyang.
+
 %description devel
 Headers of libyang library.
 
@@ -92,6 +98,8 @@
 %license LICENSE
 %{_libdir}/libyang.so.3
 %{_libdir}/libyang.so.3.*
+
+%files modules
 %{_datadir}/yang/modules/libyang/*.yang
 %dir %{_datadir}/yang/
 %dir %{_datadir}/yang/modules/