From: Otto Moerbeek Date: Wed, 22 Jan 2025 09:17:46 +0000 (+0100) Subject: Replace a few symlinks with actual files X-Git-Tag: dnsdist-2.0.0-alpha1~127^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=efdcbb5364256391873826e6d6dd0e9c43b0425b;p=thirdparty%2Fpdns.git Replace a few symlinks with actual files --- diff --git a/pdns/recursordist/NOTICE b/pdns/recursordist/NOTICE deleted file mode 120000 index fb376cfaa4..0000000000 --- a/pdns/recursordist/NOTICE +++ /dev/null @@ -1 +0,0 @@ -../../NOTICE \ No newline at end of file diff --git a/pdns/recursordist/NOTICE b/pdns/recursordist/NOTICE new file mode 100644 index 0000000000..ddd9b42112 --- /dev/null +++ b/pdns/recursordist/NOTICE @@ -0,0 +1,16 @@ +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as +published by the Free Software Foundation. + +In addition, for the avoidance of any doubt, permission is granted to +link this program with OpenSSL and to (re)distribute the binaries +produced as the result of such linking. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +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, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/pdns/recursordist/builder-support/gen-version b/pdns/recursordist/builder-support/gen-version deleted file mode 120000 index 68c709be98..0000000000 --- a/pdns/recursordist/builder-support/gen-version +++ /dev/null @@ -1 +0,0 @@ -../../../builder-support/gen-version \ No newline at end of file diff --git a/pdns/recursordist/builder-support/gen-version b/pdns/recursordist/builder-support/gen-version new file mode 100755 index 0000000000..c2a56b451b --- /dev/null +++ b/pdns/recursordist/builder-support/gen-version @@ -0,0 +1,77 @@ +#!/bin/sh +if [ ! -z "${BUILDER_VERSION}" ]; then + printf ${BUILDER_VERSION} + exit 0 +fi + +VERSION="unknown" + +DIRTY="" +git status | grep -q clean || DIRTY='.dirty' + +# Special environment variable to signal that we are building a release, as this +# has consequenses for the version number. +if [ "${IS_RELEASE}" = "YES" ]; then + TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)" + if [ -n "${TAG}" ]; then + # We're on a tag + echo "${TAG}${DIRTY}" > .version + printf "${TAG}${DIRTY}" + exit 0 + fi + echo 'This is not a tag, either tag this commit or do not set $IS_RELEASE' >&2 + exit 1 +fi + +# +# Generate the version number based on the branch +# +if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then + if [ -n "${BUILDER_MODULES}" ]; then + match=${BUILDER_MODULES} + [ $match = "authoritative" ] && match='auth' + [ $match = "recursor" ] && match='rec' + GIT_VERSION="$(git describe --match=${match}-* --tags | cut -d- -f2-)" + if [ $(echo ${GIT_VERSION} | awk -F"-" '{print NF-1}') = '3' ]; then + # A prerelease happened before + LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1-2)" + COMMITS_SINCE_TAG="$(echo ${GIT_VERSION} | cut -d- -f3)" + GIT_HASH="$(echo ${GIT_VERSION} | cut -d- -f4)" + elif [ $(echo ${GIT_VERSION} | awk -F"-" '{print NF-1}') = '1' ]; then + # Exactly on a pre-release + LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1-2)" + else + LAST_TAG="$(echo ${GIT_VERSION} | cut -d- -f1)" + COMMITS_SINCE_TAG="$(echo ${GIT_VERSION} | cut -d- -f2)" + GIT_HASH="$(echo ${GIT_VERSION} | cut -d- -f3)" + fi + fi + + if [ -z "${GIT_VERSION}" ]; then + # BUILDER_SUPPORT has more than one product listed, fall back to the 0.0.0 logic + + # We used 0.0.XXXXgHASH for master in the previous incarnation of our build pipeline. + # This now becomes 0.0.XXXX.0.gHASH, as 0.0.0.XXXX.gHASH (which is more correct) + # would break upgrades for those running master + # This _should_ be ok for forever is we stick to X.Y.Z for version numbers + LAST_TAG=0.0 + COMMITS_SINCE_TAG="$(git rev-list --count 12c868770afc20b6cc0da439d881105151d557dd..HEAD 2> /dev/null).0" + [ "${COMMITS_SINCE_TAG}" = ".0" ] && COMMITS_SINCE_TAG=0.0 + GIT_HASH="g$(git rev-parse HEAD | cut -c1-10 2> /dev/null)" + fi + + BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')" + + TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)" + if [ -n "${TAG}" ]; then # We're exactly on a tag + COMMITS_SINCE_TAG="0" + GIT_HASH="g$(git show --no-patch --format=format:%h HEAD 2>/dev/null)" + if [ -z "$GIT_HASH" ]; then + GIT_HASH="g$(git show --format=format:%h HEAD | head -n1)" + fi + fi + + VERSION="${LAST_TAG}.${COMMITS_SINCE_TAG}${BRANCH}.${GIT_HASH}${DIRTY}" +fi + +printf $VERSION diff --git a/pdns/recursordist/meson-dist-script b/pdns/recursordist/meson-dist-script index f430a1de32..06f5572b1a 100755 --- a/pdns/recursordist/meson-dist-script +++ b/pdns/recursordist/meson-dist-script @@ -1,4 +1,5 @@ #!/bin/sh echo HI AM AM THE DIST SCRIPT -env \ No newline at end of file +pwd +env diff --git a/pdns/recursordist/meson.build b/pdns/recursordist/meson.build index 0e72b6fbbc..3c9976c87b 100644 --- a/pdns/recursordist/meson.build +++ b/pdns/recursordist/meson.build @@ -1,7 +1,7 @@ project( 'pdns-recursor', ['c', 'cpp'], - version: run_command(meson.current_source_dir() / 'builder-support' / 'gen-version', check: true).stdout().strip(), + version: run_command('builder-support' / 'gen-version', check: true).stdout().strip(), license: 'GPLv2', license_files: 'NOTICE', meson_version: '>= 1.2.1', @@ -11,7 +11,6 @@ project( 'cpp_std=c++17', ], ) - meson.add_dist_script('meson-dist-script') add_project_arguments('-DRECURSOR', language: 'cpp')