Commit 662a026e authored by Vladimír Čunát's avatar Vladimír Čunát

Merge !758: CI: build package for Turris

parents 1aabd4a9 6013c8be
Pipeline #45044 passed with stages
in 21 minutes and 59 seconds
......@@ -42,12 +42,34 @@ stages:
build:linux:amd64:
<<: *build
build:asan:linux:amd64:
<<: *build
variables:
CFLAGS: -ggdb3 -O0 -fsanitize=address -fno-omit-frame-pointer
build:turris:omnia:
image: $CI_REGISTRY/knot/knot-resolver/ci/turris:omnia
stage: build
except:
- master
script:
- ./scripts/make-archive.sh
- cp knot-resolver*.tar.xz /tmp/turris/dl/
- ./scripts/make-distrofiles.sh
- cp -r distro/turris /tmp/turris/package/knot-resolver
- pushd /tmp/turris
- export PATH=$PATH:$PWD/staging_dir/toolchain-*/bin
- USE_CCACHE=n make CC=arm-openwrt-linux-gcc CXX=arm-openwrt-linux-g++ LD=arm-openwrt-linux-ld -C $PWD V=s
- popd
- cp /tmp/turris/bin/mvebu-musl/packages/base/*.ipk ./
artifacts:
paths:
- "*.ipk"
tags:
- docker
- linux
- amd64
lint:pedantic:
stage: test # could be in build already, but let's not block the test stage if this fails
dependencies: [] # do not download build artifacts
......
......@@ -19,3 +19,17 @@ $ docker push registry.labs.nic.cz/knot/knot-resolver/ci/debian-unstable:knot-$K
$ docker build -t registry.labs.nic.cz/knot/knot-resolver/ci/fedora fedora
$ docker push registry.labs.nic.cz/knot/knot-resolver/ci/fedora
```
* turris
```
$ docker build -t registry.labs.nic.cz/knot/knot-resolver/ci/turris:omnia turris
$ docker push registry.labs.nic.cz/knot/knot-resolver/ci/turris:omnia
```
Alternatively, provide `SDK_REPO` build arg (dir name from https://repo.turris.cz/ )
```
$ docker build --build-arg SDK_REPO=omnia-nightly -t registry.labs.nic.cz/knot/knot-resolver/ci/turris:omnia-nightly turris
$ docker push registry.labs.nic.cz/knot/knot-resolver/ci/turris:omnia-nightly
```
FROM debian:stable
MAINTAINER Knot Resolver <knot-resolver@labs.nic.cz>
ARG SDK_NAME=OpenWrt-SDK*x86_64
ARG SDK_REPO=omnia
WORKDIR /tmp
RUN echo "deb http://ftp.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
RUN apt-get update -qq
RUN apt-get -t stretch-backports install -y git
RUN apt-get install -y -qqq git-core build-essential libssl-dev libncurses5-dev \
unzip gawk zlib1g-dev git subversion mercurial ccache libtinfo-dev libncurses5 \
libncurses5-dev wget
RUN wget --quiet "https://repo.turris.cz/$SDK_REPO/" -r -nd -np --accept="$SDK_NAME.tar.bz2" && \
tar xjf $SDK_NAME.tar.bz2 && \
rm $SDK_NAME.tar.bz2 && \
mv $SDK_NAME turris
CMD ["/bin/bash"]
#
# Copyright (C) 2015-2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_RELRO_FULL:=0
include $(TOPDIR)/rules.mk
PKG_NAME:=knot-resolver
PKG_VERSION:=__VERSION__
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Knot DNS <knot-dns@labs.nic.cz>
PKG_LICENSE:=GPL-3.0
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/knot-resolver
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=Knot DNS Resolver
URL:=https://gitlab.labs.nic.cz/knot/resolver
DEPENDS=+knot-libs +knot-libzscanner +libuv +luajit +dnssec-rootkey +resolver-conf +luasec +luasocket +libstdcpp
PROVIDES:=dns-resolver
endef
define Package/knot-resolver/description
The Knot DNS Resolver is a minimalistic caching resolver implementation.
endef
MAKE_FLAGS += \
PREFIX=/usr \
ETCDIR=/etc/kresd
define Build/Patch
$(Build/Patch/Default)
cd $(PKG_BUILD_DIR) && \
sed -i -e 's/\(.*find_lib,hiredis.*\)/HAS_hiredis := no/' \
-e 's/\(.*find_lib,libmemcached.*\)/HAS_libmemcached := no/' Makefile
endef
define Package/knot-resolver/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/*bin/kresd $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libkres.so* $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/kdns_modules $(1)/usr/lib
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/kresd.init $(1)/etc/init.d/kresd
$(INSTALL_DIR) $(1)/etc/kresd
$(CP) $(PKG_BUILD_DIR)/etc/icann-ca.pem $(1)/etc/kresd
$(CP) $(PKG_BUILD_DIR)/etc/root.hints $(1)/etc/kresd
$(INSTALL_BIN) ./files/kresd.postinst $(1)/etc/kresd/kresd.postinst.sh
$(INSTALL_BIN) ./files/convert_config.sh $(1)/etc/kresd/convert_config.sh
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
set -x
if [ -z "$$IPKG_INSTROOT" ]; then
/etc/init.d/dnsmasq restart
sleep 2 # Cooldown for above (problems in times of reinstall)
/etc/kresd/kresd.postinst.sh && rm /etc/kresd/kresd.postinst.sh
/etc/kresd/convert_config.sh && rm /etc/kresd/convert_config.sh
if [ "`uci -q get resolver.common.prefered_resolver`" = kresd ] && uci -q get resolver.common.forward_upstream | egrep -q '(1|yes|true|enabled|on)'; then
ping -c 1 api.turris.cz 2> /dev/null >&2 || {
uci set resolver.common.forward_upstream=0
uci commit
/etc/init.d/resolver restart
if ping -c 1 api.turris.cz 2> /dev/null >&2; then
create_notification -s error "DNS servery vašeho poskytovatele internetu nefungují úplně dobře - pravděpodobně nepodporují DNSSEC. Bylo proto vypnuto forwardování a váš router bude nyní vyhodnocovat DNS dotazy sám." "Your ISPs DNS servers does not work properly - most likely they don't support DNSSEC. Therefore DNS forwarding was turned off and your router will now resolve all DNS queries by itself."
else
uci set resolver.common.forward_upstream=1
uci commit
/etc/init.d/resolver restart
fi
}
fi
fi
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
set -ex
if [ -z "$$IPKG_INSTROOT" ]; then
# Remove the script if it is there.
if [ -e /etc/init.d/kresd ] ; then /etc/init.d/kresd stop ; /etc/init.d/kresd disable ; fi
fi
endef
define Package/knot-resolver/postrm
#!/bin/sh
if [ -z "$$IPKG_INSTROOT" ]; then
[ \! -x /etc/init.d/resolver ] || /etc/init.d/resolver restart
fi
endef
$(eval $(call BuildPackage,knot-resolver))
#!/bin/sh
convert_hostname_config(){
#convert hostname_config from option to list
hostnames=$(uci show resolver.kresd.hostname_config)
item_count=$(echo "$hostnames"| tr -cd "'"|wc -c)
if [ "$item_count" -gt "2" ] || [ "$item_count" == "0" ]; then
echo "resolver.kresd.hostname_config was already converted to list"
else
echo "converting resolver.kresd.hostname_config to list"
val=$(uci get resolver.kresd.hostname_config)
uci delete resolver.kresd.hostname_config
uci add_list resolver.kresd.hostname_config=$val
uci commit resolver
fi
}
convert_hostname_config
This diff is collapsed.
#!/bin/sh
set -x
# convert static_domain from kresd to common section
stat_dom=$(uci -q get resolver.kresd.static_domains)
if [ ! -z "$stat_dom" ]; then
uci set resolver.common.static_domains="$stat_dom"
uci delete resolver.kresd.static_domains
uci commit resolver
fi
/etc/init.d/resolver restart
......@@ -28,7 +28,7 @@ if [[ $(echo "${version}" | grep '^[[:alnum:].]$') -ne 0 ]]; then
fi
# Fill in VERSION field in distribution specific files
files="distro/rpm/${package}.spec distro/deb/changelog distro/arch/PKGBUILD"
files="distro/rpm/${package}.spec distro/deb/changelog distro/arch/PKGBUILD distro/turris/Makefile"
for file in ${files}; do
sed -i "s/__VERSION__/${version}/g" "${file}"
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment