Skip to content

Commit c036303

Browse files
authored
build: package sources in a folder (#1332)
Signed-off-by: tison <wander4096@gmail.com>
1 parent 290beba commit c036303

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

x.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
from subprocess import Popen, PIPE
2626
import sys
2727
from typing import List, Any, Optional, TextIO, Tuple
28-
from shutil import copyfile
29-
from warnings import warn
3028

3129
CMAKE_REQUIRE_VERSION = (3, 16, 0)
3230
CLANG_FORMAT_REQUIRED_VERSION = (12, 0, 0)
@@ -225,21 +223,21 @@ def package_source(release_version: str) -> None:
225223
run(git, 'commit', '-a', '-m', f'[source-release] prepare release apache-kvrocks-{version}')
226224
run(git, 'tag', '-a', f'v{version}', '-m', f'[source-release] copy for tag v{version}')
227225

228-
tarball = f'apache-kvrocks-{version}-incubating-src.tar.gz'
226+
229227
# 2. Create the source tarball
230-
output = run_pipe(git, 'ls-files')
231-
run('xargs', 'tar', '-czf', tarball, stdin=output)
228+
folder = f'apache-kvrocks-{version}-incubating-src'
229+
tarball = f'apache-kvrocks-{version}-incubating-src.tar.gz'
230+
run(git, 'archive', '--format=tar.gz', f'--output={tarball}', f'--prefix={folder}/', 'HEAD')
232231

233232
# 3. GPG Sign
234233
gpg = find_command('gpg', msg='gpg is required for source packaging')
235234
run(gpg, '--detach-sign', '--armor', tarball)
236235

237236
# 4. Generate sha512 checksum
238237
sha512sum = find_command('sha512sum', msg='sha512sum is required for source packaging')
239-
output = run_pipe(sha512sum, tarball)
240-
payload = output.read().strip()
241238
with open(f'{tarball}.sha512', 'w+') as f:
242-
f.write(payload)
239+
run(sha512sum, tarball, stdout=f)
240+
243241

244242
def test_cpp(dir: str, rest: List[str]) -> None:
245243
basedir = Path(dir).absolute()

0 commit comments

Comments
 (0)