Skip to content

Commit 534ef71

Browse files
raulcdkou
andauthored
GH-48025: [C++][GLib] Replace instances where build path is being added to built artifacts (#48026)
### Rationale for this change There are several places where we are adding the build path on our built artifacts. We should avoid that in order to improve reproducibility of our builds. ### What changes are included in this PR? General build system hygiene improvement redacting absolute paths from the compiler flags to improve build reproducibility and caching efficiency. Update for mkenums from full `@ filename@` to `@ basename@` as seen on their official documentation: > The base name of the input file currently being processed (e.g. foo.h). Typically you want to use `@ basename@` in place of `@ filename@` in your templates, to improve the reproducibility of the build. (Since: 2.22) ### Are these changes tested? Validated locally that reprotest doesn't fail on `enums` anymore. CI and tests have run. ### Are there any user-facing changes? No * GitHub Issue: #48025 Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent ff089cc commit 534ef71

File tree

9 files changed

+12
-7
lines changed

9 files changed

+12
-7
lines changed

c_glib/arrow-dataset-glib/enums.c.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*** BEGIN file-production ***/
2525

26-
/* enumerations from "@filename@" */
26+
/* enumerations from "@basename@" */
2727
/*** END file-production ***/
2828

2929
/*** BEGIN value-header ***/

c_glib/arrow-dataset-glib/enums.h.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
2929

3030
/*** BEGIN file-production ***/
3131

32-
/* enumerations from "@filename@" */
32+
/* enumerations from "@basename@" */
3333
/*** END file-production ***/
3434

3535
/*** BEGIN value-header ***/

c_glib/arrow-glib/enums.c.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*** BEGIN file-production ***/
2525

26-
/* enumerations from "@filename@" */
26+
/* enumerations from "@basename@" */
2727
/*** END file-production ***/
2828

2929
/*** BEGIN value-header ***/

c_glib/arrow-glib/enums.h.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
2929

3030
/*** BEGIN file-production ***/
3131

32-
/* enumerations from "@filename@" */
32+
/* enumerations from "@basename@" */
3333
/*** END file-production ***/
3434

3535
/*** BEGIN value-header ***/

c_glib/gandiva-glib/enums.c.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*** BEGIN file-production ***/
2525

26-
/* enumerations from "@filename@" */
26+
/* enumerations from "@basename@" */
2727
/*** END file-production ***/
2828

2929
/*** BEGIN value-header ***/

c_glib/gandiva-glib/enums.h.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
2929

3030
/*** BEGIN file-production ***/
3131

32-
/* enumerations from "@filename@" */
32+
/* enumerations from "@basename@" */
3333
/*** END file-production ***/
3434

3535
/*** BEGIN value-header ***/

cpp/src/arrow/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ macro(append_runtime_avx512_src SRCS SRC)
342342
endmacro()
343343

344344
# Write out compile-time configuration constants
345+
string(REPLACE "${CMAKE_SOURCE_DIR}" "<CMAKE_SOURCE_DIR>" REDACTED_CXX_FLAGS
346+
${CMAKE_CXX_FLAGS})
347+
string(REPLACE "${CMAKE_BINARY_DIR}" "<CMAKE_BINARY_DIR>" REDACTED_CXX_FLAGS
348+
${REDACTED_CXX_FLAGS})
345349
configure_file("util/config.h.cmake" "util/config.h" ESCAPE_QUOTES)
346350
configure_file("util/config_internal.h.cmake" "util/config_internal.h" ESCAPE_QUOTES)
347351
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/util/config.h"

cpp/src/arrow/util/config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#define ARROW_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
2929
#define ARROW_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
30-
#define ARROW_CXX_COMPILER_FLAGS "@CMAKE_CXX_FLAGS@"
3130

3231
#define ARROW_BUILD_TYPE "@UPPERCASE_BUILD_TYPE@"
3332

cpp/src/arrow/util/config_internal.h.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
// These variables are not exposed as they can make compilation caching
1919
// and increment builds less efficient.
2020

21+
#define ARROW_CXX_COMPILER_FLAGS "@REDACTED_CXX_FLAGS@"
22+
2123
#define ARROW_GIT_ID "@ARROW_GIT_ID@"
2224
#define ARROW_GIT_DESCRIPTION "@ARROW_GIT_DESCRIPTION@"

0 commit comments

Comments
 (0)