Skip to content

Commit 9f90995

Browse files
kouraulcd
andcommitted
GH-38332: [CI][Release] Resolve symlinks in RAT lint (#38337)
### Rationale for this change Our release script (`dev/release/02-source.sh`) resolves symlinks in source archive but our lint script (`dev/archery/archery/utils/source.py`) doesn't resolve symlinks. So we may detect RAT problem by our CI. ### What changes are included in this PR? Resolve symlinks in our lint script too. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #38332 Lead-authored-by: Sutou Kouhei <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]> Co-authored-by: Raúl Cumplido <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent bd61239 commit 9f90995

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

cpp/cmake_modules/snappy.diff

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# https://github.com/google/snappy/pull/172
19+
120
diff --git a/snappy.cc b/snappy.cc
221
index d414718..5b0d0d6 100644
322
--- a/snappy.cc

dev/archery/archery/utils/source.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
import os
1919
from pathlib import Path
2020
import subprocess
21+
import tempfile
2122

23+
from .command import Command
2224
from .git import git
2325

2426

@@ -117,10 +119,20 @@ def archive(self, path, dereference=False, compressor=None, revision=None):
117119
raise ValueError("{} is not backed by git".format(self))
118120

119121
rev = revision if revision else "HEAD"
120-
archive = git.archive("--prefix=apache-arrow/", rev,
122+
archive = git.archive("--prefix=apache-arrow.tmp/", rev,
121123
git_dir=self.path)
122-
123-
# TODO(fsaintjacques): fix dereference for
124+
with tempfile.TemporaryDirectory() as tmp:
125+
tmp = Path(tmp)
126+
tar_path = tmp / "apache-arrow.tar"
127+
with open(tar_path, "wb") as tar:
128+
tar.write(archive)
129+
Command("tar").run("xf", tar_path, "-C", tmp)
130+
# Must use the same logic in dev/release/02-source.sh
131+
Command("cp").run("-R", "-L", tmp /
132+
"apache-arrow.tmp", tmp / "apache-arrow")
133+
Command("tar").run("cf", tar_path, "-C", tmp, "apache-arrow")
134+
with open(tar_path, "rb") as tar:
135+
archive = tar.read()
124136

125137
if compressor:
126138
archive = compressor(archive)

dev/release/02-source.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ rm -rf ${tag}
6565
git archive ${release_hash} --prefix ${tag}/) | \
6666
tar xf -
6767

68-
# Resolve all hard and symbolic links
68+
# Resolve all hard and symbolic links.
69+
# If we change this, we must change ArrowSources.archive in
70+
# dev/archery/archery/utils/source.py too.
6971
rm -rf ${tag}.tmp
7072
mv ${tag} ${tag}.tmp
7173
cp -R -L ${tag}.tmp ${tag}

dev/release/rat_exclude_files.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ cpp/build-support/cpplint.py
2222
cpp/build-support/lint_exclusions.txt
2323
cpp/build-support/iwyu/*
2424
cpp/cmake_modules/FindPythonLibsNew.cmake
25-
cpp/cmake_modules/SnappyCMakeLists.txt
26-
cpp/cmake_modules/SnappyConfig.h
27-
cpp/cmake_modules/snappy.diff
2825
cpp/examples/parquet/parquet-arrow/cmake_modules/FindArrow.cmake
2926
cpp/src/parquet/.parquetcppversion
3027
cpp/src/generated/parquet_constants.cpp
@@ -89,8 +86,6 @@ js/yarn.lock
8986
js/.eslintignore
9087
python/cmake_modules
9188
python/cmake_modules/FindPythonLibsNew.cmake
92-
python/cmake_modules/SnappyCMakeLists.txt
93-
python/cmake_modules/SnappyConfig.h
9489
python/MANIFEST.in
9590
python/manylinux1/.dockerignore
9691
python/pyarrow/includes/__init__.pxd

0 commit comments

Comments
 (0)