From 757ebb5d9fdc24757f199e52575f32f6faf091b3 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 25 Mar 2020 14:09:47 +0100 Subject: [fix] brands: add variables from build env to grunt process We have some variables in the build environment which are also needed in the grunt process when building themes. Theses variables are relavant if one creates a fork with its own branding. We treat these variables under the term 'brands'. Signed-off-by: Markus Heiser --- manage.sh | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 496a522ba..0551f02d3 100755 --- a/manage.sh +++ b/manage.sh @@ -156,15 +156,6 @@ styles() { build_style less/bootstrap/bootstrap.less css/bootstrap.min.css } -grunt_build() { - npm_path_setup - - echo '[!] Grunt build : oscar theme' - grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js" - echo '[!] Grunt build : simple theme' - grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js" -} - docker_build() { # Check if it is a git repository if [ ! -d .git ]; then @@ -257,7 +248,6 @@ Commands ----- locales - Compile locales styles - Build less files - grunt_build - Build files for themes docker_build - Build Docker image Tests -- cgit v1.2.3 From 3dbade0aed048e6001f2ed0f261c7d26f04768ba Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 25 Mar 2020 14:50:39 +0100 Subject: [fix] brands: add GIT_URL variable to the docker build Signed-off-by: Markus Heiser --- manage.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 0551f02d3..bb3fe8831 100755 --- a/manage.sh +++ b/manage.sh @@ -202,13 +202,13 @@ docker_build() { fi # define the docker image name - # /!\ HACK to get the user name /!\ - GITHUB_USER=$(git remote get-url origin | sed 's/.*github\.com\/\([^\/]*\).*/\1/') + GITHUB_USER=$(echo "${GIT_URL}" | sed 's/.*github\.com\/\([^\/]*\).*/\1/') SEARX_IMAGE_NAME="${GITHUB_USER:-searx}/searx" # build Docker image echo "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" sudo docker build \ + --build-arg GIT_URL="${GIT_URL}" \ --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \ --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \ --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ @@ -248,7 +248,6 @@ Commands ----- locales - Compile locales styles - Build less files - docker_build - Build Docker image Tests ----- -- cgit v1.2.3 From 2d12f221a7afbbbaedfb27c5705efd8b94ad6a81 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 25 Mar 2020 15:17:11 +0100 Subject: [fix] docker build: set build argument LABEL_VCS_URL to GIT_URL Signed-off-by: Markus Heiser --- manage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index bb3fe8831..4c11576a3 100755 --- a/manage.sh +++ b/manage.sh @@ -213,7 +213,7 @@ docker_build() { --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \ --build-arg LABEL_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ --build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \ - --build-arg LABEL_VCS_URL=$(git remote get-url origin) \ + --build-arg LABEL_VCS_URL="${GIT_URL}" \ --build-arg TIMESTAMP_SETTINGS=$(git log -1 --format="%cd" --date=unix -- searx/settings.yml) \ --build-arg TIMESTAMP_UWSGI=$(git log -1 --format="%cd" --date=unix -- dockerfiles/uwsgi.ini) \ -t ${SEARX_IMAGE_NAME}:latest -t ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION} . -- cgit v1.2.3 From 00251d7c66e60dc9859bf6368ab68d545660b90e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 26 Mar 2020 13:32:08 +0100 Subject: Makefile: add target 'useragents.update' to fetch versions of Firefox Update searx/data/useragents.json with the most recent versions of Firefox. BTW: add 'useragents.update' to 'project' target and clean up the Makefile and remove it from the manage.sh script. Signed-off-by: Markus Heiser closes: https://github.com/asciimoo/searx/issues/1882 --- manage.sh | 6 ------ 1 file changed, 6 deletions(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 4c11576a3..5c9b332aa 100755 --- a/manage.sh +++ b/manage.sh @@ -70,11 +70,6 @@ locales() { pybabel compile -d "$SEARX_DIR/translations" } -update_useragents() { - echo '[!] Updating user agent versions' - python utils/fetch_firefox_version.py -} - pep8_check() { echo '[!] Running pep8 check' # ignored rules: @@ -242,7 +237,6 @@ Commands update_dev_packages - Check & update development and production dependency changes install_geckodriver - Download & install geckodriver if not already installed (required for robot_tests) npm_packages - Download & install npm dependencies - update_useragents - Update useragents.json with the most recent versions of Firefox Build ----- -- cgit v1.2.3 From e7fbefa8bdecca04824b3ef744786d8bb45c35fe Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 26 Mar 2020 18:00:07 +0100 Subject: build: move build styles from manage.sh to Makefile To build all styles use: make styles To build individual styles use one of: make style.legacy make style.courgette make style.pixart make style.bootstrap Signed-off-by: Markus Heiser --- manage.sh | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 5c9b332aa..4f46fd6d7 100755 --- a/manage.sh +++ b/manage.sh @@ -130,27 +130,6 @@ npm_packages() { npm install } -build_style() { - npm_path_setup - - lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2" -} - -styles() { - npm_path_setup - - echo '[!] Building legacy style' - build_style themes/legacy/less/style.less themes/legacy/css/style.css - build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css - echo '[!] Building courgette style' - build_style themes/courgette/less/style.less themes/courgette/css/style.css - build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css - echo '[!] Building pix-art style' - build_style themes/pix-art/less/style.less themes/pix-art/css/style.css - echo '[!] Building bootstrap style' - build_style less/bootstrap/bootstrap.less css/bootstrap.min.css -} - docker_build() { # Check if it is a git repository if [ ! -d .git ]; then @@ -241,7 +220,6 @@ Commands Build ----- locales - Compile locales - styles - Build less files Tests ----- -- cgit v1.2.3 From 1075f58a722fad7801a7b8397cd7e6de31d99da2 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 26 Mar 2020 18:41:45 +0100 Subject: test: move tests from manage.sh to Makefile Signed-off-by: Markus Heiser --- manage.sh | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 4f46fd6d7..6667274b1 100755 --- a/manage.sh +++ b/manage.sh @@ -70,40 +70,6 @@ locales() { pybabel compile -d "$SEARX_DIR/translations" } -pep8_check() { - echo '[!] Running pep8 check' - # ignored rules: - # E402 module level import not at top of file - # W503 line break before binary operator - pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" "$SEARX_DIR" "$BASE_DIR/tests" -} - -unit_tests() { - echo '[!] Running unit tests' - python -m nose2 -s "$BASE_DIR/tests/unit" -} - -py_test_coverage() { - echo '[!] Running python test coverage' - PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \ - && coverage report \ - && coverage html -} - -robot_tests() { - echo '[!] Running robot tests' - PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot -} - -tests() { - set -e - pep8_check - unit_tests - install_geckodriver - robot_tests - set +e -} - # # Web @@ -220,14 +186,6 @@ Commands Build ----- locales - Compile locales - - Tests - ----- - unit_tests - Run unit tests - pep8_check - Pep8 validation - robot_tests - Run selenium tests - tests - Run all python tests (pep8, unit, robot_tests) - py_test_coverage - Unit test coverage " } -- cgit v1.2.3 From 442b27ac1b1f54669fbb9785d780327f62814431 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 29 Mar 2020 11:41:59 +0200 Subject: bash: use build environment from Makefile To Makefile target brand, add creation of bash environment in:: utils/brand.env In bash scripts (manage.sh) source env by:: . utils/brand.env manage.sh help: show GIT_URL and more environment Signed-off-by: Markus Heiser --- manage.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'manage.sh') diff --git a/manage.sh b/manage.sh index 6667274b1..4831fc1fa 100755 --- a/manage.sh +++ b/manage.sh @@ -10,6 +10,7 @@ PYTHONPATH="$BASE_DIR" SEARX_DIR="$BASE_DIR/searx" ACTION="$1" +. "${BASE_DIR}/utils/brand.env" # # Python @@ -186,6 +187,13 @@ Commands Build ----- locales - Compile locales + +Environment: + GIT_URL: ${GIT_URL} + ISSUE_URL: ${ISSUE_URL} + SEARX_URL: ${SEARX_URL} + DOCS_URL: ${DOCS_URL} + PUBLIC_INSTANCES: ${PUBLIC_INSTANCES} " } -- cgit v1.2.3