-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto_repo
executable file
·68 lines (53 loc) · 1.28 KB
/
auto_repo
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
61
62
63
64
65
66
67
68
#!/bin/bash
#
# Authors: Guo Yunhe <[email protected]>
# Created: 2018-10-06
# Updated: 2018-10-11
#
# Build RPM packages from a SPEC file. Automatically download sources from
# GitHub/GitLab/BitBucket.
#
# Usage: ./build_package <package_name>
#
# Requires: createrepo rpm rpm-build nodejs npm
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
SPEC_DIR=$ROOT_DIR/spec
REPO_DIR=$ROOT_DIR/repo
JS_FILE=$REPO_DIR/packages.js
cd $ROOT_DIR
# Git sync
git pull
# Install BuildRequeires
./build_requires
cd $SPEC_DIR
PACKAGES=$(ls $SPEC_DIR)
cd $ROOT_DIR
# Build packages
# Up-to-date packages will be skipped to save time and resources
for PKG in $PACKAGES
do
./latest_release $PKG
./rpmbuild_spec $PKG
done
git add .
git commit -m "update package version"
git push
# Clean up
rm -rf ~/rpmbuild/*/*
# Download RPMS
./download_rpms
cp /dev/null $JS_FILE
echo "var packages=[" >> $JS_FILE
# Sign all packages
# We don't just sign new packages. In case we changed the GPG key, we resign all
for RPM in $REPO_DIR/*.rpm
do
rpm --resign $RPM
echo "'$(basename $RPM)'," >> $JS_FILE
done
echo "];" >> $JS_FILE
# Create repodata
createrepo $REPO_DIR
# Add detached signature to repodata
rm $REPO_DIR/repodata/repomd.xml.asc
gpg --detach-sign --armor $REPO_DIR/repodata/repomd.xml