summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Romig-Koch <gavin@localhost.localdomain>2009-08-18 12:55:19 -0400
committerGavin Romig-Koch <gavin@localhost.localdomain>2009-08-18 12:55:19 -0400
commitc238b074feb5cc0fcd7bcac331036b09aa80a7a1 (patch)
tree564d70f61cea2a984a57638ba08e65bf5e134853
parent08fdfa8c2b7511a0886fc04787e07cf608abbc98 (diff)
downloadfastback-c238b074feb5cc0fcd7bcac331036b09aa80a7a1.tar.gz
fastback-c238b074feb5cc0fcd7bcac331036b09aa80a7a1.tar.xz
fastback-c238b074feb5cc0fcd7bcac331036b09aa80a7a1.zip
Improve Makefile and specfile to allow mock building
-rw-r--r--Makefile134
-rw-r--r--fastback.spec20
2 files changed, 84 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 271ea76..7a7fc5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
NAME=fastback
+VERSION=1
ifndef DESTDIR
DESTDIR=/
@@ -37,105 +38,100 @@ clean:
# Maintainer
#
+TARFILES=fastback.cpp Makefile fastback.conf fastback-check test fastback-unload-receipt
+TARFILENAME=$(NAME)-$(VERSION).tar.gz
+
+# This should be changed to build on dist, when I build a dist
+$(TARFILENAME): $(SPECFILE) $(TARFILES)
+ rm -rf $(NAME)-$(VERSION)
+ mkdir $(NAME)-$(VERSION)
+ cp -r $(TARFILES) $(NAME)-$(VERSION)
+ tar zcf $@ $(NAME)-$(VERSION)
+ rm -rf $(NAME)-$(VERSION)
+
+dist: $(TARFILENAME)
+
+maintainer-clean: clean
+ rm -rf $(TARFILENAME)
+
+
+
+
#
-# RPM Setup stuff
+# RPM specific
#
-
+ifndef NAME
+$(error "You can not run this Makefile without having NAME defined")
+endif
SPECFILE=$(NAME).spec
+ifneq ($(strip $(wildcard $(SPECFILE))),)
+
## a base directory where we'll put as much temporary working stuff as we can
-ifndef WORKDIR
WORKDIR := $(shell pwd)
-endif
-## of course all this can also be overridden in your RPM macros file,
-## but this way you can separate your normal RPM setup from your CVS
-## setup. Override RPM_WITH_DIRS in ~/.cvspkgsrc to avoid the usage of
-## these variables.
-SRCRPMDIR ?= $(WORKDIR)/SRPMS
-BUILDDIR ?= $(WORKDIR)/BUILD
-RPMDIR ?= $(WORKDIR)/RPMS
-MOCKDIR ?= $(WORKDIR)
-
-## SOURCEDIR is special; it has to match the CVS checkout directory,
-## because the CVS checkout directory contains the patch files. So it basically
-## can't be overridden without breaking things. But we leave it a variable
-## for consistency, and in hopes of convincing it to work sometime.
-ifndef SOURCEDIR
-SOURCEDIR := $(shell pwd)
-endif
-ifndef SPECDIR
-SPECDIR := $(shell pwd)
-endif
-# --define "_builddir $(BUILDDIR)" \
+SRCRPMDIR = $(WORKDIR)/SRPMS
+SRCRPMDIR_MD5 = $(WORKDIR)/SRPMS_MD5
+BUILDDIR = $(WORKDIR)/BUILD
+RPMDIR = $(WORKDIR)/RPMS
+MOCKDIR = $(WORKDIR)/MOCK
-ifndef RPM_DEFINES
-RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
- --define "_specdir $(SPECDIR)" \
- --define "_srcrpmdir $(SRCRPMDIR)" \
- --define "_rpmdir $(RPMDIR)"
-endif
+SOURCEDIR = $(WORKDIR)
+SPECDIR = $(WORKDIR)
+
+RPM_DEFINES = --define "_sourcedir $(SOURCEDIR)" \
+ --define "_specdir $(SPECDIR)" \
+ --define "_builddir $(BUILDDIR)" \
+ --define "_srcrpmdir $(SRCRPMDIR)" \
+ --define "_rpmdir $(RPMDIR)"
# Initialize the variables that we need, but are not defined
# the version of the package
VER_REL := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
-ifndef NAME
-$(error "You can not run this Makefile without having NAME defined")
+ifneq ($(strip $(VERSION)),$(strip $(word 1, $(VER_REL))))
+$(error "VERSION in Makefile does not match VERSION in spec file")
endif
-ifndef VERSION
-VERSION := $(word 1, $(VER_REL))
-endif
-# the release of the package
-ifndef RELEASE
RELEASE := $(word 2, $(VER_REL))
-endif
-# RPM with all the overrides in place; you can override this in your
-# .cvspkgsrc also, to use a default rpm setup
-# the rpm build command line
-ifndef RPM
-RPM := rpmbuild
-endif
-ifndef RPM_WITH_DIRS
+RPM = rpmbuild
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
-endif
-#
-# Actual Maintainer rules
-#
-TARFILES=fastback.cpp Makefile fastback.conf fastback-check test fastback-unload-receipt
-TARFILENAME=$(NAME)-$(VERSION).tar.gz
+name-ver-rel:
+ @echo $(NAME)-$(VERSION)-$(RELEASE)
-# This should be changed to build on dist, when I build a dist
-$(TARFILENAME): $(SPECFILE) $(TARFILES)
- rm -rf $(NAME)-$(VERSION)
- mkdir $(NAME)-$(VERSION)
- cp -r $(TARFILES) $(NAME)-$(VERSION)
- tar zcf $@ $(NAME)-$(VERSION)
- rm -rf $(NAME)-$(VERSION)
-dist: $(TARFILENAME)
+srpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) $(OLDSRPMS) -bs $<
+
+rpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -ba $(SPECFILE) 2>&1 | tee .build-$(VERSION)-$(RELEASE).log ; exit $${PIPESTATUS[0]}
+
-maintainer-clean: clean
- rm -rf $(TARFILENAME)
#
-# RPM install
+# BUILD SRPMS either with or without the MD5_DEFINES
#
+$(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -bs $<
-rpm-ver-rel:
- @echo $(VERSION) $(RELEASE)
+MD5_DEFINES=--define "_srcrpmdir $(SRCRPMDIR_MD5)" --define "_source_filedigest_algorithm md5" --define "_binary_filedigest_algorithm md5"
+$(SRCRPMDIR_MD5)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) $(MD5_DEFINES) -bs $<
-srpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
- $(RPM_WITH_DIRS) -bs $<
-rpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
- $(RPM_WITH_DIRS) -ba $(SPECFILE) 2>&1 | tee .build-$(VERSION)-$(RELEASE).log ; exit $${PIPESTATUS[0]}
+
+mock-fedora-11-x86_64: $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+ mock $(MOCKARGS) -r fedora-11-x86_64 --resultdir=$(MOCKDIR)/fedora-11-x86_64 rebuild $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+
+mock-epel-5-x86_64: $(SRCRPMDIR_MD5)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+ mock $(MOCKARGS) -r epel-5-x86_64 --resultdir=$(MOCKDIR)/epel-5-x86_64 rebuild $(SRCRPMDIR_MD5)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+
rpm-clean: maintainer-clean
- rm -rf RPMS SRPMS rpmbuild
+ rm -rf rpmbuild $(SRCRPMDIR) $(SRCRPMDIR_MD5) $(BUILDDIR) $(RPMDIR) $(MOCKDIR)
+endif \ No newline at end of file
diff --git a/fastback.spec b/fastback.spec
index f3a89a1..fe329c8 100644
--- a/fastback.spec
+++ b/fastback.spec
@@ -1,6 +1,6 @@
Name: fastback
Version: 1
-Release: 1%{?dist}
+Release: 1
Summary: File uploader, configureable file uploader
Group: support
@@ -9,6 +9,24 @@ URL: http://fedorahosted.org/fastback
Source0: fastback-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: openssl-devel
+Requires: openssl
+
+%if 0%{?rhel}
+%if 0%{?rhel} <= 5
+BuildRequires: curl-devel
+Requires: curl
+%else
+BuildRequires: libcurl-devel
+Requires: libcurl
+%endif
+%endif
+
+%if 0%{?fedora}
+BuildRequires: libcurl-devel
+Requires: libcurl
+%endif
+
%description
Fastback is a command line tool to upload files to a ticketing system, or
other configurable URL (FTP,SCP,...).