mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Merge pull request #889 from hamishcoleman/version_nr
Revamp version number handling
This commit is contained in:
commit
9c3a2c3301
|
@ -25,6 +25,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate
|
55
.github/workflows/debug.yml
vendored
Normal file
55
.github/workflows/debug.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
name: Debug
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
# Oh, github, for a company that is built around the git VCS, how is it
|
||||
# that you have managed to break the repositories so much?
|
||||
#
|
||||
debug_github_repo:
|
||||
name: Debug Github Repo
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
- name: Debug data output
|
||||
run: |
|
||||
echo ==========
|
||||
echo git status
|
||||
git status
|
||||
echo ==========
|
||||
echo git tag
|
||||
git tag
|
||||
echo ==========
|
||||
echo git describe
|
||||
git describe || true
|
||||
echo ==========
|
||||
echo git for-each-ref refs/heads
|
||||
git for-each-ref refs/heads
|
||||
echo ==========
|
||||
echo git for-each-ref refs/tags
|
||||
git for-each-ref refs/tags
|
||||
echo ==========
|
||||
echo ls .git/refs/heads
|
||||
ls .git/refs/heads
|
||||
echo ==========
|
||||
echo ls .git/refs/tags
|
||||
ls .git/refs/tags
|
||||
echo ==========
|
||||
TYPE=$(git cat-file -t $GITHUB_REF)
|
||||
echo REF=$GITHUB_REF
|
||||
echo TAGTYPE=$TYPE
|
||||
echo ==========
|
||||
echo git cat-file $TYPE $GITHUB_REF
|
||||
git cat-file $TYPE $GITHUB_REF
|
40
.github/workflows/tests.yml
vendored
40
.github/workflows/tests.yml
vendored
|
@ -13,6 +13,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
- name: Run minimal test set
|
||||
run: |
|
||||
./autogen.sh
|
||||
|
@ -25,6 +31,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
|
||||
- name: Make the makefiles
|
||||
run: |
|
||||
|
@ -52,6 +64,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
|
||||
- name: Install essential
|
||||
run: |
|
||||
|
@ -118,6 +136,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
|
@ -191,6 +215,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
git fetch --force --tags
|
||||
|
||||
|
||||
- name: generate a makefile and use it to install more packages
|
||||
run: |
|
||||
|
@ -335,6 +365,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
|
@ -371,6 +403,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
|
@ -418,6 +452,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
|
@ -471,6 +507,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
|
@ -528,6 +566,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fix Checkout
|
||||
run: |
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
*.a
|
||||
*.gz
|
||||
configure
|
||||
configure.ac
|
||||
config.*
|
||||
/Makefile
|
||||
tools/Makefile
|
||||
|
|
|
@ -6,34 +6,29 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# N2n release information
|
||||
set(N2N_VERSION "3.1.0")
|
||||
set(N2N_OSNAME ${CMAKE_SYSTEM_NAME})
|
||||
execute_process(
|
||||
COMMAND git status
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_OUTPUT
|
||||
RESULT_VARIABLE GIT_ERROR_CODE
|
||||
COMMAND scripts/version.sh
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE PACKAGE_VERSION
|
||||
RESULT_VARIABLE GIT_ERROR_CODE
|
||||
)
|
||||
if (GIT_ERROR_CODE EQUAL 0)
|
||||
execute_process(
|
||||
COMMAND git rev-list --count HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_REV
|
||||
)
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_ID
|
||||
)
|
||||
string(REGEX REPLACE "\n$" "" GIT_REV "${GIT_REV}")
|
||||
string(REGEX REPLACE "\n$" "" GIT_ID "${GIT_ID}")
|
||||
set(N2N_VERSION "${N2N_VERSION}.r${GIT_REV}.${GIT_ID}")
|
||||
MESSAGE(STATUS "Build from git rev: ${N2N_VERSION}")
|
||||
endif (GIT_ERROR_CODE EQUAL 0)
|
||||
if (NOT GIT_ERROR_CODE EQUAL 0)
|
||||
# - if we can run version.sh and it exits with an error that is signaling
|
||||
# a build failure.
|
||||
# - if we are on windows with no MSYS or Cygwin, we cannot run version.sh
|
||||
# which is the fallback case handled below
|
||||
# TODO: Distinguish between these two cases
|
||||
|
||||
# Fallback to just using the non dynamic short version string
|
||||
file(STRINGS VERSION PACKAGE_VERSION)
|
||||
endif (NOT GIT_ERROR_CODE EQUAL 0)
|
||||
|
||||
string(STRIP "${PACKAGE_VERSION}" PACKAGE_VERSION)
|
||||
MESSAGE(STATUS "Build for version: ${PACKAGE_VERSION}")
|
||||
|
||||
add_definitions(-DCMAKE_BUILD)
|
||||
add_definitions(-DGIT_RELEASE="${N2N_VERSION}" -DPACKAGE_VERSION="${N2N_VERSION}" -DPACKAGE_OSNAME="${N2N_OSNAME}")
|
||||
add_definitions(-DN2N_VERSION="${N2N_VERSION}" -DN2N_OSNAME="${N2N_OSNAME}")
|
||||
add_definitions(-DPACKAGE_OSNAME="${CMAKE_SYSTEM_NAME}")
|
||||
add_definitions(-DPACKAGE_VERSION="${PACKAGE_VERSION}")
|
||||
|
||||
|
||||
# Build information
|
||||
|
|
21
Makefile.in
21
Makefile.in
|
@ -1,8 +1,6 @@
|
|||
|
||||
# NOTE: these are needed by the configure.in inside the packages folder
|
||||
N2N_VERSION_SHORT=@N2N_VERSION_SHORT@
|
||||
GIT_COMMITS=@GIT_COMMITS@
|
||||
GIT_DESCRIBE=$(shell git describe --always --dirty)
|
||||
N2N_VERSION=@N2N_VERSION@
|
||||
|
||||
########
|
||||
|
||||
|
@ -150,7 +148,14 @@ COVERAGEDIR?=coverage
|
|||
.PHONY: steps build push all clean distclean install test cover gcov build-dep
|
||||
.PHONY: lint lint.python lint.ccode lint.shell lint.yaml
|
||||
|
||||
all: $(APPS) $(DOCS) $(SUBDIRS)
|
||||
all: version $(APPS) $(DOCS) $(SUBDIRS)
|
||||
|
||||
# This allows breaking the build if the version.sh script discovers
|
||||
# any inconsistancies
|
||||
.PHONY: version
|
||||
version:
|
||||
@echo -n "Build for version: "
|
||||
@scripts/version.sh
|
||||
|
||||
tools: $(N2N_LIB)
|
||||
$(MAKE) -C $@
|
||||
|
@ -233,8 +238,11 @@ clean:
|
|||
distclean:
|
||||
rm -f tests/*.out src/*.gcno src/*.gcda src/*.indent src/*.unc-backup*
|
||||
rm -rf autom4te.cache/
|
||||
rm -f config.log config.status configure configure.ac Makefile tools/Makefile include/config.h include/config.h.in
|
||||
rm -f config.log config.status configure Makefile tools/Makefile include/config.h include/config.h.in
|
||||
rm -f doc/edge.8.gz doc/n2n.7.gz doc/supernode.1.gz
|
||||
rm -f packages/debian/config.log packages/debian/config.status
|
||||
rm -rf packages/debian/autom4te.cache/
|
||||
rm -f packages/rpm/config.log packages/rpm/config.status
|
||||
rm -f $(addprefix src/,$(APPS))
|
||||
|
||||
install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
||||
|
@ -250,11 +258,12 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
|
|||
# Docker builder section
|
||||
DOCKER_IMAGE_NAME=ntop/supernode
|
||||
DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT
|
||||
N2N_COMMIT_HASH=@GIT_REVISION@
|
||||
N2N_COMMIT_HASH=$(shell scripts/version.sh hash)
|
||||
|
||||
default: steps
|
||||
|
||||
steps:
|
||||
$(info This code appears to have been bitrotted since 2019 - please let us know if you are using it)
|
||||
if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi
|
||||
if [ "$(TARGET_ARCHITECTURE)" = "x86_64" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.x86_64" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-x86_64 make build; fi
|
||||
|
||||
|
|
13
autogen.sh
13
autogen.sh
|
@ -1,17 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# NOTE: update version in CMakeLists.txt after changing these
|
||||
N2N_MAJOR="3"
|
||||
N2N_MINOR="1"
|
||||
N2N_PATCH="0"
|
||||
|
||||
N2N_VERSION_SHORT="$N2N_MAJOR.$N2N_MINOR.$N2N_PATCH"
|
||||
|
||||
cat configure.seed | sed \
|
||||
-e "s/@N2N_VERSION_SHORT@/$N2N_VERSION_SHORT/g" \
|
||||
> configure.ac
|
||||
|
||||
rm -f config.h config.h.in *~ Makefile configure #*
|
||||
rm -f include/config.h include/config.h.in include/config.h.in~ Makefile configure
|
||||
|
||||
echo "Wait please..."
|
||||
autoreconf -if
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
odnl> Do not add anything above
|
||||
AC_INIT([edge],@N2N_VERSION_SHORT@)
|
||||
AC_INIT([edge], m4_esyscmd([scripts/version.sh | tr -d '\n']))
|
||||
dnl> Do not add anything above
|
||||
|
||||
N2N_VERSION_SHORT=${PACKAGE_VERSION}
|
||||
|
||||
if test -d ".git"; then
|
||||
# NOTE: keep in sync with the definitions for configure.in files under the packages folder
|
||||
GIT_COMMITS=`git rev-list --count HEAD`
|
||||
GIT_REVISION=`git rev-parse --short HEAD`
|
||||
GIT_RELEASE="${N2N_VERSION_SHORT}.r${GIT_COMMITS}.${GIT_REVISION}"
|
||||
else
|
||||
GIT_RELEASE=${N2N_VERSION_SHORT}
|
||||
fi
|
||||
N2N_VERSION=${PACKAGE_VERSION}
|
||||
|
||||
if test "${CC+set}" != set; then
|
||||
CC=gcc
|
||||
|
@ -108,7 +99,6 @@ dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=bl
|
|||
OSNAME=`./config.guess`
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name])
|
||||
AC_DEFINE_UNQUOTED(GIT_RELEASE, "${GIT_RELEASE}", [GIT release])
|
||||
|
||||
if test $MACHINE = "x86_64"; then
|
||||
EXTN="amd64"
|
||||
|
@ -124,10 +114,7 @@ AC_SUBST(CC)
|
|||
AC_SUBST(AR)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(N2N_VERSION_SHORT)
|
||||
AC_SUBST(GIT_COMMITS)
|
||||
AC_SUBST(GIT_REVISION)
|
||||
AC_SUBST(GIT_RELEASE)
|
||||
AC_SUBST(N2N_VERSION)
|
||||
AC_SUBST(N2N_DEFINES)
|
||||
AC_SUBST(N2N_LIBS)
|
||||
AC_SUBST(ADDITIONAL_TOOLS)
|
|
@ -21,22 +21,46 @@ In order to build on Windows the following tools should be installed:
|
|||
- Visual Studio. For a minimal install, the command line only build tools can be
|
||||
downloaded and installed from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017.
|
||||
|
||||
- CMake
|
||||
- CMake (From https://cmake.org/download/)
|
||||
|
||||
- (optional) The OpenSSL library. Prebuild binaries can be downloaded from https://slproweb.com/products/Win32OpenSSL.html.
|
||||
The full version is required, i.e. not the "Light" version. The Win32 version of it is usually required for a standard build.
|
||||
NOTE: You should always use the official cmake stable release as otherwise
|
||||
you may have issues finding libraries (e.g: the installed OpenSSL library).
|
||||
If you still have problems, you can try invoking it with `C:\Program Files\CMake\bin\cmake`.
|
||||
|
||||
> NOTE: In order to skip OpenSSL compilation, edit `CMakeLists.txt` and replace **– is this still valid?**
|
||||
>
|
||||
> ```plaintext
|
||||
> OPTION(N2N_OPTION_AES "USE AES" ON)
|
||||
> with
|
||||
> OPTION(N2N_OPTION_AES "USE AES" OFF)
|
||||
> ```
|
||||
- (optional) The OpenSSL library. Pre-built binaries can be downloaded from
|
||||
https://slproweb.com/products/Win32OpenSSL.html.
|
||||
The full version is required, i.e. not the "Light" version. The Win32
|
||||
version of it is usually required for a standard build.
|
||||
|
||||
NOTE: To statically link OpenSSL, add the `-DOPENSSL_USE_STATIC_LIBS=true` option to the `cmake` command below.
|
||||
NOTE: In order to enable OpenSSL compilation, add the option
|
||||
`-DN2N_OPTION_USE_OPENSSL=ON` to the `cmake ..` command below.
|
||||
|
||||
- If compilation throws a "config.h: No such file or directory" error, an `include/config.h` file needs to be obtained from an already configured Linux compilation and put into the `include/` directory as discussed [here](https://github.com/ntop/n2n/issues/366).
|
||||
NOTE: To statically link OpenSSL, add the option
|
||||
`-DOPENSSL_USE_STATIC_LIBS=true` to the `cmake ..` command below.
|
||||
|
||||
NOTE: Sticking to this tool chain has historically meant that resulting
|
||||
executables are more likely to be able to communicate with Linux or other
|
||||
OS builds, however efforts are being made to address this concern.
|
||||
|
||||
## Build (CLI)
|
||||
|
||||
In order to build from the command line, open a terminal window change to
|
||||
the directory where the git checkout of this repository is and run the
|
||||
following commands:
|
||||
|
||||
```batch
|
||||
cmake -E make_directory build
|
||||
cd build
|
||||
|
||||
rem Append any options to the next line
|
||||
cmake ..
|
||||
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
The compiled `.exe` files should now be available in the `build\Release` directory.
|
||||
|
||||
## Run
|
||||
|
||||
In order to run n2n, you will need the following:
|
||||
|
||||
|
@ -46,55 +70,12 @@ In order to run n2n, you will need the following:
|
|||
- If OpenSSL has been linked dynamically, the corresponding `.dll` file should be available
|
||||
onto the target computer.
|
||||
|
||||
NOTE: Sticking to this tool chain has historically meant that resulting
|
||||
executables are more likely to be able to communicate with Linux or other
|
||||
OS builds, however efforts are being made to address this concern.
|
||||
|
||||
## Build (CLI)
|
||||
|
||||
In order to build from the command line, open a terminal window and run the following commands:
|
||||
|
||||
```batch
|
||||
md build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
MSBuild.exe edge.vcxproj /t:Build /p:Configuration=Release
|
||||
MSBuild.exe supernode.vcxproj /t:Build /p:Configuration=Release
|
||||
MSBuild.exe n2n-benchmark.vcxproj /t:Build /p:Configuration=Release
|
||||
```
|
||||
|
||||
NOTE: If CMake has problems finding the installed OpenSSL library, try to download the official cmake and invoke it with
|
||||
`C:\Program Files\CMake\bin\cmake`.
|
||||
|
||||
NOTE: Visual Studio might not add `MSBuild.exe`'s path to the environment variable %PATH% so you might have difficulties finding and executing it without giving the full path. Regular installations seem to have it reside at `"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"`
|
||||
|
||||
The compiled `.exe` files should now be available in the `build\Release` directory.
|
||||
|
||||
## Run
|
||||
|
||||
The `edge.exe` program reads the `edge.conf` file located into the current directory if no option is provided.
|
||||
|
||||
Here is an example `edge.conf` file:
|
||||
|
||||
```plaintext
|
||||
-c=mycommunity
|
||||
-k=mysecretpass
|
||||
|
||||
# supernode IP address
|
||||
-l=1.2.3.4:5678
|
||||
|
||||
# edge IP address
|
||||
-a=192.168.100.1
|
||||
```
|
||||
|
||||
The `supernode.exe` program reads the `supernode.conf` file located into the current directory if no option is provided.
|
||||
|
||||
Here is an example `supernode.conf` file:
|
||||
|
||||
```plaintext
|
||||
-p=5678
|
||||
```
|
||||
Example [edge.conf](../packages/etc/n2n/edge.conf.sample)
|
||||
and [supernode.conf](../packages/etc/n2n/supernode.conf.sample) are available.
|
||||
|
||||
See `edge.exe --help` and `supernode.exe --help` for a full list of supported options.
|
||||
|
||||
|
|
|
@ -5,25 +5,13 @@ Some of these scripts are only useful during build and development, but
|
|||
other scripts are intended for end users to be able to use. These scripts
|
||||
may be installed with n2n as part of your operating system package.
|
||||
|
||||
All scripts can be found in the `scripts` directory.
|
||||
|
||||
Short descriptions of these scripts are below.
|
||||
|
||||
## `scripts/hack_fakeautoconf.sh`
|
||||
## End user scripts
|
||||
|
||||
This shell script is used during development to help build on Windows
|
||||
systems. An example of how to use it is shown in
|
||||
the [Building document](Building.md)
|
||||
|
||||
## `scripts/indent.sh`
|
||||
|
||||
This shell script is a wrapper for the `uncrustify` C code style checker
|
||||
which checks or applies a set of rules to the code. It is used during
|
||||
the automated lint checks.
|
||||
|
||||
## `scripts/test_harness.sh`
|
||||
|
||||
This shell script is used to run automated tests during development.
|
||||
|
||||
## `scripts/n2n-ctl`
|
||||
### `n2n-ctl`
|
||||
|
||||
This python script provides an easy command line interface to the running
|
||||
n2n processes. It uses UDP communications to talk to the Management API.
|
||||
|
@ -34,7 +22,7 @@ Example:
|
|||
- `scripts/n2n-ctl --help`
|
||||
- `scripts/n2n-ctl help`
|
||||
|
||||
## `scripts/n2n-httpd`
|
||||
### `n2n-httpd`
|
||||
|
||||
This python script is a simple http gateway to the running edge. It provides
|
||||
a proxy for REST-like HTTP requests to talk to the Management API.
|
||||
|
@ -49,7 +37,33 @@ Example:
|
|||
- `scripts/n2n-httpd --help`
|
||||
- `scripts/n2n-httpd 8087`
|
||||
|
||||
## `scripts/n2n-gateway.sh`
|
||||
## Build and Development scripts
|
||||
|
||||
### `hack_fakeautoconf.sh`
|
||||
|
||||
This shell script is used during development to help build on Windows
|
||||
systems. An example of how to use it is shown in
|
||||
the [Building document](Building.md)
|
||||
|
||||
### `indent.sh`
|
||||
|
||||
This shell script is a wrapper for the `uncrustify` C code style checker
|
||||
which checks or applies a set of rules to the code. It is used during
|
||||
the automated lint checks.
|
||||
|
||||
### `test_harness.sh`
|
||||
|
||||
This shell script is used to run automated tests during development.
|
||||
|
||||
### `n2n-gateway.sh`
|
||||
|
||||
A sample script to route all the host traffic towards a remote gateway,
|
||||
which is reachable via the n2n virtual interface.
|
||||
|
||||
### `version.sh`
|
||||
|
||||
This script is used to determine the current version number during the
|
||||
build process.
|
||||
|
||||
It looks at both the VERSION file and the GIT tags and outputs the
|
||||
version number to use.
|
||||
|
|
7
packages/debian/configure
vendored
7
packages/debian/configure
vendored
|
@ -586,8 +586,7 @@ LIBOBJS
|
|||
EXTRA_DEP
|
||||
DATE
|
||||
EXTN
|
||||
GIT_COMMITS
|
||||
N2N_VERSION_SHORT
|
||||
N2N_VERSION
|
||||
APP
|
||||
target_alias
|
||||
host_alias
|
||||
|
@ -1694,8 +1693,7 @@ fi
|
|||
|
||||
|
||||
# NOTE: this file is not actually used. You need to edit configure as well!
|
||||
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
N2N_VERSION=$(../../scripts/version.sh)
|
||||
|
||||
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
|
||||
|
||||
|
@ -1740,7 +1738,6 @@ DATE=`date -R`
|
|||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files debian/changelog"
|
||||
|
||||
ac_config_files="$ac_config_files debian/files"
|
||||
|
|
|
@ -3,8 +3,7 @@ AC_INIT([Makefile.in], 1.0)
|
|||
AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X])
|
||||
|
||||
# NOTE: this file is not actually used. You need to edit configure as well!
|
||||
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
N2N_VERSION=$(../../scripts/version.sh)
|
||||
|
||||
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
|
||||
|
||||
|
@ -44,8 +43,7 @@ APP=n2n
|
|||
DATE=`date -R`
|
||||
|
||||
AC_SUBST(APP)
|
||||
AC_SUBST(N2N_VERSION_SHORT)
|
||||
AC_SUBST(GIT_COMMITS)
|
||||
AC_SUBST(N2N_VERSION)
|
||||
AC_SUBST(EXTN)
|
||||
AC_SUBST(DATE)
|
||||
AC_SUBST(EXTRA_DEP)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@APP@ (@N2N_VERSION_SHORT@-@GIT_COMMITS@) table; urgency=high
|
||||
@APP@ (@N2N_VERSION@) table; urgency=high
|
||||
* Last packaged version
|
||||
|
||||
-- Luca Deri <deri@ntop.org> @DATE@
|
||||
|
|
|
@ -2,7 +2,7 @@ Source: n2n
|
|||
Section: net
|
||||
Priority: extra
|
||||
Maintainer: Luca Deri <deri@ntop.org>
|
||||
Standards-Version: @N2N_VERSION_SHORT@
|
||||
Standards-Version: 4.6.0
|
||||
Build-Depends:
|
||||
|
||||
Package: n2n
|
||||
|
|
|
@ -1 +1 @@
|
|||
n2n_@N2N_VERSION_SHORT@_@EXTN@.deb free optional
|
||||
n2n_@N2N_VERSION@_@EXTN@.deb free optional
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- a/configure.seed
|
||||
+++ b/configure.seed
|
||||
@@ -13,8 +13,6 @@
|
||||
GIT_RELEASE=${N2N_VERSION_SHORT}
|
||||
fi
|
||||
|
||||
-CC=gcc
|
||||
-AR=ar
|
||||
N2N_LIBS=
|
||||
|
||||
AC_PROG_CC
|
|
@ -4,7 +4,7 @@
|
|||
N2N_HOME=$(PWD)/../..
|
||||
N2N_BUILD=${N2N_HOME}/packages/debian/n2n
|
||||
PLATFORM=@MACHINE@
|
||||
RPM_PKG=n2n-@N2N_VERSION_SHORT@-@GIT_COMMITS@.$(PLATFORM).rpm
|
||||
RPM_PKG=n2n-@N2N_VERSION_RPM@-1.$(PLATFORM).rpm
|
||||
|
||||
all: clean pkg
|
||||
|
||||
|
|
21
packages/rpm/configure
vendored
21
packages/rpm/configure
vendored
|
@ -586,8 +586,7 @@ LIBOBJS
|
|||
RPM_SIGN_CMD
|
||||
DATE
|
||||
EXTN
|
||||
GIT_COMMITS
|
||||
N2N_VERSION_SHORT
|
||||
N2N_VERSION_RPM
|
||||
MACHINE
|
||||
APP
|
||||
target_alias
|
||||
|
@ -609,6 +608,7 @@ infodir
|
|||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
|
@ -673,6 +673,7 @@ datadir='${datarootdir}'
|
|||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
|
@ -925,6 +926,15 @@ do
|
|||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
|
@ -1062,7 +1072,7 @@ fi
|
|||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
|
@ -1215,6 +1225,7 @@ Fine tuning of the installation directories:
|
|||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
|
@ -1670,8 +1681,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
|
||||
|
||||
# NOTE: this file is not actually used. You need to edit configure as well!
|
||||
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
N2N_VERSION_RPM=$(../../scripts/version.sh |tr - _)
|
||||
|
||||
MACHINE=`uname -m`
|
||||
SHORT_MACHINE=`uname -m | cut -b1-3`
|
||||
|
@ -1717,7 +1727,6 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files n2n.spec"
|
||||
|
||||
ac_config_files="$ac_config_files ../etc/systemd/system/edge.service"
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
AC_INIT([Makefile.in], 1.0)
|
||||
|
||||
# NOTE: this file is not actually used. You need to edit configure as well!
|
||||
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
|
||||
N2N_VERSION_RPM=$(../../scripts/version.sh |tr - _)
|
||||
|
||||
MACHINE=`uname -m`
|
||||
SHORT_MACHINE=`uname -m | cut -b1-3`
|
||||
|
@ -43,8 +42,7 @@ fi
|
|||
|
||||
AC_SUBST(APP)
|
||||
AC_SUBST(MACHINE)
|
||||
AC_SUBST(N2N_VERSION_SHORT)
|
||||
AC_SUBST(GIT_COMMITS)
|
||||
AC_SUBST(N2N_VERSION_RPM)
|
||||
AC_SUBST(EXTN)
|
||||
AC_SUBST(DATE)
|
||||
AC_SUBST(RPM_SIGN_CMD)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Summary: n2n peer-to-peer VPN
|
||||
Name: n2n
|
||||
Version: @N2N_VERSION_SHORT@
|
||||
Release: @GIT_COMMITS@
|
||||
Version: @N2N_VERSION_RPM@
|
||||
Release: 1
|
||||
License: GPL
|
||||
Group: Networking/Utilities
|
||||
URL: http://www.ntop.org/
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# like boiling the ocean.
|
||||
|
||||
sed \
|
||||
-e "s%@N2N_VERSION_SHORT@%FIXME%g" \
|
||||
-e "s%@GIT_COMMITS@%FIXME%g" \
|
||||
-e "s%@CC@%gcc%g" \
|
||||
-e "s%@AR@%ar%g" \
|
||||
-e "s%@CFLAGS@%$CFLAGS%g" \
|
||||
|
@ -20,5 +18,4 @@ sed \
|
|||
cat <<EOF >include/config.h
|
||||
#define PACKAGE_VERSION "FIXME"
|
||||
#define PACKAGE_OSNAME "FIXME"
|
||||
#define GIT_RELEASE "FIXME"
|
||||
EOF
|
||||
|
|
46
scripts/version.sh
Executable file
46
scripts/version.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Output the current version number
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [short|hash]"
|
||||
echo
|
||||
echo "Determine the correct version number for the current build"
|
||||
exit 0
|
||||
}
|
||||
|
||||
VER_FILE_DIR=$(dirname "$0")/..
|
||||
VER_FILE_SHORT=$(cat "${VER_FILE_DIR}/VERSION")
|
||||
|
||||
if git status >/dev/null; then
|
||||
VER_GIT_SHORT=$(git describe --abbrev=0)
|
||||
|
||||
if [ "$VER_FILE_SHORT" != "$VER_GIT_SHORT" ]; then
|
||||
echo "Error: VERSION file does not match tag version ($VER_FILE_SHORT != $VER_GIT_SHORT)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VER_SHORT="$VER_GIT_SHORT"
|
||||
VER_HASH=$(git rev-parse --short HEAD)
|
||||
VER=$(git describe --abbrev=7 --dirty)
|
||||
else
|
||||
VER_SHORT="$VER_FILE_SHORT"
|
||||
VER_HASH="HEAD"
|
||||
VER="$VER_FILE_SHORT"
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
hash)
|
||||
echo "$VER_HASH"
|
||||
;;
|
||||
short)
|
||||
echo "$VER_SHORT"
|
||||
;;
|
||||
"")
|
||||
echo "$VER"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -590,7 +590,7 @@ void print_n2n_version () {
|
|||
printf("Welcome to n2n v.%s for %s\n"
|
||||
"Built on %s\n"
|
||||
"Copyright 2007-2021 - ntop.org and contributors\n\n",
|
||||
GIT_RELEASE, PACKAGE_OSNAME, PACKAGE_BUILDDATE);
|
||||
PACKAGE_VERSION, PACKAGE_OSNAME, PACKAGE_BUILDDATE);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
|
|
@ -741,7 +741,7 @@ int sn_init_defaults (n2n_sn_t *sss) {
|
|||
|
||||
memset(sss, 0, sizeof(n2n_sn_t));
|
||||
|
||||
strncpy(sss->version, GIT_RELEASE, sizeof(n2n_version_t));
|
||||
strncpy(sss->version, PACKAGE_VERSION, sizeof(n2n_version_t));
|
||||
sss->version[sizeof(n2n_version_t) - 1] = '\0';
|
||||
sss->daemon = 1; /* By defult run as a daemon. */
|
||||
sss->lport = N2N_SN_LPORT_DEFAULT;
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
|
||||
/* OS name */
|
||||
#ifndef PACKAGE_OSNAME
|
||||
#define PACKAGE_OSNAME N2N_OSNAME
|
||||
#define PACKAGE_OSNAME "windows"
|
||||
#endif
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#ifndef PACKAGE_VERSION
|
||||
#define PACKAGE_VERSION N2N_VERSION
|
||||
#endif
|
||||
#ifndef GIT_RELEASE
|
||||
#define GIT_RELEASE N2N_VERSION
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user