summaryrefslogtreecommitdiffstats
path: root/distro
diff options
context:
space:
mode:
Diffstat (limited to 'distro')
-rw-r--r--distro/README.md9
-rw-r--r--distro/config/apkg.toml10
-rw-r--r--distro/pkg/deb/README.Debian38
-rw-r--r--distro/pkg/deb/README.source66
-rw-r--r--distro/pkg/deb/changelog5
-rw-r--r--distro/pkg/deb/compat1
-rw-r--r--distro/pkg/deb/control73
-rw-r--r--distro/pkg/deb/copyright79
-rw-r--r--distro/pkg/deb/gbp.conf4
-rw-r--r--distro/pkg/deb/libyang-dev.install3
-rw-r--r--distro/pkg/deb/libyang-modules.install1
-rw-r--r--distro/pkg/deb/libyang-tools.examples1
-rw-r--r--distro/pkg/deb/libyang-tools.install3
-rw-r--r--distro/pkg/deb/libyang3.install1
-rwxr-xr-xdistro/pkg/deb/rules12
-rw-r--r--distro/pkg/deb/source/format1
-rw-r--r--distro/pkg/deb/tests/control3
-rwxr-xr-xdistro/pkg/deb/tests/yanglint18
-rw-r--r--distro/pkg/deb/watch4
-rw-r--r--distro/pkg/rpm/libyang.spec125
-rwxr-xr-xdistro/scripts/make-archive.sh14
-rwxr-xr-xdistro/scripts/upstream-version.sh7
-rw-r--r--distro/tests/control1
-rwxr-xr-xdistro/tests/test-pkg-config.sh5
-rwxr-xr-xdistro/tests/test-yanglint.sh5
25 files changed, 489 insertions, 0 deletions
diff --git a/distro/README.md b/distro/README.md
new file mode 100644
index 0000000..dae5d1c
--- /dev/null
+++ b/distro/README.md
@@ -0,0 +1,9 @@
+# upstream packaging
+
+## RPM-based system (Fedora, CentOS, SUSE, ...) quickstart
+```
+sudo dnf install -y git rpm-build python3-pip
+pip3 install apkg
+apkg build -i
+```
+See apkg docs: https://pkg.labs.nic.cz/pages/apkg/
diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml
new file mode 100644
index 0000000..1eaa087
--- /dev/null
+++ b/distro/config/apkg.toml
@@ -0,0 +1,10 @@
+[project]
+name = "libyang"
+make_archive_script = "distro/scripts/make-archive.sh"
+
+[upstream]
+archive_url = "https://github.com/CESNET/libyang/archive/v{{ version }}/libyang-{{ version }}.tar.gz"
+version_script = "distro/scripts/upstream-version.sh"
+
+[apkg]
+compat = 2
diff --git a/distro/pkg/deb/README.Debian b/distro/pkg/deb/README.Debian
new file mode 100644
index 0000000..fc680d0
--- /dev/null
+++ b/distro/pkg/deb/README.Debian
@@ -0,0 +1,38 @@
+Debian packaging for libyang
+============================
+
+Where to file issues
+--------------------
+
+Please file issues on the Debian BTS as usual. You could also open issues
+on github, but if it's something about the Debian packaging it's better to
+stick with the proper Debian ways. The Debian BTS is where other people
+involved with Debian go look for bugs regarding a package, so that's where
+they should be.
+
+Building straight off git
+-------------------------
+
+Just the normal:
+
+```
+git clone https://github.com/CESNET/libyang -b debian/master
+cd libyang
+dpkg-buildpackage
+```
+
+Building a Debian .dsc
+----------------------
+
+Again, pretty much the normal:
+
+```
+git clone https://github.com/CESNET/libyang -b debian/master
+wget -Olibyang_0.16.105.orig.tar.gz https://github.com/CESNET/libyang/archive/v0.16-r3.tar.gz
+cd libyang
+dpkg-source -b .
+```
+
+(Note the diverging release numbering though.)
+
+ -- Ondřej Surý <Ondřej Surý <ondrej@debian.org>>, Fri, 22 May 2020 11:10:55 +0200
diff --git a/distro/pkg/deb/README.source b/distro/pkg/deb/README.source
new file mode 100644
index 0000000..b1d916d
--- /dev/null
+++ b/distro/pkg/deb/README.source
@@ -0,0 +1,66 @@
+This module uses gbp and upstream git repository
+
+To update this package, first import the changes from upstream:
+- git fetch --all
+
+Find the latest version:
+VERSION=$(git describe --tags $(git rev-list '--tags=v2*' --max-count=1) | sed 's/^v//')
+echo $VERSION
+
+Update debian/sid branch
+- git checkout debian/master
+- git merge v$VERSION
+
+Update the debian/copyright file:
+- cme update dpkg-copyright
+See also https://github.com/dod38fr/config-model/wiki/Updating-debian-copyright-file-with-cme
+
+Check patches (and cleanup if necessary):
+- gbp pq rebase --commit --drop
+
+Download upstream tarball:
+- uscan --download --verbose --download-version $VERSION
+
+Add pristine-tar:
+- pristine-tar commit ../libyang_$VERSION.orig.tar.gz v$VERSION
+
+Generate a temporary changelog:
+- gbp dch --new-version=$VERSION-1 --snapshot --auto --commit debian/
+
+Test the first build::
+- gbp buildpackage --git-ignore-new --git-pristine-tar --git-no-purge
+
+Regenerate the symbol file (See https://qt-kde-team.pages.debian.net/symbolfiles.html)
+- pkgkde-symbolshelper batchpatch -v $VERSION < <path_to>/buildlog
+
+See https://www.debian.org/doc/manuals/maint-guide/advanced.en.html#librarysymbols
+and dpkg-gensymbols man page
+
+Update the changelog:
+- gbp dch -Ra -c
+
+Once everything is fine, build a source package and tag:
+- gbp buildpackage -S --git-tag
+
+Push on salsa:
+- gbp push
+
+For more details, see
+https://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.import.upstream-git.html#gbp.import.upstream.git.notarball
+
+Maintainer Notes (moved from README.md)
+=======================================
+
+* the project version number is actually the SO ABI version. The release
+ point numbers (0.16-r3) isn't used for Debian.
+
+* it's intentional that the SONAME is libyang.so.0.16 and not libyang.so.0.
+ ABI compatibility is indicated by the first two numbers being equal;
+ the third number is incremented for compatible changes. cf.
+ CESNET/libyang#656
+
+* the watch file doesn't work yet but the libyang people agreed to make
+ future release tags the same as the internal version number. At that point
+ the watch file will work.
+
+ -- Ondřej Surý <Ondřej Surý <ondrej@debian.org>>, Tue, 21 Jul 2020 16:31:52 +0200
diff --git a/distro/pkg/deb/changelog b/distro/pkg/deb/changelog
new file mode 100644
index 0000000..22366df
--- /dev/null
+++ b/distro/pkg/deb/changelog
@@ -0,0 +1,5 @@
+libyang3 ({{ version }}-{{ release }}) unstable; urgency=medium
+
+ * upstream packaging
+
+ -- Ondřej Surý <ondrej@debian.org> Tue, 04 May 2021 22:20:03 +0200
diff --git a/distro/pkg/deb/compat b/distro/pkg/deb/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/distro/pkg/deb/compat
@@ -0,0 +1 @@
+10
diff --git a/distro/pkg/deb/control b/distro/pkg/deb/control
new file mode 100644
index 0000000..35cb549
--- /dev/null
+++ b/distro/pkg/deb/control
@@ -0,0 +1,73 @@
+Source: libyang3
+Section: libs
+Homepage: https://github.com/CESNET/libyang/
+Maintainer: Ondřej Surý <ondrej@debian.org>
+Priority: optional
+Standards-Version: 4.5.0
+Build-Depends: cmake,
+ debhelper (>= 10),
+ libcmocka-dev <!nocheck>,
+ libpcre2-dev,
+ pkg-config
+Vcs-Browser: https://github.com/CESNET/libyang/tree/master
+Vcs-Git: https://github.com/CESNET/libyang.git
+
+Package: libyang3
+Depends: ${misc:Depends},
+ ${shlibs:Depends}
+Architecture: any
+Multi-Arch: same
+Description: parser toolkit for IETF YANG data modeling - runtime
+ Libyang implements functions to process schemas expressed in the
+ YANG data modeling language defined by the IETF in RFCs 6020/7950.
+ Schemas expressed in this language primarily describe configuration
+ used by larger network equipment like routers and switches.
+ .
+ In addition to handling the schemas itself, the library also provides
+ functions to process data described by the schemas.
+ .
+ The library is implemented in C and provides an API for other software
+ to use in processing configurations.
+
+Package: libyang-dev
+Depends: libpcre2-dev,
+ libyang3 (= ${binary:Version}),
+ ${misc:Depends}
+Conflicts: libyang2-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Description: parser toolkit for IETF YANG data modeling - development files
+ Libyang implements functions to process schemas expressed in the
+ YANG data modeling language defined by the IETF in RFCs 6020/7950.
+ Schemas expressed in this language primarily describe configuration
+ used by larger network equipment like routers and switches.
+ .
+ In addition to handling the schemas itself, the library also provides
+ functions to process data described by the schemas.
+ .
+ This package contains the C headers, a pkgconfig file, and .so entry point
+ for libyang.
+
+Package: libyang-tools
+Depends: libyang3 (= ${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends}
+Breaks: libyang2-tools (<< ${source:Version})
+Replaces: libyang2-tools (<< ${source:Version})
+Section: devel
+Architecture: any
+Multi-Arch: foreign
+Description: parser toolkit for IETF YANG data modeling - executable tools
+ This package provides the "yanglint" and "yangre" tools which can be used
+ 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/copyright b/distro/pkg/deb/copyright
new file mode 100644
index 0000000..03af3c3
--- /dev/null
+++ b/distro/pkg/deb/copyright
@@ -0,0 +1,79 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: libyang
+License: BSD-3-clause
+
+Files: *
+Copyright: 2015-2021 by CESNET, z.s.p.o.
+License: BSD-3-clause
+
+Files: */iana-*.yin */iana-*.yang */ietf-*.yin */ietf-*.yang */ietf-*.h
+Copyright: 2011-2018 by the IETF Trust and the persons identified as authors
+License: IETF-BSD-3-clause
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD
+ License set forth in Section 4.c of the IETF Trust's
+ Legal Provisions Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).
+ .
+ This version of this YANG module is part of RFC 6536; see
+ the RFC itself for full legal notices.
+
+Files: tools/lint/linenoise/*
+Copyright:
+ Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com>
+ Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
+License: BSD-2-clause
+ All rights reserved.
+ .
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ .
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Files: debian/*
+Copyright: 2018 by David Lamparter
+ 2020-2021 Ondřej Surý
+License: BSD-3-clause
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ .
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ * Neither the name of libyang nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/distro/pkg/deb/gbp.conf b/distro/pkg/deb/gbp.conf
new file mode 100644
index 0000000..23917b9
--- /dev/null
+++ b/distro/pkg/deb/gbp.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+pristine-tar = False
+debian-branch = master
+upstream-tree = SLOPPY
diff --git a/distro/pkg/deb/libyang-dev.install b/distro/pkg/deb/libyang-dev.install
new file mode 100644
index 0000000..452d7e0
--- /dev/null
+++ b/distro/pkg/deb/libyang-dev.install
@@ -0,0 +1,3 @@
+usr/include/libyang/*.h
+usr/lib/*/*.so
+usr/lib/*/pkgconfig/*.pc
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/libyang-tools.examples b/distro/pkg/deb/libyang-tools.examples
new file mode 100644
index 0000000..63c4cb1
--- /dev/null
+++ b/distro/pkg/deb/libyang-tools.examples
@@ -0,0 +1 @@
+tools/lint/examples/*
diff --git a/distro/pkg/deb/libyang-tools.install b/distro/pkg/deb/libyang-tools.install
new file mode 100644
index 0000000..04f859b
--- /dev/null
+++ b/distro/pkg/deb/libyang-tools.install
@@ -0,0 +1,3 @@
+usr/bin/yanglint
+usr/bin/yangre
+usr/share/man/man1
diff --git a/distro/pkg/deb/libyang3.install b/distro/pkg/deb/libyang3.install
new file mode 100644
index 0000000..3de3b10
--- /dev/null
+++ b/distro/pkg/deb/libyang3.install
@@ -0,0 +1 @@
+usr/lib/*/*.so.*
diff --git a/distro/pkg/deb/rules b/distro/pkg/deb/rules
new file mode 100755
index 0000000..58f845d
--- /dev/null
+++ b/distro/pkg/deb/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+#export DH_VERBOSE=1
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+include /usr/share/dpkg/default.mk
+
+%:
+ dh $@
+
+override_dh_auto_configure:
+ dh_auto_configure -- \
+ -DCMAKE_BUILD_TYPE:String="Release"
diff --git a/distro/pkg/deb/source/format b/distro/pkg/deb/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/distro/pkg/deb/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/distro/pkg/deb/tests/control b/distro/pkg/deb/tests/control
new file mode 100644
index 0000000..ca73c4a
--- /dev/null
+++ b/distro/pkg/deb/tests/control
@@ -0,0 +1,3 @@
+Tests: yanglint
+Depends: gzip,
+ libyang-tools
diff --git a/distro/pkg/deb/tests/yanglint b/distro/pkg/deb/tests/yanglint
new file mode 100755
index 0000000..30719e0
--- /dev/null
+++ b/distro/pkg/deb/tests/yanglint
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+# Setup the test file
+trap 'rm -f "${TESTFILE}"; rmdir "${TESTDIR}"' EXIT
+TESTDIR=$(mktemp -d /tmp/yanglint.XXXXXX)
+TESTFILE="${TESTDIR}/ietf-interfaces.yang"
+
+# Unpack or copy the test file
+if test -f /usr/share/doc/libyang-tools/examples/ietf-interfaces.yang.gz; then
+ gunzip -c < /usr/share/doc/libyang-tools/examples/ietf-interfaces.yang.gz > "${TESTFILE}"
+else
+ cp /usr/share/doc/libyang-tools/examples/ietf-interfaces.yang "${TESTFILE}"
+fi
+
+# Lint the test file
+yanglint "${TESTFILE}"
diff --git a/distro/pkg/deb/watch b/distro/pkg/deb/watch
new file mode 100644
index 0000000..b391882
--- /dev/null
+++ b/distro/pkg/deb/watch
@@ -0,0 +1,4 @@
+version=4
+opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%libyang-$1.tar.gz%" \
+ https://github.com/CESNET/libyang/releases \
+ (?:.*?/)?v?(\d[\d.]*)(?:-r\d+)?\.tar\.gz debian uupdate
diff --git a/distro/pkg/rpm/libyang.spec b/distro/pkg/rpm/libyang.spec
new file mode 100644
index 0000000..bef1596
--- /dev/null
+++ b/distro/pkg/rpm/libyang.spec
@@ -0,0 +1,125 @@
+%if 0%{?rhel} == 8
+%undefine __cmake_in_source_build
+%endif
+
+Name: libyang
+Version: {{ version }}
+Release: {{ release }}%{?dist}
+Summary: YANG data modeling language library
+Url: https://github.com/CESNET/libyang
+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
+
+%package modules
+Summary: YANG modules for libyang
+
+%package devel
+Summary: Development files for libyang
+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}
+# 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.
+
+%description devel-doc
+Documentation of libyang API.
+
+%description tools
+YANG validator tools.
+
+%description
+Libyang is YANG data modeling language parser and toolkit
+written (and providing API) in C.
+
+%prep
+%autosetup -p1
+%if 0%{?rhel} && 0%{?rhel} < 8
+ mkdir build
+%endif
+
+%build
+%if 0%{?rhel} && 0%{?rhel} < 8
+ 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
+%else
+ %cmake -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
+ %cmake_build
+ %if "x%{?suse_version}" == "x"
+ cd %{__cmake_builddir}
+ %endif
+%endif
+make doc
+
+%check
+%if ( 0%{?rhel} == 0 ) || 0%{?rhel} > 7
+ %if "x%{?suse_version}" == "x"
+ cd %{__cmake_builddir}
+ %endif
+%endif
+ctest --output-on-failure -V %{?_smp_mflags}
+
+%install
+mkdir -m0755 -p %{buildroot}/%{_docdir}/libyang
+%if 0%{?rhel} && 0%{?rhel} < 8
+ cd build
+ make DESTDIR=%{buildroot} install
+%else
+ %cmake_install
+ cp -a doc/html %{buildroot}/%{_docdir}/libyang/html
+%endif
+
+%files
+%license LICENSE
+%{_libdir}/libyang.so.3
+%{_libdir}/libyang.so.3.*
+
+%files modules
+%{_datadir}/yang/modules/libyang/*.yang
+%dir %{_datadir}/yang/
+%dir %{_datadir}/yang/modules/
+%dir %{_datadir}/yang/modules/libyang/
+
+%files tools
+%{_bindir}/yanglint
+%{_bindir}/yangre
+%{_datadir}/man/man1/yanglint.1.gz
+%{_datadir}/man/man1/yangre.1.gz
+
+%files devel
+%{_libdir}/libyang.so
+%{_libdir}/pkgconfig/libyang.pc
+%{_includedir}/libyang/*.h
+%dir %{_includedir}/libyang/
+
+%files devel-doc
+%{_docdir}/libyang
+
+%changelog
+* {{ now }} Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-{{ release }}
+- upstream package
diff --git a/distro/scripts/make-archive.sh b/distro/scripts/make-archive.sh
new file mode 100755
index 0000000..6cca67c
--- /dev/null
+++ b/distro/scripts/make-archive.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# create archive from current source using git
+
+VERSION=$(git log --oneline -n1 --grep="^VERSION" | rev | cut -d' ' -f1 | rev)
+
+NAMEVER=libyang-$VERSION
+ARCHIVE=$NAMEVER.tar.gz
+
+git archive --format tgz --output $ARCHIVE --prefix $NAMEVER/ HEAD
+mkdir -p pkg/archives/dev/
+mv $ARCHIVE pkg/archives/dev/
+
+# apkg expects stdout to list archive files
+echo pkg/archives/dev/$ARCHIVE
diff --git a/distro/scripts/upstream-version.sh b/distro/scripts/upstream-version.sh
new file mode 100755
index 0000000..4489c8e
--- /dev/null
+++ b/distro/scripts/upstream-version.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# get latest upstream libyang version from github
+
+RLS_URL=https://api.github.com/repos/CESNET/libyang/releases
+VERSION=$(curl -s $RLS_URL | grep tag_name | cut -d '"' -f 4 | sort --version-sort | tail -n 1)
+VERSION=${VERSION#v}
+echo $VERSION
diff --git a/distro/tests/control b/distro/tests/control
new file mode 100644
index 0000000..61b9060
--- /dev/null
+++ b/distro/tests/control
@@ -0,0 +1 @@
+Tests: test-pkg-config.sh test-yanglint.sh
diff --git a/distro/tests/test-pkg-config.sh b/distro/tests/test-pkg-config.sh
new file mode 100755
index 0000000..581e4d6
--- /dev/null
+++ b/distro/tests/test-pkg-config.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -ex
+
+version=`pkg-config --modversion libyang`
+echo "$version" | grep '2\.[0-9.]\+'
diff --git a/distro/tests/test-yanglint.sh b/distro/tests/test-yanglint.sh
new file mode 100755
index 0000000..70bf4b9
--- /dev/null
+++ b/distro/tests/test-yanglint.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -ex
+
+version=`yanglint --version`
+echo "$version" | grep '2\.[0-9.]\+'