diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 000000000..eaa7a8825 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,115 @@ +CGRateS for Debian +------------------ + +CGRateS dependencies are not packaged separately, an additional +component is used alongside the upstream tarball. + +For package builds both tarballs need to be updated. + +The build.sh script in the debian directory automates the process. +It creates the .orig.tar.gz using git archive, and uses go get to +download the sources for the dependencies component. The script then +proceed to build the package in a cowbuilder chroot. + +The script has a few dependencies: + + git To get the commit details for the package version + distro-info To get the release version for the distribution + dpkg-dev To parse the debian/changelog file and dpkg-buildpackage + devscripts To set the package version and distribution + pbuilder To build the package with pdebuild + cowbuilder To have a more performant chroot + +Because the clean target is also executed outside the chroot these build +dependencies need to be installed outside the chroot too: + + debhelper For dh sequencer support in debian/rules + dh-golang For the golang buildsystem used by debhelper + +The cowbuilder chroots should have the upstream Go installed after +creation: + + sudo -i + export CODENAME=bookworm + export VERSION=1.21.4 + cowbuilder --create \ + --distribution ${CODENAME} \ + --architecture amd64 \ + --basepath /var/cache/pbuilder/base-${CODENAME}+go.cow \ + --mirror http://ftp.nl.debian.org/debian/ \ + --components 'main contrib non-free non-free-firmware' + wget https://go.dev/dl/go${VERSION}.linux-amd64.tar.gz -P /tmp + tar xavf /tmp/go${VERSION}.linux-amd64.tar.gz \ + -C /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local + echo "export PATH=\$PATH:/usr/local/go/bin" >> /var/cache/pbuilder/base-${CODENAME}+go.cow/root/.bashrc + +To upgrade the Go version in an existing chroot replace /usr/local/go +in the chroot: + + sudo -i + export CODENAME=bookworm + export VERSION=1.21.6 + wget https://go.dev/dl/go${VERSION}.linux-amd64.tar.gz -P /tmp + rm -rf /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local/go/ + tar xavf /tmp/go${VERSION}.linux-amd64.tar.gz \ + -C /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local + +To not have the upstream Go installed outside the chroot, the packaged +Go can be used: + + GO=/usr/lib/go-1.21/bin/go make -C packages/ deb + +To have the build artifacts alongside the source package in the parent +directory instead of /var/cache/pbuilder/result configure the path in +~/.pbuilderrc: + + BUILDRESULT=".." + +To have lintian run after the package build in the chroot configure the +hook: + + sudo -i + mkdir -p /var/cache/pbuilder/hooks.d + cat < /var/cache/pbuilder/hooks.d/B90lintian + #!/bin/bash + + if [ -n "\${LINTIAN}" ] && [ "\${LINTIAN}" = "0" ]; then + echo + echo "Not running lintian" + echo + exit 0 + fi + + install_packages() { + apt-get -y "\${APTGETOPT[@]}" install "\$@" + rc=\$? + + if [ "\${rc}" -ne 0 ]; then + echo + echo "Not running lintian" + echo + exit 0 + fi + } + + install_packages lintian + + set -e + + echo "+++ lintian output +++" + + #su -c "lintian -I --show-overrides /tmp/buildd/*.changes" - pbuilder + # use this version if you don't want lintian to fail the build + su -c "lintian -I --show-overrides --pedantic -E /tmp/buildd/*.changes; :" - pbuilder + + echo "+++ end of lintian output +++" + + EOF + +And configure the path to the hooks directory in ~/.pbuilderrc: + + HOOKDIR="/var/cache/pbuilder/hooks.d/" + +To skip running the lintian set LINTIAN=0 in the environment. When the +lintian package fails to install, like during perl transitions, the build +won't fail. diff --git a/debian/build.sh b/debian/build.sh new file mode 100755 index 000000000..e4d125269 --- /dev/null +++ b/debian/build.sh @@ -0,0 +1,271 @@ +#!/bin/bash + +################################################################################ +# Dependencies + +PACKAGES=( + git + distro-info + dpkg-dev + devscripts + pbuilder + cowbuilder + debhelper + dh-golang +) + +MISSING=() +for PKG in "${PACKAGES[@]}"; do + INSTALLED="$(dpkg-query -W --showformat='${Status}' "${PKG}" | grep -c " ok installed")" + if [ "${INSTALLED}" != "1" ]; then + MISSING+=("${PKG}") + fi +done + +if [ "${#MISSING[@]}" != "0" ]; then + echo "Error: Not all dependencies are installed: ${MISSING[*]}" + exit 1 +fi + +################################################################################ +# Variables + +DEFAULT_DISTRIBUTION="bookworm" + +if [ -z "${DISTRIBUTION}" ]; then + DISTRIBUTION="${DEFAULT_DISTRIBUTION}" +fi + +DEFAULT_RELEASE_VERSION="$(distro-info -r --series "${DISTRIBUTION}" 2> /dev/null)" + +if [ -z "${RELEASE_VERSION}" ]; then + RELEASE_VERSION="${DEFAULT_RELEASE_VERSION}" +fi + +DEFAULT_CHROOT="/var/cache/pbuilder/base-${DISTRIBUTION}+go.cow" + +if [ -z "${CHROOT}" ]; then + CHROOT="${DEFAULT_CHROOT}" +fi + +DEFAULT_NOCHROOT="0" + +if [ -z "${NOCHROOT}" ]; then + NOCHROOT="${DEFAULT_NOCHROOT}" +fi + +DEFAULT_DEBUG="0" + +if [ -z "${DEBUG}" ]; then + DEBUG="${DEFAULT_DEBUG}" +fi + +################################################################################ +# Commandline options + +OPTS=$(getopt -o D:R:C:Ndh --long distribution:release-version:,chroot:,nochroot,debug,help -n "$(basename "$0")" -- "$@") +RC=$? + +if [ "${RC}" != 0 ]; then + echo "Error: Failed to parse options." + exit 1 +fi + +eval set -- "${OPTS}" + +while true; do + case "$1" in + -D|--distribution) + shift + DISTRIBUTION="$1" + shift + ;; + -R|--release-version) + shift + RELEASE_VERSION="$1" + shift + ;; + -C|--chroot) + shift + CHROOT="$1" + shift + ;; + -N|--nochroot) + shift + DEBUG=1 + ;; + -d|--debug) + shift + DEBUG=1 + ;; + -h|--help) + shift + + echo "Usage: $(basename "$0") [OPTIONS]" + echo + echo "Options:" + echo "-D, --distribution Distribution to use in changelog" + echo " Default: ${DEFAULT_DISTRIBUTION}" + echo "-R, --release-version Version to use in ~debu1 suffix" + echo " Default: ${DEFAULT_RELEASE_VERSION}" + echo " Set to 0 to not append the suffix" + echo "-C, --chroot Path to cowbuilder chroot" + echo " Default: ${DEFAULT_CHROOT}" + echo "-N, --nochroot Don't use chroot for package build" + echo "-d, --debug Enable debug output" + echo "-h, --help Display this usage information" + echo + echo "Environment variables:" + echo "DISTRIBUTION Distribution to use in changelog" + echo "RELEASE_VERSION Version to use in ~debu1 suffix" + echo " Set to 0 to not append the suffix" + echo "CHROOT Path to cowbuilder chroot" + echo "NOCHROOT Don't use chroot for package build" + echo "DEBUG Enable debug output" + echo " Set to 1 to enable debug output" + + exit 1 + ;; + --) + shift + break + ;; + *) + shift + break + ;; + esac +done + +################################################################################ +# Main + +if [ "${DEBUG}" = "1" ]; then + set -x +fi + +# +# Create .orig.tar.gz +# + +DEBIAN_DIR="$(dirname "$0")" +SOURCE_DIR="$(dirname "${DEBIAN_DIR}")" + +cd "${SOURCE_DIR}" || exit 1 + +PACKAGE="$(dpkg-parsechangelog -S Source)" +VERSION="$(grep -E "(^|\s+)Version\s*=\s*\"(\S+)\"\s*" utils/consts.go | awk -F'"' '{print $2}' | sed 's/^v//g')" + +PATTERN="^[0-9]+.[0-9]+.[0-9]+(~[a-z0-9]+)?$" + +if [[ ${VERSION} =~ ${PATTERN} ]]; then + true +else + echo "Error: Failed to extract version" + exit 1 +fi + +GIT_COMMIT="HEAD" + +GIT_TAG_LOG="$(git tag -l --points-at "${GIT_COMMIT}")" + +COMMIT_DATE="$(git log -n1 --format=format:%cd --date="format:%Y%m%d%H%M%S" "${GIT_COMMIT}")" +COMMIT_HASH="$(git log -n1 --format=format:%h "${GIT_COMMIT}")" + +if [ -n "${GIT_TAG_LOG}" ]; then + PACKAGE_VERSION="${VERSION}" +else + PACKAGE_VERSION="${VERSION}+${COMMIT_DATE}+${COMMIT_HASH}" +fi + +ORIG_TARBALL="../${PACKAGE}_${PACKAGE_VERSION}.orig.tar.gz" + +if [ ! -e "${ORIG_TARBALL}" ]; then + echo "Creating ${ORIG_TARBALL} from ${GIT_COMMIT}" + git archive -o "${ORIG_TARBALL}" --format tar.gz --prefix "${PACKAGE}-${VERSION}/" "${GIT_COMMIT}" +fi + +# +# Create .orig.tar-dependencies.gz +# + +DEPENDENCIES_TARBALL="../${PACKAGE}_${PACKAGE_VERSION}.orig-dependencies.tar.gz" + +if [ ! -e "${DEPENDENCIES_TARBALL}" ]; then + ./debian/create-components.sh "${ORIG_TARBALL}" +fi + +# +# Unpack .orig.tar-dependencies.gz +# + +if [ ! -e "${DEPENDENCIES_TARBALL}" ]; then + echo "Error: No dependencies tarball" + exit 1 +fi + +DEPENDENCIES_PATH="dependencies" + +if [ ! -e "${DEPENDENCIES_PATH}" ]; then + echo "Unpacking dependencies" + tar xaf "${DEPENDENCIES_TARBALL}" +fi + +# +# Update changelog +# + +CHANGELOG_VERSION="$(dpkg-parsechangelog -S Version)" + +PACKAGE_REVISION="${PACKAGE_VERSION}-1" + +if [[ ${RELEASE_VERSION} =~ ^[0-9]+$ ]] && [ "${RELEASE_VERSION}" != "0" ]; then + PACKAGE_REVISION="${PACKAGE_REVISION}~deb${RELEASE_VERSION}u1" +fi + +if [ "${CHANGELOG_VERSION}" != "${PACKAGE_REVISION}" ]; then + echo "Updating changelog" + dch -v "${PACKAGE_REVISION}" \ + -m "Package build for git commit ${COMMIT_HASH} (${COMMIT_DATE})." \ + -D "${DISTRIBUTION}" --force-distribution +fi + +# +# Build package +# + +if [ -n "${GIT_TAG_LOG}" ]; then + GIT_COMMIT_DATE="" + GIT_COMMIT_HASH="" +else + GIT_COMMIT_DATE="$(git log -n1 --format=format:%cI "${GIT_COMMIT}")" + GIT_COMMIT_HASH="$(git log -n1 --format=format:%H "${GIT_COMMIT}")" +fi + +export GIT_COMMIT_DATE +export GIT_COMMIT_HASH + +echo "Building package" +if [ "${NOCHROOT}" = "0" ]; then + pdebuild --pbuilder cowbuilder -- --basepath "${CHROOT}" +else + MAINTAINER_EMAIL="$(dpkg-parsechangelog -S Maintainer | awk -F'<' '{print $2}' | sed 's/>$//')" + KEY_COUNT="$(gpg --list-secret-keys "${MAINTAINER_EMAIL}" 2> /dev/null | grep -c "^sec")" + + if [ "${KEY_COUNT}" = "0" ]; then + NO_SIGN="--no-sign" + else + NO_SIGN="" + fi + + dpkg-buildpackage -rfakeroot -tc "${NO_SIGN}" +fi + +# +# Undo changes +# + +echo "Undoing changes" +rm -rf dependencies/ +git checkout debian/changelog + diff --git a/packages/debian/cgrates.service b/debian/cgrates.service similarity index 100% rename from packages/debian/cgrates.service rename to debian/cgrates.service diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..92ca95568 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cgrates (0.11.0~dev-1) UNRELEASED; urgency=medium + + * Initial Release. + + -- DanB Thu, 07 Sep 2023 20:34:34 +0200 diff --git a/debian/clean b/debian/clean new file mode 100644 index 000000000..48b8bf907 --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +vendor/ diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..174bbc2cc --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: cgrates +Maintainer: DanB +Section: misc +Priority: optional +Build-Depends: debhelper-compat (= 13), + dh-exec, + dh-golang +Standards-Version: 4.6.2 +Vcs-Browser: https://github.com/cgrates/cgrates +Vcs-Git: https://github.com/cgrates/cgrates.git +Homepage: http://cgrates.org +Rules-Requires-Root: no +XS-Go-Import-Path: github.com/cgrates/cgrates + +Package: cgrates +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends} +Suggests: default-mysql-server, + redis-server +Pre-Depends: ${misc:Pre-Depends} +Description: Carrier Grade Real-time Charging System + CGRateS is a very fast and easily scalable real-time enterprise billing + suite targeted at ISPs and telecom operators (but not only). diff --git a/packages/debian/copyright b/debian/copyright similarity index 51% rename from packages/debian/copyright rename to debian/copyright index 7ac123eed..1d49fdc18 100644 --- a/packages/debian/copyright +++ b/debian/copyright @@ -1,15 +1,16 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: CGRateS -Source: http://cgrates.org +Source: https://github.com/cgrates/cgrates Files: * -Copyright: Copyright 2019 DanB -License: GPL-3 +Copyright: 2019, DanB +License: GPL-3+ -License: GPL-3 - Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments - Copyright (C) ITsysCOM GmbH - . +Files: debian/* +Copyright: Bas Couwenberg +License: GPL-3+ + +License: GPL-3+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -20,9 +21,6 @@ License: GPL-3 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . - You should have received a copy of the GNU General Public License - along with this program. If not, see - . - On Debian systems, the full text of the GNU General Public - License version 3 can be found in the file + On Debian systems, the full text of the GNU General Public License + version 3 can be found in the file `/usr/share/common-licenses/GPL-3'. diff --git a/debian/create-components.sh b/debian/create-components.sh new file mode 100755 index 000000000..5d465660e --- /dev/null +++ b/debian/create-components.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +if [ -z "${GO}" ]; then + GO="/usr/local/go/bin/go" +fi + +UPSTREAM_TARBALL="$(realpath -s "$1")" + +if [ ! -e "${UPSTREAM_TARBALL}" ]; then + echo "Error: Upstream tarball not found" + exit 1 +fi + +COMPONENT_NAME="dependencies" +COMPONENT_TARBALL="${UPSTREAM_TARBALL//.orig.tar/.orig-${COMPONENT_NAME}.tar}" + +TEMP_DIR="$(mktemp -d)" + +GOPATH="${TEMP_DIR}/${COMPONENT_NAME}" +export GOPATH + +echo "Unpacking upstream tarball: ${UPSTREAM_TARBALL} into: ${TEMP_DIR}" +tar --strip-components=1 -xaf "${UPSTREAM_TARBALL}" -C "${TEMP_DIR}" + +for CMD_DIR in "${TEMP_DIR}/cmd/"*; do + echo "Getting $(basename "${CMD_DIR}") dependencies into: ${GOPATH}" + cd "${CMD_DIR}" || exit 1 + "${GO}" get . + cd "${OLDPWD}" || exit 1 +done + +echo "Fixing permissions for: ${GOPATH}" +chmod -R u+w "${GOPATH}" + +echo "Creating component tarball: ${COMPONENT_TARBALL}" +cd "${TEMP_DIR}" || exit 1 +tar --owner root --group root -caf "${COMPONENT_TARBALL}" "${COMPONENT_NAME}" +cd "${OLDPWD}" || exit 1 + +echo "Removing temporary directory: ${TEMP_DIR}" +rm -rf "${TEMP_DIR}" diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 000000000..4ca46ac5d --- /dev/null +++ b/debian/dirs @@ -0,0 +1,9 @@ +var/lib/cgrates/cache_dump +var/log/cgrates +var/spool/cgrates/analyzers +var/spool/cgrates/cdre/csv +var/spool/cgrates/cdre/fwv +var/spool/cgrates/ers/in +var/spool/cgrates/ers/out +var/spool/cgrates/failed_posts +var/spool/cgrates/tpe diff --git a/debian/install b/debian/install new file mode 100755 index 000000000..c5ff0f171 --- /dev/null +++ b/debian/install @@ -0,0 +1,5 @@ +#!/usr/bin/dh-exec +data/conf/cgrates/ etc/ +data/conf/logging/logrotate.conf => etc/logrotate.d/cgrates +data/conf/logging/rsyslog.conf => etc/rsyslog.d/25-cgrates.conf +data/* usr/share/cgrates/ diff --git a/debian/lintian-overrides b/debian/lintian-overrides new file mode 100644 index 000000000..b0ac79b3b --- /dev/null +++ b/debian/lintian-overrides @@ -0,0 +1,21 @@ +# Not picked up by go +hardening-no-pie [usr/bin/*] + +# Not a problem +no-manual-page [usr/bin/*] + +# Not a problem +package-contains-documentation-outside-usr-share-doc [usr/share/cgrates/*] + +# Only systemd is supported +package-supports-alternative-init-but-no-init.d-script [lib/systemd/system/cgrates.service] + +# No good alternative +recursive-privilege-change "chown -R" [postinst:*] + +# Sources for dependencies are included as-is +spelling-error-in-binary * + +# Unported python2 scripts +unusual-interpreter /usr/bin/python [usr/share/cgrates/*/migrator/*.py] + diff --git a/packages/debian/postinst b/debian/postinst similarity index 100% rename from packages/debian/postinst rename to debian/postinst diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..775fb8bd7 --- /dev/null +++ b/debian/rules @@ -0,0 +1,45 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 + +# Enable hardening build flags +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +export DH_GOLANG_BUILDPKG=github.com/cgrates/cgrates/cmd/cgr-console \ + github.com/cgrates/cgrates/cmd/cgr-engine \ + github.com/cgrates/cgrates/cmd/cgr-loader \ + github.com/cgrates/cgrates/cmd/cgr-migrator \ + github.com/cgrates/cgrates/cmd/cgr-tester + +export GO111MODULE=on + +%: + dh $@ --builddirectory=_build --buildsystem=golang + +override_dh_auto_clean: + PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_clean + +override_dh_auto_configure: + PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_configure + +execute_after_dh_auto_configure: + (mkdir -p _build/pkg && cd _build/pkg && ln -s ../../dependencies/pkg/* .) + +override_dh_auto_build: + PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_build -- \ + -ldflags "-X 'github.com/cgrates/cgrates/utils.GitCommitDate=$$GIT_COMMIT_DATE' \ + -X 'github.com/cgrates/cgrates/utils.GitCommitHash=$$GIT_COMMIT_HASH'" + +override_dh_auto_test: + PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_test + +override_dh_auto_install: + PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_install -- --no-source + +execute_after_dh_install: + tar -xavf debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz \ + -C debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/ + rm -f debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz + +override_dh_dwz: + dh_dwz -Xcgr-console -Xcgr-engine -Xcgr-loader -Xcgr-migrator -Xcgr-tester diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 000000000..fddaa9caf --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,7 @@ +# Dependencies are included as-is +source-is-missing [dependencies/*] +source-contains-prebuilt-windows-binary [dependencies/*] + +# Not worth the effort for unofficial package +add-component-copyright dependencies [debian/copyright] + diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 000000000..7df7b0728 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,5 @@ +--- +Bug-Database: https://github.com/cgrates/cgrates/issues +Bug-Submit: https://github.com/cgrates/cgrates/issues/new +Repository: https://github.com/cgrates/cgrates.git +Repository-Browse: https://github.com/cgrates/cgrates diff --git a/debian/watch b/debian/watch new file mode 100644 index 000000000..ccff148f4 --- /dev/null +++ b/debian/watch @@ -0,0 +1,7 @@ +#version=4 +#opts=\ +#dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\ +#uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\ +#filenamemangle=s/(?:.*?)?(?:rel|v|cgrates)?[\-\_]?(\d\S+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/cgrates-$1.$2/ \ +#https://github.com/cgrates/cgrates/tags \ +#(?:.*?/archive/(?:.*?/)?)?(?:rel|v|cgrates)?[\-\_]?(\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) diff --git a/packages/Makefile b/packages/Makefile index da3934644..f43255144 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -1,53 +1,4 @@ - -GIT_TAG_LOG=$(shell git tag -l --points-at HEAD) - -DISTRIBUTION ?= master - -ifneq ($(GIT_TAG_LOG),) - DISTRIBUTION := stable -endif - - -GIT_COMMIT=$(shell git log -n1 --format=format:%h) -GIT_DATE=$(shell date +%Y%m%d%H%M%S --date="@$(shell git log -n1 --format=format:%ct)") - -ifeq ($(GIT_COMMIT),) - echo "Error: Failed to extract commit from git log" - exit 1 -endif -ifeq ($(GIT_DATE),) - echo "Error: Failed to extract date from git log" - exit 1 -endif - -DEBIAN_VERSION=$(shell dpkg-parsechangelog -S Version -ldebian/changelog 2> /dev/null) - -ifeq ($(DEBIAN_VERSION),) - echo "Error: Failed to extract version from debian changelog" - exit 1 -endif - -DEBIAN_PKG_VERSION=$(DEBIAN_VERSION)+$(GIT_DATE)+$(GIT_COMMIT) - -ifneq ($(GIT_TAG_LOG),) - DEBIAN_PKG_VERSION=$(DEBIAN_VERSION) -endif - -MAINTAINER_EMAIL=$(dpkg-parsechangelog -S Maintainer | awk -F'<' '{print $$2}') -KEY_COUNT=$(shell gpg --list-secret-keys "$(MAINTAINER_EMAIL)" 2> /dev/null | grep -c "^sec") -ifeq ($(KEY_COUNT), 0) - NO_SIGN="--no-sign" -else - NO_SIGN="" -endif - - deb: - cd ..;\ - ln -sf packages/debian debian ;\ - dch -v "$(DEBIAN_PKG_VERSION)" -m "Package build for git commit $(GIT_COMMIT) ($(GIT_DATE))." -D "$(DISTRIBUTION)" --force-distribution ;\ - dpkg-buildpackage -rfakeroot -tc $(NO_SIGN); \ - rm debian - git checkout debian/changelog + cd .. && ./debian/build.sh .PHONY: deb diff --git a/packages/debian/changelog b/packages/debian/changelog deleted file mode 100644 index 955a9401b..000000000 --- a/packages/debian/changelog +++ /dev/null @@ -1,221 +0,0 @@ -cgrates (0.11.0~dev) UNRELEASED; urgency=medium - [ DanB ] - * [FilterS] Renamed rals_conns to apiers_conns - * [FilterS] Updated *destination filter to get ReverseDestination form - API - * [SessionS] Added check for missing CGRevent - * [SessionS] Added *cost flag for SessionSv1.ProcessEvent to calculate - the rater cost - * [ConnManager] Added ApierSv2 as internal connection channel instead - of ApierSv1 - * [DiameterAgent] Using String function from diam.Message instead of - ToJSON for request String method - * [DiameterAgent] Updated 3gp_vendor dictionary - * [Templates] Added new dataconverter: *ip2hex - * [AgentS] Added support for *group type and correctly overwrite - the values in case of *variable - * [ERs] Correctly populate ConcurrentRequest from config - * [FilterS] Updated *exists to dynamically compute the path if the - path - * [AgentS] Added support for *tmp path - * [SessionS] Added new API SessionSv1.GetCost - * [SessionS] Updateed MaxUsage field from API replies - * [SessionS] Added support for *cdrs flag in SessionSv1.ProcessEvent - * [StatS] Update metric definition to include path for example: - *sum:~*req.Field1 - * [SupplierS] SupplierS require a connection to rals when give - AccountIDs and RatingPlanIDs to calculate - * [SupplierS] In case of missing usage from Event use 1 minute as - default value - * [DataDB] Mongo support different marshaler than msgpack - * [ConnManager] Fixed rpc_conns handling id with two connections and one of - it *internal - * [Replicator] Added Limit and StaticTTL otions for Items from - DataDB/StorDB - * [Migrator] Auto discover tenant from key instead of taking it from config - * [Templates] Fixed missing "*" for strip and pading strategy - * [DiameterAgent] Added RAR support - * [Loader] Added support to load CSV files from URL - * [Loader] Added configurable gapi_credentials - * [Loader] Added configurable gapi_token - * [AgentS] Add authentication mechanism for Radius (PAP, CHAP, - MSCHAPV2) - * [SessionS] Update subflags for *rals ( *authorize and *initiate ) - * [AgentS] Uniformize flags (*auth -> *authorize) - * [SessionS] Move *cost as subflag in *rals for - SessionSv1.ProcessEvent - * [DiameterAgent] Added DPR support - * [SupplierS] Add verification for event filters before populating - data - * [ERs] Add support for *json type - * [AgentS] Add ability to inject data in cache from agents - * [Config] Config cache format change to include partitions - * [ERs] Add *none EventReader type - * [SessionS] Added support for *stir_authenticate - * [SessionS] Added support for *stir_initiate - * [RouteS] Renaming from SupplierS to RouteS - * [AgentS] Improved NavigableMap - * [General] Default timingIDs start from time.Now() (i.e. *monthly time.Now() + 1 month ) - * [AgentS] FieldAsInterface return data instead of NMItem - * [RouteS] Add posibility to load routes with the sameID and different filters - * [RouteS] Correctly populate Sorting out of models - * [AgentS] Added SIPAgent for SIP redirection - * [AgentS] Added *constant: prefix to do not proccess the value - with RSRParsers - * [AgentS] Added DynamicDataProvider to AgentRequest - * [Server] Corectly log the server listen error - * [ERs] Added support to reference CSV fields by the column name - * [ERs] Renamed *default reader folders - * [FilterS] Updated Filter indexes - * [General] Added *mo+extraDuration time support (e.g. *mo+1h will be time.Now() + 1 month + 1 hour) - * [SessionS] Use correctly SessionTTLUsage when calculate end usage in case of terminate session from ttl mechanism - * [SessionS] Add SessionTLLLastUsage as option for an extra debit in case of ttl mechanism - * [LoaderS] Add *req as mandatory prefix - * [AgentS] Rename prefix from *cache to *uch - * [InternalDB] Updated InternalDB to use the global cache - * [RSRParsers] Removed *constant: prefix - * [RSRParsers] Removed attribute sistem from RSRParser - * [RSRParsers] Added grave accent(`) char as a delimiter to not split tge RSR value - * [RSRParsers] Moved RSRFilter from RSRParsers to the *rsr FilterS - * [SessionS] Rename from ResourceMessage to ResourceAllocation - * [LoaderS] Updated file selector from *req to *file(FileName) - * [SessionS] Added *chargers flag to ProcessEvent to proccess the events from ChargerS with other subsystems - * [SessionS] Updated the ids handling in flags by adding *ids as a new flag - * [SessionS] Added *derived_reply sub flag to ProcessEvent to specify if a subsystem needs to process the events from ChargerS - * [Templates] Added new dataconverter: *string2hex - * [AttributeS] Updated AttributeProfile matching to match the second AttributeProfile with the same weight - * [AttributeS] Updated inline AttributeProfiles to unite all consecutive inline attributes in a single profile - * [SessionS] Added *processRuns option to control the process runs for AttributeS - * [DispatcherS] Removed ArgDispatcher in favor of Opts - * [ERs] Add support for *template type - * [EEs] Add support for *template type - * [LoaderS] In case of empty output directory path don't move the processed file - * [FilterS] Added *ipnet filter to check if the network contains the IP - * [CacheS] Updated ReloadCache and LoadCache APIs to use a map instead of a structure to be compatible with gob encoding - * [CGR-CONSOLE] Uniformize the commands between profile and subsystem - * [StatS] Add rounding operation for duration metric (e.g. acd, tcd, etc...) - * [DispatcherH] Added DispatcherH subsystem - * [ERs] Added support for *amqp_json_map type - * [DataDB] Moved all specific DB options in opts - * [Config] Add new section "template" - * [LoaderS] Add support for *template type - * [ActionS] Replaced the poster action with *export that will send the event to EEs - * [AgentS] DiameterAgent return NOT_FOUND instead of "filter not passing" error and let other subsystem to handle this (e.g. FilterS) - * [StatS] Change format of metricID when specifying fields ( e.g. *sum#~*req.FieldName ) - * [FilterS] Added *apiban filter - * [EEs] Add support for *elastic exporter - * [AttributeS] Add support for adding fields from other places that event (e.g. Resource.TotalUsage, Stat.MetricName, Account.Balance) - * [EEs] Empty fields in exporter config will export the full event for the exporters that use json format - * [DynamicDP] Add support for *libphonenumber prefix - * [Templates] Added new data converter: *unixtime - * [ActionsS] Add prefix *acnt and *act to cdrLog action - * [AttributeS] Add support for *prefix and *suffix type - * [ConfigS] Add "redis_" prefix to "dataDB" option for redis - * [DataDB] Add support for redis with TLS connection ( + integration test ) - * [ERs] Added support for *s3_json_map type - * [ERs] Added support for *sqs_json_map type - * [ERs] Added support for *amqpv1_json_map type - * [RALs] Send balance update event from rals to threshold ( in case of negative) only once - * [SessionS] Use rals_conns when sending refund rounding - * [General] Made tenant optional for all API calls - * [ConfigS] Moved MinCallDuration,MaxCallDuration from sessions config to general config - * [StatS] Added support for nested fields in custom metrics - * [AccountS] Add Initial in AccountSummary as initail value before debit operation - * [General] For only *asap actions don't save AccountIDs withing ActionPlans - * [AnalyzerS] Added AnalyzerSv1.StringQuery API to search over the recorded RPC calls - * [CoreS] Moved the server implementation in the new cores package - * [RouteS] In case of same weight sort random - * [ConfigS] Renamed ReloadConfigFromPath API to ReloadConfig - * [ConfigS] Renamed ReloadConfig API to SetConfig - * [ConfigS] Renamed ReloadConfigFromJSON API to SetConfigFromJSON - * [CDRs] Replaced RSRField with RSRParser - * [RouteS] Add new field RouteRateProfileIDs in RateProfiles.csv - * [DispatcherS] Removed connection pool from DispatcherHost structure - * [DispatcherS] Updated *broadcast, *broadcast_sync and *broadcast_async to behave similar to RPCPool - * [ActionsS] Added *remote_set_account action - * [SessionS] Properly charge terminate without initiate event - * [ServiceS] Added service dependency map to control the shutdown order - * [EEs] Add support for *sql exporter - * [ApierS] Correct handle error in case of APIerSv1.GetActionTriggers - * [SessionS] Added extra condition to determine if the increment is considered the roundIncrement - * [SessionS] Cloned the charging interval added on EventCost merge - * [FilterS] Optimized the automated index fields matching - * [AgentS] Added *cfg as DataProvider for AgentRequest - * [AgentS] Added *routes_maxcost flag - * [SessionS] Added *sessionChargeable session option to control session charging - * [SessionS] Replaced max_call_duration config with default_usage for each ToR - * [SessionS] Added JSON and GOB BiRPC support - * [ActionS] Added *add_balance, *set_balance and *rem_balance - * [RegistrarC] Renamed DispatcherH to RegistrarC - * [DataDB] Added replication filtering - * [ApierS] Moved Cache field as options - * [RouteS] Updated RouteSv1.GetRoutes API to return multiple profiles - * [Templates] Added support for Length Field in case of NMSlice - * [Templates] Added support for multiple indexes - * [AgentS] Added ~*req prefix for freeswitch extra_fields - * [AgentS] Changed NavigableMap with DataNode for speed improvements - * [SessionS] RequestType *none returns back the requested usage - * [DataDB] Updated config options - * [StorDB] Updated config options - * [ERs] Refactored the reader options - * [ERs] Removed *flatstore and *partialcsv - * [ERs] Added *opts.*partial to control if the event is partial or not - * [AttributeS] Added any_context config to control the matching attributes - * [DispatcherS] Added any_subsyste config to control the matching dispatchers - * [StatS] AverageCallCost and TotalCallCost now returns error for negative Cost field - * [SessionS] The sessions are no longer terminated on shutdown if the replication_conns are set - * [FilterS] Added *regex filter - * [RSRParsers] Added *len dataconverter - * [ERs] Added *nats_json_map - * [EEs] Added *nats_json_map - * [RSRParsers] Added *slice dataconverter - * [CacheS] Updated LoadCache and ReloadCache APIs - * [EEs] Added *log exporter - * [AttributeS] Added profile_runs to control how many times a profile is proccessed for an event - * [DNSAgent] Updated Msg handling from templates - * [ActionsS] Replaced structmatcher with normal filters - - -- DanB Wed, 19 Feb 2020 13:25:52 +0200 - -cgrates (0.10.0) UNRELEASED; urgency=medium - - * Creating first stable branch. - - -- DanB Thu, 6 Feb 2020 12:05:00 +0200 - -cgrates (0.9.1~rc8) UNRELEASED; urgency=medium - - * RC8. - - -- DanB Mon, 22 Sep 2015 12:05:00 +0200 - -cgrates (0.9.1~rc7) UNRELEASED; urgency=low - - * RC7. - - -- DanB Wed, 3 Aug 2015 14:04:00 -0600 - -cgrates (0.9.1~rc6) UNRELEASED; urgency=low - - * RC6. - - -- DanB Wed, 10 Sep 2014 13:30:00 +0100 - -cgrates (0.9.1~rc5) UNRELEASED; urgency=low - - * RC5. - - -- DanB Mon, 18 Aug 2014 13:30:00 +0100 - - -cgrates (0.9.1~rc4) UNRELEASED; urgency=low - - * RC4. - - -- DanB Thu, 25 Mar 2014 17:30:00 +0100 - -cgrates (0.9.1~rc3) UNRELEASED; urgency=low - - * RC3. - - -- DanB Fri, 03 Jan 2014 17:37:31 +0100 diff --git a/packages/debian/compat b/packages/debian/compat deleted file mode 100644 index 7f8f011eb..000000000 --- a/packages/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/packages/debian/control b/packages/debian/control deleted file mode 100644 index 2753f78b4..000000000 --- a/packages/debian/control +++ /dev/null @@ -1,14 +0,0 @@ -Source: cgrates -Section: base -Priority: optional -Maintainer: DanB -Build-Depends: debhelper, git -Standards-Version: 3.9.1 -Homepage: http://cgrates.org - -Package: cgrates -Architecture: amd64 -Suggests: git, redis-server, mysql-server -Version: 0.11.0-dev -Description: Carrier Grade Real-time Charging System - CGRateS is a very fast and easy scalable real-time charging system for Telecom environments. diff --git a/packages/debian/docs b/packages/debian/docs deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/debian/rules b/packages/debian/rules deleted file mode 100755 index ef74c1d9f..000000000 --- a/packages/debian/rules +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -# Uncomment this to turn on verbose mode. -export DH_VERBOSE=1 - -# This should be an empty directory -# This will be deleted after the package was created -export GOPATH=$(CURDIR)/tmp - -PKGDIR=debian/cgrates - -%: - dh $@ - -clean: - dh_clean - go clean -modcache - rm -rf $(GOPATH) - -binary-arch: clean - dh_prep - dh_installdirs - exec $(CURDIR)/build.sh - mkdir -p $(PKGDIR)/usr/bin - cp $(GOPATH)/bin/cgr-* $(PKGDIR)/usr/bin/ - mkdir -p $(PKGDIR)/etc/ - cp -r $(CURDIR)/data/conf/cgrates $(PKGDIR)/etc/ - mkdir -p $(PKGDIR)/etc/logrotate.d - mkdir -p $(PKGDIR)/etc/rsyslog.d - cp -r $(CURDIR)/data/conf/logging/logrotate.conf $(PKGDIR)/etc/logrotate.d/cgrates - cp -r $(CURDIR)/data/conf/logging/rsyslog.conf $(PKGDIR)/etc/rsyslog.d/25-cgrates.conf - mkdir -p $(PKGDIR)/usr/share/cgrates - cp -r $(CURDIR)/data/* $(PKGDIR)/usr/share/cgrates/ - tar -xzvf $(PKGDIR)/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz -C $(PKGDIR)/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/ - rm $(PKGDIR)/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz - mkdir -p $(PKGDIR)/var/spool/cgrates/ers/in - mkdir -p $(PKGDIR)/var/spool/cgrates/ers/out - mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/csv - mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/fwv - mkdir -p $(PKGDIR)/var/spool/cgrates/tpe - mkdir -p $(PKGDIR)/var/spool/cgrates/failed_posts - mkdir -p $(PKGDIR)/var/spool/cgrates/analyzers - mkdir -p $(PKGDIR)/var/lib/cgrates/cache_dump - mkdir -p $(PKGDIR)/var/log/cgrates - dh_strip - dh_compress - dh_fixperms - # dh_installinit - dh_systemd_enable - dh_systemd_start - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-arch diff --git a/packages/debian/source/format b/packages/debian/source/format deleted file mode 100644 index 89ae9db8f..000000000 --- a/packages/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/packages/debian/source/options b/packages/debian/source/options deleted file mode 100644 index 38bb1abc2..000000000 --- a/packages/debian/source/options +++ /dev/null @@ -1,5 +0,0 @@ -tar-ignore = .hg -tar-ignore = .git -tar-ignore = .bzr -tar-ignore = .gitignore -tar-ignore = .travis.yml