-
Notifications
You must be signed in to change notification settings - Fork 0
/
makerpm.sh
executable file
·38 lines (30 loc) · 896 Bytes
/
makerpm.sh
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
##
# Bash script for creating rpm from Gemfile
#
# Author: Fotios Lindiakos (fotios at redhat.com)
#
# Process derived from: http://yo61.com/building-rpms-from-ruby-gems.html
##
function makerpm() {
GEMNAME=$@;
RPMDIR="$HOME/rpmbuild"
SPECNAME="$RPMDIR/SPECS/rubygem-$GEMNAME.spec";
# Create the required directories
mkdir -p $RPMDIR/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# Save the current directory and move
pushd "$RPMDIR/SOURCES"
# Generate base specfile
gem2rpm --fetch --o $SPECNAME $GEMNAME;
# Go back to the directory
popd
# Edit the spec.
# Inside vim run this before quitting to make sure build succeeds:
# rpmbuild -ba %
vim $SPECNAME;
# Run a final build just to make sure it works
rpmbuild -ba --clean $SPECNAME
# Add and commit back to the git repo
git add RPMS SOURCES SPECS SRPMS
git commit -m "Added $GEMNAME";
}
makerpm $@