Merge pull request #3829 from citusdata/migrations-disallow-c-comment

pull/3930/head
Hanefi Onaldi 2020-06-22 13:36:57 +03:00 committed by GitHub
commit ebd8de88d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 12 deletions

View File

@ -17,7 +17,7 @@ jobs:
paths: [.]
check-style:
docker:
- image: 'citusdata/stylechecker:latest'
- image: 'citus/stylechecker:latest'
steps:
- checkout
- run:
@ -41,6 +41,12 @@ jobs:
- run:
name: 'Check if changed'
command: git diff --exit-code
- run:
name: 'Check for C-style comments in migration files'
command: ci/disallow_c_comments_in_migrations.sh
- run:
name: 'Check if changed'
command: git diff --exit-code
- run:
name: 'Check for banned C API usage'
command: ci/banned.h.sh

View File

@ -0,0 +1,26 @@
#! /bin/bash
set -euo pipefail
# We do not use c-style comments in migration files as the stripped
# zero-length migration files cause warning during packaging
# See #3115 for more info
# In this file, we aim to keep the indentation intact by capturing whitespaces,
# and reusing them if needed. GNU sed unfortunately does not support lookaround assertions.
# /* -> --
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#/\*#--#g'
# */ -> `` (empty string)
# remove all whitespaces immediately before the match
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#\s*\*/\s*##g'
# * -> --
# keep the indentation
# allow only whitespaces before the match
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\) \*#\1--#g'
# // -> --
# do not touch http:// or similar by allowing only whitespaces before //
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\)//#\1--#g'

View File

@ -10,5 +10,6 @@ cd ${cidir}/..
ci/editorconfig.sh
ci/remove_useless_declarations.sh
ci/disallow_c_comments_in_migrations.sh
citus_indent . --quiet

View File

@ -1,2 +1,2 @@
/* we've some issues with versioning, and we're fixing it by bumping version */
/* from 9.2-2 to 9.2-4 see #3673 for details */
-- we've some issues with versioning, and we're fixing it by bumping version
-- from 9.2-2 to 9.2-4 see #3673 for details

View File

@ -1,6 +1,6 @@
/* citus--9.2-4--9.3-2 */
-- citus--9.2-4--9.3-2
/* bump version to 9.3-2 */
-- bump version to 9.3-2
#include "udfs/citus_extradata_container/9.3-2.sql"
#include "udfs/update_distributed_table_colocation/9.3-2.sql"

View File

@ -1,10 +1,10 @@
/* citus--9.3-1--9.2-4 */
/* this is an unusual upgrade path, we are doing it because */
/* we have accidentally tagged master branch with v9.2-3 */
/* however master branch was already bumped to v9.3-1 */
/* with this file, we are undoing the catalog changes that */
/* have happened between 9.2-2 to 9.3-1, and making 9.2-4 */
/* as the release that we can */
-- citus--9.3-1--9.2-4
-- this is an unusual upgrade path, we are doing it because
-- we have accidentally tagged master branch with v9.2-3
-- however master branch was already bumped to v9.3-1
-- with this file, we are undoing the catalog changes that
-- have happened between 9.2-2 to 9.3-1, and making 9.2-4
-- as the release that we can
-- undo the changes for citus_extradata_container that happened on citus 9.3
DROP FUNCTION IF EXISTS pg_catalog.citus_extradata_container(INTERNAL);