forked from RedHatSatellite/satellite-sanity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedist
executable file
·44 lines (36 loc) · 1.13 KB
/
makedist
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
#!/bin/sh
set -e
# Get curent version of package from spec file
PROJ=satellite-sanity
SPEC=$PROJ.spec
if [ ! -r $SPEC ]; then
echo "ERROR: Could not read '$SPEC'" >&2
exit 10
fi
VERSION=`cat VERSION`
if [ -z "$VERSION" ]; then
echo "ERROR: Could not determine version" >&2
exit 10
fi
if [ ! -d ~/rpmbuild/SOURCES -o ! -d ~/rpmbuild/SPECS ]; then
echo "ERROR: Directories ~/rpmbuild/[SOURCES,SPECS] not available" >&2
exit 10
fi
DIR=$PROJ-$VERSION
mkdir -p "$DIR"
cp LICENSE README.md "$DIR/"
cp $SPEC "$DIR/"
cp satellite-sanity "$DIR/"
cp tests.py tests.sh "$DIR/"
cp -r --no-dereference satellite_sanity "$DIR/"
cp setup.py "$DIR/"
sed -i "s/REPLACE_ME_WITH_VERSION/$VERSION/" "$DIR/setup.py"
# Cleanup some files we do not need/want
find "$DIR/" -type f -name \*.pyc -delete
find "$DIR/" -type f -name \*.swp -delete
tar -czf $PROJ-$VERSION.tar.gz "$DIR/" >/dev/null
rm -rf "$DIR"
# Put all files into ~/rpmbuild/...
sed "s/REPLACE_ME_WITH_VERSION/$VERSION/" "$SPEC" > ~/rpmbuild/SPECS/"$SPEC"
mv $PROJ-$VERSION.tar.gz ~/rpmbuild/SOURCES
echo "All looks good now. You might want to run 'rpmbuild -ba ~/rpmbuild/SPECS/$SPEC'."