From fd1af9ebf00e234ab6fb542e97ffa74b0630f911 Mon Sep 17 00:00:00 2001
From: Julien Leduc <julien.leduc@cern.ch>
Date: Thu, 31 Aug 2017 15:58:27 +0200
Subject: [PATCH] Adding initial spec file for cta_eos_wfe_scripts will be
 merged later in cta.spec.in when we agree on content

---
 eos_wfe_scripts/Makefile                 | 24 ++++++++++++++
 eos_wfe_scripts/cta_eos_wfe_scripts.spec | 42 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 eos_wfe_scripts/Makefile
 create mode 100644 eos_wfe_scripts/cta_eos_wfe_scripts.spec

diff --git a/eos_wfe_scripts/Makefile b/eos_wfe_scripts/Makefile
new file mode 100644
index 0000000000..8cc3bc2ab2
--- /dev/null
+++ b/eos_wfe_scripts/Makefile
@@ -0,0 +1,24 @@
+SPECFILE    = $(shell find -maxdepth 1 -type f -name *.spec)
+PACKAGE     = $(shell awk '$$1 == "Name:"     { print $$2 }' $(SPECFILE) )
+VERSION     = $(shell awk '$$1 == "Version:"  { print $$2 }' $(SPECFILE) )
+RELEASE     = $(shell awk '$$1 == "Release:"  { print $$2 }' $(SPECFILE) )
+TARFILE     = $(PACKAGE)-$(VERSION).tar.gz
+RPMTOPDIR   = $(shell rpm --eval '%{_topdir}')
+BUILDARCH   = $(shell awk '$$1 == "BuildArch:"  { print $$2 }' $(SPECFILE) )
+BUILTRPM    = $(RPMTOPDIR)/RPMS/$(BUILDARCH)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(BUILDARCH).rpm
+
+all: $(TARFILE)
+
+
+$(TARFILE):
+	tar cvzf $(TARFILE) --hard-dereference --dereference --exclude-vcs --transform 's,^,$(PACKAGE)-$(VERSION)/,' *
+
+clean:
+	rm $(TARFILE)
+
+build: $(TARFILE) $(SPECFILE)
+	mv $(TARFILE) $(RPMTOPDIR)/SOURCES
+	rpmbuild -ba $(SPECFILE)
+
+deb_build: build
+	sudo alien $(BUILTRPM) --scripts -k
diff --git a/eos_wfe_scripts/cta_eos_wfe_scripts.spec b/eos_wfe_scripts/cta_eos_wfe_scripts.spec
new file mode 100644
index 0000000000..cb6620974b
--- /dev/null
+++ b/eos_wfe_scripts/cta_eos_wfe_scripts.spec
@@ -0,0 +1,42 @@
+Summary: CERN Tape Archive workflow scripts for EOS
+Name: cta_eos_wfe_scripts
+Version: 0.1
+Release: 1
+License: GPL
+Group: Applications/System
+Buildroot: %{_tmppath}/%{name}-%{version}
+Source: %{name}-%{version}.tar.gz
+Group: Applications/System
+BuildArch: noarch
+requires: eos-server
+
+%description
+eos_wfe_scripts contains all the workflows needed for archival from EOS to CTA and for retrieva from CTA to EOS.
+This version contains all the file for the so called *preproduction* workflows.
+
+
+%prep
+%setup -n %{name}-%{version}
+
+
+%build
+
+
+%install
+[ -d %{buildroot} ] && rm -rf %{buildroot}
+
+mkdir -p %{buildroot}/var/eos/wfe/bash
+install -m 755 create_tape_drop_disk_replicas %{buildroot}/var/eos/wfe/bash/create_tape_drop_disk_replicas
+install -m 755 delete_archive_file %{buildroot}/var/eos/wfe/bash/delete_archive_file
+install -m 755 retrieve_archive_file %{buildroot}/var/eos/wfe/bash/retrieve_archive_file
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,daemon,daemon)
+/var/eos/wfe/bash/create_tape_drop_disk_replicas
+/var/eos/wfe/bash/delete_archive_file
+/var/eos/wfe/bash/retrieve_archive_file
-- 
GitLab