From 57610c694e56a6b0d55bf42f1170bad93b7b3297 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 2 Apr 2021 16:39:44 +0200 Subject: [PATCH] CONTRIB: move src/wurfl.c and contrib/wurfl to addons/wurfl Both the source file and the dummy library are now at the same place. Maybe the build howto could be moved there as well to make things even cleaner. The Makefile, MAINTAINERS, doc, and vtest matrix were updated. --- .github/matrix.py | 8 ++++---- .github/workflows/coverity.yml | 4 ++-- .github/workflows/vtest.yml | 2 +- .travis.yml | 6 +++--- MAINTAINERS | 2 +- Makefile | 3 ++- {contrib/wurfl => addons/wurfl/dummy}/Makefile | 0 {contrib/wurfl => addons/wurfl/dummy}/dummy-wurfl.c | 0 {contrib/wurfl => addons/wurfl/dummy}/wurfl/wurfl.h | 0 {src => addons/wurfl}/wurfl.c | 0 doc/WURFL-device-detection.txt | 6 +++--- 11 files changed, 16 insertions(+), 15 deletions(-) rename {contrib/wurfl => addons/wurfl/dummy}/Makefile (100%) rename {contrib/wurfl => addons/wurfl/dummy}/dummy-wurfl.c (100%) rename {contrib/wurfl => addons/wurfl/dummy}/wurfl/wurfl.h (100%) rename {src => addons/wurfl}/wurfl.c (100%) diff --git a/.github/matrix.py b/.github/matrix.py index 4db876710b..22c33f0dfa 100644 --- a/.github/matrix.py +++ b/.github/matrix.py @@ -77,8 +77,8 @@ for CC in ["gcc", "clang"]: "USE_OPENSSL=1", "USE_SYSTEMD=1", "USE_WURFL=1", - "WURFL_INC=contrib/wurfl", - "WURFL_LIB=contrib/wurfl", + "WURFL_INC=addons/wurfl/dummy", + "WURFL_LIB=addons/wurfl/dummy", "USE_DEVICEATLAS=1", "DEVICEATLAS_SRC=addons/deviceatlas/dummy", "USE_PROMEX=1", @@ -143,8 +143,8 @@ matrix.append( "USE_OPENSSL=1", "USE_SYSTEMD=1", "USE_WURFL=1", - "WURFL_INC=contrib/wurfl", - "WURFL_LIB=contrib/wurfl", + "WURFL_INC=addons/wurfl/dummy", + "WURFL_LIB=addons/wurfl/dummy", "USE_DEVICEATLAS=1", "DEVICEATLAS_SRC=addons/deviceatlas/dummy", "USE_PROMEX=1", diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 12d08e6ce4..fd5a0e2d2e 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -17,7 +17,7 @@ jobs: COVERITY_SCAN_PROJECT_NAME: 'Haproxy' COVERITY_SCAN_BRANCH_PATTERN: '*' COVERITY_SCAN_NOTIFICATION_EMAIL: 'chipitsine@gmail.com' - COVERITY_SCAN_BUILD_COMMAND: "make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=contrib/wurfl WURFL_LIB=contrib/wurfl USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern" + COVERITY_SCAN_BUILD_COMMAND: "make CC=clang TARGET=linux-glibc USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/pattern" steps: - uses: actions/checkout@v2 - name: Install apt dependencies @@ -33,7 +33,7 @@ jobs: # quoting into account. sed -i 's/^DEBUG =$/DEBUG = -DDEBUG_STRICT=1 -DDEBUG_USE_ABORT=1/' Makefile - name: Build WURFL - run: make -C contrib/wurfl + run: make -C addons/wurfl/dummy - name: Run Coverity Scan env: COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml index 6d42db8fff..fc6eb5529a 100644 --- a/.github/workflows/vtest.yml +++ b/.github/workflows/vtest.yml @@ -78,7 +78,7 @@ jobs: run: env ${{ matrix.ssl }} scripts/build-ssl.sh - name: Build WURFL if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} - run: make -C contrib/wurfl + run: make -C addons/wurfl/dummy - name: Compile HAProxy with ${{ matrix.CC }} run: | make -j$(nproc) all \ diff --git a/.travis.yml b/.travis.yml index 645f7e644c..db114b7c4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ branches: env: global: - - FLAGS="USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=contrib/wurfl WURFL_LIB=contrib/wurfl USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1" + - FLAGS="USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_DEVICEATLAS=1 DEVICEATLAS_SRC=addons/deviceatlas/dummy USE_51DEGREES=1" - TMPDIR=/tmp - FIFTYONEDEGREES_SRC="addons/51degrees/dummy/pattern" - DEBUG_OPTIONS="DEBUG_STRICT=1" @@ -60,7 +60,7 @@ matrix: - os: linux if: type == cron compiler: clang - env: TARGET=linux-glibc FLAGS="USE_SLZ=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=contrib/wurfl WURFL_LIB=contrib/wurfl USE_51DEGREES=1" CC=clang-9 + env: TARGET=linux-glibc FLAGS="USE_SLZ=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_SYSTEMD=1 USE_WURFL=1 WURFL_INC=addons/wurfl/dummy WURFL_LIB=addons/wurfl/dummy USE_51DEGREES=1" CC=clang-9 before_script: - git clone https://github.com/wtarreau/libslz - cd libslz && make && make PREFIX=${HOME}/opt install && cd .. @@ -81,7 +81,7 @@ install: script: - if [ "${CC%-*}" = "clang" ]; then export FLAGS="$FLAGS USE_OBSOLETE_LINKER=1" DEBUG_CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ASAN_OPTIONS="log_path=asan.log"; fi - - make -C contrib/wurfl + - make -C addons/wurfl/dummy - make -j3 CC=$CC CPU_CFLAGS.generic="-O1" V=1 ERR=1 TARGET=$TARGET $FLAGS DEBUG_CFLAGS="$DEBUG_CFLAGS" LDFLAGS="$LDFLAGS" ADDLIB="$ADDLIB" SSL_LIB="$SSL_LIB" SSL_INC="$SSL_INC" SLZ_LIB="$SLZ_LIB" SLZ_INC="$SLZ_INC" 51DEGREES_SRC="$FIFTYONEDEGREES_SRC" EXTRA_OBJS="$EXTRA_OBJS" $DEBUG_OPTIONS - ./haproxy -vv - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ldd haproxy; fi diff --git a/MAINTAINERS b/MAINTAINERS index ff09b08816..878d7e3d16 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -127,7 +127,7 @@ Note: William is the referent regarding Prometheus. He should be consulted for ScientiaMobile WURFL Device Detection Maintainer: Paul Borile, Massimiliano Bellomi -Files: src/wurfl.c, contrib/wurfl, doc/WURFL-device-detection.txt +Files: addons/wurfl, doc/WURFL-device-detection.txt SPOE Maintainer: Christopher Faulet diff --git a/Makefile b/Makefile index b0cfe23c8f..46adef09a5 100644 --- a/Makefile +++ b/Makefile @@ -669,7 +669,7 @@ ifneq ($(USE_WURFL),) WURFL_SRC = WURFL_INC = $(WURFL_SRC) WURFL_LIB = $(WURFL_SRC) -OPTIONS_OBJS += src/wurfl.o +OPTIONS_OBJS += addons/wurfl/wurfl.o OPTIONS_CFLAGS += $(if $(WURFL_INC),-I$(WURFL_INC)) ifneq ($(WURFL_DEBUG),) OPTIONS_CFLAGS += -DWURFL_DEBUG @@ -1006,6 +1006,7 @@ clean: $(Q)rm -f addons/promex/*.[oas] $(Q)rm -f addons/51degrees/*.[oas] addons/51degrees/dummy/*.[oas] addons/51degrees/dummy/*/*.[oas] $(Q)rm -f addons/deviceatlas/*.[oas] addons/deviceatlas/dummy/*.[oas] + $(Q)rm -f addons/wurfl/*.[oas] addons/wurfl/dummy/*.[oas] $(Q)rm -f admin/iprange/iprange admin/iprange/ip6range admin/halog/halog $(Q)rm -f dev/flags/flags dev/poll/poll dev/tcploop/tcploop $(Q)rm -f dev/hpack/decode dev/hpack/gen-enc dev/hpack/gen-rht diff --git a/contrib/wurfl/Makefile b/addons/wurfl/dummy/Makefile similarity index 100% rename from contrib/wurfl/Makefile rename to addons/wurfl/dummy/Makefile diff --git a/contrib/wurfl/dummy-wurfl.c b/addons/wurfl/dummy/dummy-wurfl.c similarity index 100% rename from contrib/wurfl/dummy-wurfl.c rename to addons/wurfl/dummy/dummy-wurfl.c diff --git a/contrib/wurfl/wurfl/wurfl.h b/addons/wurfl/dummy/wurfl/wurfl.h similarity index 100% rename from contrib/wurfl/wurfl/wurfl.h rename to addons/wurfl/dummy/wurfl/wurfl.h diff --git a/src/wurfl.c b/addons/wurfl/wurfl.c similarity index 100% rename from src/wurfl.c rename to addons/wurfl/wurfl.c diff --git a/doc/WURFL-device-detection.txt b/doc/WURFL-device-detection.txt index 3c28d19e46..4786e2238f 100644 --- a/doc/WURFL-device-detection.txt +++ b/doc/WURFL-device-detection.txt @@ -19,13 +19,13 @@ Optionally WURFL_DEBUG=1 may be set to increase logs verbosity For HAProxy developers who need to verify that their changes didn't accidentally break the WURFL code, it is possible to build a dummy library provided in the -contrib/wurfl directory and to use it as an alternative for the full library. +addons/wurfl/dummy directory and to use it as an alternative for the full library. This will not provide the full functionalities, it will just allow haproxy to start with a wurfl configuration, which generally is enough to validate API changes : - $ make -C contrib/wurfl - $ make TARGET= USE_WURFL=1 WURFL_INC=$PWD/contrib/wurfl WURFL_LIB=$PWD/contrib/wurfl + $ make -C addons/wurfl/dummy + $ make TARGET= USE_WURFL=1 WURFL_INC=$PWD/addons/wurfl/dummy WURFL_LIB=$PWD/addons/wurfl/dummy These are the supported WURFL directives (see doc/configuration.txt) : - wurfl-data-file