xref: /aosp_15_r20/external/ltp/tools/create-tarballs-metadata.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh -eu
2*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later
3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2023 Petr Vorel <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker# Create tarballs and metadata for uploading after tagging release.
5*49cdfc7eSAndroid Build Coastguard Worker# https://github.com/linux-test-project/ltp/wiki/LTP-Release-Procedure
6*49cdfc7eSAndroid Build Coastguard Worker
7*49cdfc7eSAndroid Build Coastguard Workerbasedir="$(dirname "$0")"
8*49cdfc7eSAndroid Build Coastguard Worker. "$basedir/lib.sh"
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard Workertag="$(date +%Y%m%d)"
11*49cdfc7eSAndroid Build Coastguard Workertarball_dir="ltp-full-$tag"
12*49cdfc7eSAndroid Build Coastguard Workerextensions="bz2 xz"
13*49cdfc7eSAndroid Build Coastguard Workerchecksums="md5 sha1 sha256"
14*49cdfc7eSAndroid Build Coastguard Workergit_dir=$(cd "$basedir/.."; pwd)
15*49cdfc7eSAndroid Build Coastguard Workerdir="$(cd "$git_dir/../"; pwd)/ltp-release-$tag"
16*49cdfc7eSAndroid Build Coastguard Worker
17*49cdfc7eSAndroid Build Coastguard Workerif [ -d $dir ]; then
18*49cdfc7eSAndroid Build Coastguard Worker	ask "Directory '$dir' exists, will be deleted"
19*49cdfc7eSAndroid Build Coastguard Worker	rm -rf $dir
20*49cdfc7eSAndroid Build Coastguard Workerfi
21*49cdfc7eSAndroid Build Coastguard Workerrod mkdir $dir
22*49cdfc7eSAndroid Build Coastguard Workercd $dir
23*49cdfc7eSAndroid Build Coastguard Workerdir=$PWD
24*49cdfc7eSAndroid Build Coastguard Worker
25*49cdfc7eSAndroid Build Coastguard Worker# git clone (local)
26*49cdfc7eSAndroid Build Coastguard Workertitle "git clone"
27*49cdfc7eSAndroid Build Coastguard Workerrod git clone $git_dir $tarball_dir
28*49cdfc7eSAndroid Build Coastguard Workerrod cd $tarball_dir
29*49cdfc7eSAndroid Build Coastguard Worker
30*49cdfc7eSAndroid Build Coastguard Workertitle "Update submodules"
31*49cdfc7eSAndroid Build Coastguard Workerrod git submodule update --init
32*49cdfc7eSAndroid Build Coastguard Worker
33*49cdfc7eSAndroid Build Coastguard Workertitle "Generate configure script"
34*49cdfc7eSAndroid Build Coastguard Workerrod make autotools
35*49cdfc7eSAndroid Build Coastguard Worker
36*49cdfc7eSAndroid Build Coastguard Worker# tarballs, checksums
37*49cdfc7eSAndroid Build Coastguard Workertitle "Generate tarballs"
38*49cdfc7eSAndroid Build Coastguard Workercd ..
39*49cdfc7eSAndroid Build Coastguard Workerrod tar --exclude .git -cjf $tarball_dir.tar.bz2 $tarball_dir
40*49cdfc7eSAndroid Build Coastguard Workerrod tar --exclude .git -cJf $tarball_dir.tar.xz $tarball_dir
41*49cdfc7eSAndroid Build Coastguard Worker
42*49cdfc7eSAndroid Build Coastguard Workertitle "Generate checksums"
43*49cdfc7eSAndroid Build Coastguard Workerfor alg in $checksums; do
44*49cdfc7eSAndroid Build Coastguard Worker	for ext in $extensions; do
45*49cdfc7eSAndroid Build Coastguard Worker		file="$tarball_dir.tar.$ext"
46*49cdfc7eSAndroid Build Coastguard Worker		${alg}sum $file > "$file.$alg"
47*49cdfc7eSAndroid Build Coastguard Worker	done
48*49cdfc7eSAndroid Build Coastguard Workerdone
49*49cdfc7eSAndroid Build Coastguard Worker
50*49cdfc7eSAndroid Build Coastguard Worker# metadata documentation
51*49cdfc7eSAndroid Build Coastguard Workertitle "Generate metadata documentation"
52*49cdfc7eSAndroid Build Coastguard Workercd $tarball_dir
53*49cdfc7eSAndroid Build Coastguard Workerrod ./configure --with-metadata-generator=asciidoctor
54*49cdfc7eSAndroid Build Coastguard Workerrod make -C metadata
55*49cdfc7eSAndroid Build Coastguard Workercp -v docparse/metadata.html $dir/metadata.$tag.html
56*49cdfc7eSAndroid Build Coastguard Worker
57*49cdfc7eSAndroid Build Coastguard Workerecho "Generated files are in '$dir', upload them to github"
58