From 97607f22d5d5408de4354beecb1355f2284be11a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 18 May 2014 09:26:13 -0400 Subject: [PATCH] packaging: Rework to also create Docker container --- packaging/Dockerfile.in | 5 +++++ .../Makefile.dist-packaging | 14 ++++---------- packaging/Makefile.docker | 13 +++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 packaging/Dockerfile.in rename Makefile.dist-packaging => packaging/Makefile.dist-packaging (72%) create mode 100644 packaging/Makefile.docker diff --git a/packaging/Dockerfile.in b/packaging/Dockerfile.in new file mode 100644 index 00000000..5d50fdb9 --- /dev/null +++ b/packaging/Dockerfile.in @@ -0,0 +1,5 @@ +FROM fedora:20 +RUN yum -y update +ADD @PACKAGE@ /var/tmp/@PACKAGE@ +RUN yum -y localinstall /var/tmp/@PACKAGE@ +ENTRYPOINT rpm-ostree treecompose diff --git a/Makefile.dist-packaging b/packaging/Makefile.dist-packaging similarity index 72% rename from Makefile.dist-packaging rename to packaging/Makefile.dist-packaging index 75a52f6d..bbdebc10 100644 --- a/Makefile.dist-packaging +++ b/packaging/Makefile.dist-packaging @@ -4,7 +4,7 @@ GITREV = $$(git describe --always --tags) GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,') srcdir=$(shell pwd) -PACKAGE=$(shell basename $(srcdir)) +PACKAGE=rpm-ostree PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG) @@ -13,7 +13,7 @@ dist-snapshot: echo "PACKAGE=$(PACKAGE)"; \ TARFILE_TMP=$(PKG_VER).tar.tmp; \ echo "Archiving $(PACKAGE) at $(GITREV)"; \ - (cd $(srcdir); git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \ + (cd ..; git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \ (cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \ rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \ echo "Archiving $${path} at $${rev}"; \ @@ -26,14 +26,8 @@ dist-snapshot: xz $(PKG_VER).tar srpm: dist-snapshot - (cd $(srcdir)/packaging; \ - cp ../$(PKG_VER).tar.xz . ; \ sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \ - ./rpmbuild-cwd -bs $(PACKAGE).spec) + ./rpmbuild-cwd -bs $(PACKAGE).spec rpm: srpm - $(srcdir)/packaging/rpmbuild-cwd --rebuild packaging/$(PKG_VER)*.src.rpm - -buildinstall: rpm - sudo yum localinstall $(PKG_VER)*.src.rpm - + $(srcdir)/rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm diff --git a/packaging/Makefile.docker b/packaging/Makefile.docker new file mode 100644 index 00000000..3e022465 --- /dev/null +++ b/packaging/Makefile.docker @@ -0,0 +1,13 @@ +# -*- mode: Makefile -*- + +include Makefile.dist-packaging + + +docker-local: rpm + rm docker -rf + mkdir -p docker + cp x86_64/$(PKG_VER)*.x86_64.rpm docker/$(PACKAGE).rpm + sed \ + -e s,\@PACKAGE\@,$(PACKAGE).rpm,g \ + < Dockerfile.in > docker/Dockerfile + (cd docker && docker build -t cgwalters/rpm-ostree .)