Navigation Menu

Skip to content

Commit

Permalink
Allow to create rpm instead of deb packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gruenbacher committed Jan 8, 2019
1 parent 99b9317 commit 4e383be
Show file tree
Hide file tree
Showing 25 changed files with 152 additions and 347 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1,6 +1,7 @@
/* export-ignore
.gitignore export-ignore
.gitattributes export-ignore
Makefile !export-ignore
backend !export-ignore
htdocs !export-ignore
create-db.sql !export-ignore
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@
/lib/Auswertung.pm
/debs
/backend/package-lock.json
/rpm
/srpm
25 changes: 21 additions & 4 deletions Makefile
@@ -1,4 +1,5 @@
export PACKAGE = trialinfo
export GPG_NAME = 3BB03F34

MAKEFLAGS = --no-print-directory

Expand Down Expand Up @@ -48,6 +49,10 @@ serve: build
profile: build
cd backend && npm run profile

# For use by rpm.sh:
snapshot:
@tar -c $(DOWNLOAD_FILES) backend/node_modules backend/package-lock.json

.PHONY: require-tag
require-tag:
@tag="$(TAG)"; \
Expand All @@ -60,15 +65,27 @@ require-tag:
exit 2; \
fi

tarball: require-tag
@./tarball.sh $(TAG)

release: require-tag tarball
release: require-tag
@./release.sh $(TAG)

upload:
@./upload.sh

repo/RPM-GPG-KEY-trialinfo:
@gpg --export -a $(GPG_NAME) > "$@"

.PHONY: repo
repo: repo/RPM-GPG-KEY-trialinfo
@rpmbuild -bb \
-D "_sourcedir $(PWD)/repo" \
-D "_rpmdir $(PWD)/rpm" \
-D "_gpg_name $(GPG_NAME)" \
repo/trialinfo-repo.spec
@rpm --addsign \
-D "__gpg /usr/bin/gpg" \
-D "_gpg_name $(GPG_NAME)" \
rpm/noarch/trialinfo-repo-*.rpm

htdocs/js/angular-$(ANGULAR_VERSION)/angular%:
@mkdir -p $(dir $@)
$(CURL) -o $@ --silent --location \
Expand Down
20 changes: 0 additions & 20 deletions Makefile.release

This file was deleted.

2 changes: 1 addition & 1 deletion backend/pdf-fill-form.py
@@ -1,4 +1,4 @@
#! /usr/bin/python
#! /usr/bin/python2

import sys
import getopt
Expand Down
5 changes: 0 additions & 5 deletions debian/changelog

This file was deleted.

1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

19 changes: 0 additions & 19 deletions debian/control

This file was deleted.

8 changes: 0 additions & 8 deletions debian/copyright

This file was deleted.

2 changes: 0 additions & 2 deletions debian/debhelper-build-stamp

This file was deleted.

42 changes: 0 additions & 42 deletions debian/postinst

This file was deleted.

39 changes: 0 additions & 39 deletions debian/postinst.ex

This file was deleted.

37 changes: 0 additions & 37 deletions debian/postrm.ex

This file was deleted.

35 changes: 0 additions & 35 deletions debian/preinst.ex

This file was deleted.

38 changes: 0 additions & 38 deletions debian/prerm.ex

This file was deleted.

7 changes: 0 additions & 7 deletions debian/rules

This file was deleted.

1 change: 0 additions & 1 deletion debian/source/format

This file was deleted.

40 changes: 21 additions & 19 deletions release.sh
@@ -1,30 +1,32 @@
#! /bin/sh

set -e
: ${PACKAGE:=trialinfo}

REPO=debs
set -e

topdir=$PWD
tag=$1
version=${tag#$PACKAGE-}

tarball=$PACKAGE-$version.tar.gz
version=${tag#$PACKAGE-}
basename=$PACKAGE-$version
deb=${PACKAGE}_${version}_all.deb

curdir=$PWD

tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT

tar -xz -C "$tmpdir" < "$tarball"
cp -r debian "$tmpdir/$basename/"
cd "$tmpdir/$basename"
sed -i \
-e "s/@VERSION@/$version/g" \
-e "s/@DATE@/$(date -R)/g" \
"debian/changelog"
sudo dpkg-buildpackage -us -uc -d
cd ..
sudo chown -R $(whoami) .
mkdir -p "$curdir/$REPO"
cat "$deb" > "$curdir/$REPO/$deb"
mkdir "$tmpdir/$basename"
git show "$tag:$PACKAGE.spec" > "$tmpdir/$PACKAGE.spec"
git archive --prefix="$basename/" "$tag" | gzip -9 > "$tmpdir/$basename.tar.gz"
make snapshot | gzip -9 > "$tmpdir/snapshot.tar.gz"

cd "$tmpdir"
rpmbuild -ba \
-D "_sourcedir $tmpdir" \
-D "_rpmdir $topdir/rpm" \
-D "_srcrpmdir $topdir/srpm" \
-D "VERSION $version" \
"$PACKAGE.spec"
rpm --addsign \
-D "__gpg /usr/bin/gpg" \
-D "_gpg_name $GPG_NAME" \
$topdir/rpm/*/trialinfo-$version-*.rpm \
$topdir/srpm/trialinfo-$version-*.rpm
1 change: 1 addition & 0 deletions repo/.gitignore
@@ -0,0 +1 @@
/RPM-GPG-KEY-trialinfo

0 comments on commit 4e383be

Please sign in to comment.