-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathrpm.sh
More file actions
executable file
·60 lines (50 loc) · 1.69 KB
/
rpm.sh
File metadata and controls
executable file
·60 lines (50 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
set -x
#
# Copyright (C) 2021-2025 Bytedance Ltd. and/or its affiliates
# Copyright (c) 2011-2012 David Bigagli
#
major="2"
minor="1"
GIT_LAST_COMMIT=$(git log -1 --pretty=format:%H)
GIT_LAST_DATE=$(git log -1 --pretty=format:"%ad" --date=short)
GIT_LAST_DATE_FORMAT=$(date -d "${GIT_LAST_DATE}" "+%b %d %Y")
sed -i "s:\" __DATE__\":${GIT_LAST_DATE_FORMAT}:g" lsf/lsf.h
git config --global user.name "temp"
git config --global user.email "temp@commit.com"
git commit -a -m 'temp commit for make rpm with __DATE__'
git show
grep 4.6 /etc/redhat-release > /dev/null
if [ "$?" == "0" ]; then
echo "Cleaning..."
rm -f /usr/src/redhat/SOURCES/volclava*
rm -f /usr/src/redhat/RPMS/x86_64/volclava*
rm -f /usr/src/redhat/SPECS/volclava.spec
echo "Archiving..."
git archive --format=tar --prefix="volclava-${major}.${minor}/" HEAD \
| gzip > /usr/src/redhat/SOURCES/volclava-${major}.${minor}.tar.gz
cp spec/volclava.spec /usr/src/redhat/SPECS/volclava.spec
git reset --hard ${GIT_LAST_COMMIT}
echo "RPM building..."
rpmbuild -ba --target x86_64 /usr/src/redhat/SPECS/volclava.spec
if [ "$?" != 0 ]; then
echo "Failed buidling rpm"
exit 1
fi
exit 0
fi
echo "Cleaning up ~/rpmbuild directory..."
rm -rf ~/rpmbuild
echo "Creating the ~/rpmbuild..."
rpmdev-setuptree
echo "Archving source code..."
git archive --format=tar --prefix="volclava-${major}.${minor}/" HEAD \
| gzip > ~/rpmbuild/SOURCES/volclava-${major}.${minor}.tar.gz
cp spec/volclava.spec ~/rpmbuild/SPECS/volclava.spec
git reset --hard ${GIT_LAST_COMMIT}
echo "RPM building..."
rpmbuild -ba --target x86_64 ~/rpmbuild/SPECS/volclava.spec
if [ "$?" != 0 ]; then
echo "Failed buidling rpm"
exit 1
fi