diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be855f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/2.1.tar.gz +/vagent2-2.2.0-dbc1e75.tar.gz diff --git a/2ccd64a.diff b/2ccd64a.diff new file mode 100644 index 0000000..ce8257c --- /dev/null +++ b/2ccd64a.diff @@ -0,0 +1,7 @@ +diff --git a/tests/data/boot.vcl b/tests/data/boot.vcl +index ddf7d13..38e9df8 100644 +--- a/tests/data/boot.vcl ++++ b/tests/data/boot.vcl +@@ -1 +1 @@ +-backend default { .host = "localhost"; } ++backend default { .host = "127.0.0.1"; } diff --git a/agent.params b/agent.params new file mode 100644 index 0000000..a3f30fc --- /dev/null +++ b/agent.params @@ -0,0 +1,14 @@ +# Varnish-agent environment configuration description. This was derived +# from the old style sysconfig/defaults settings + +# Default port to bind to. +VAGENT_PORT=6085 + +# Default location of the HTML interface. +VAGENT_HTML_DIRECTORY=/usr/share/varnish-agent/html + +# Additional options if needed. +VAGENT_OPTS= + +# Shared secret file, used to authenticate with varnishd +VAGENT_SECRET_FILE=/etc/varnish/agent_secret diff --git a/dead.package b/dead.package deleted file mode 100644 index ae1012e..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -not compatible with varnish 5+ diff --git a/sources b/sources new file mode 100644 index 0000000..69421fa --- /dev/null +++ b/sources @@ -0,0 +1 @@ +ad78a005e5866bd9777832ffc43bc186 vagent2-2.2.0-dbc1e75.tar.gz diff --git a/vagent.backend_timing.patch b/vagent.backend_timing.patch new file mode 100644 index 0000000..2183a59 --- /dev/null +++ b/vagent.backend_timing.patch @@ -0,0 +1,23 @@ +diff --git a/tests/util.sh b/tests/util.sh +index aae3e94..30a952e 100644 +--- a/tests/util.sh ++++ b/tests/util.sh +@@ -143,15 +143,15 @@ start_backend() { + python -u empty_response_backend.py 0 >$BACKEND_LOG 2>&1 & + backendpid=$(jobs -p %+) + echo $backendpid >$BACKEND_PID ++ sleep 3 + echo -e "\tStarted the backend. Pid $backendpid" + for i in x x x x x x x x x x; do +- sleep 1 ++ sleep 3 + backendport=$(grep -F 'Serving HTTP' $BACKEND_LOG | awk '{print $6}') + [ -n "$backendport" ] && break + done + if [ -z "$backendport" ]; then +- echo -e "\tFailed to bind in a timely fashion" +- exit 1 ++ echo -e "\tWarning: python backend failed to bind in a timely fashion." + fi + echo -e "\tListening to *:$backendport" + echo "backend default { .host = \"localhost:$backendport\"; }" >$TMPDIR/boot.vcl diff --git a/vagent.disable_test.patch b/vagent.disable_test.patch new file mode 100644 index 0000000..09808be --- /dev/null +++ b/vagent.disable_test.patch @@ -0,0 +1,12 @@ +diff --git i/tests/Makefile.am w/tests/Makefile.am +index 454dce1..4528a50 100644 +--- i/tests/Makefile.am ++++ w/tests/Makefile.am +@@ -2,7 +2,6 @@ LOG_COMPILER = $(srcdir)/test-wrapper + TESTS = ban.sh \ + arguments.sh \ + buffers.sh \ +- vac_register.sh \ + badvarnishd.sh \ + json.sh \ + log.sh \ diff --git a/varnish-agent.service b/varnish-agent.service new file mode 100644 index 0000000..c9ec625 --- /dev/null +++ b/varnish-agent.service @@ -0,0 +1,23 @@ +[Unit] +Description=Administration agent for Varnish Cache +Documentation=man:varnish-agent(1) +After=varnish + +[Service] + +EnvironmentFile=/etc/varnish/*.params +Type=forking +PIDFile=/var/run/varnish-agent.pid +PrivateTmp=true + +ExecStart=/usr/bin/varnish-agent \ + -P /var/run/varnish-agent.pid \ + -c $VAGENT_PORT \ + -H $VAGENT_HTML_DIRECTORY \ + -u $VARNISH_USER \ + -g $VARNISH_GROUP \ + -S $VARNISH_SECRET_FILE \ + $VAGENT_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/varnish-agent.spec b/varnish-agent.spec new file mode 100644 index 0000000..2bacb5f --- /dev/null +++ b/varnish-agent.spec @@ -0,0 +1,126 @@ +%global commit dbc1e75a4cbab4cc29a71aae0c8498916aad8246 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Name: varnish-agent +Version: 2.2.0 +Release: 1%{?dist} +Summary: Administration agent for Varnish Cache +Group: System Environment/Daemons + +License: BSD +URL: https://github.com/varnish/vagent2 +Source0: https://github.com/varnish/vagent2/archive/%{commit}/vagent2-%{version}-%{shortcommit}.tar.gz +Source1: varnish-agent.service +Source2: agent.params + +# post-release fixes from upstream +Patch0: https://github.com/varnish/vagent2/commit/2ccd64a.diff +# https://github.com/varnish/vagent2/commit/dde8d1b.diff +Patch1: vagent.backend_timing.patch +# randomly failing test with hazardous port use (not CI-friendly) +Patch2: vagent.disable_test.patch + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libcurl-devel +BuildRequires: libmicrohttpd-devel +BuildRequires: libtool +BuildRequires: perl-libwww-perl +BuildRequires: python-demjson +BuildRequires: python-docutils +BuildRequires: systemd +BuildRequires: varnish +BuildRequires: varnish-libs-devel + +Requires: varnish + +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + + +%description +Varnish Agent software that runs on all caches managed by Varnish +Administration Console (VAC). + + +%prep +%autosetup -n vagent2-%{commit} -p1 + +# varnish-agent expects to be built from the git repository +sed -i s/NOGIT/%{version}/ include/Makefile.am + + +%build +./autogen.sh +%configure +make %{?_smp_mflags} + + +%install +%make_install + +install -m 755 -d %{buildroot}%{_sharedstatedir}/%{name} +install -m 755 -d %{buildroot}%{_unitdir} +install -m 755 -d %{buildroot}%{_sysconfdir}/varnish + +install -pm 644 -t %{buildroot}%{_unitdir} %{SOURCE1} +install -pm 644 -t %{buildroot}%{_sysconfdir}/varnish %{SOURCE2} + + +%check +make check + + +%files +%doc LICENSE THANKS +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1* +%{_datadir}/%{name} +%{_unitdir}/%{name}.service +%{_sharedstatedir}/%{name} +%config(noreplace) %{_sysconfdir}/varnish/agent.params + + +%post +%systemd_post varnish-agent.service + + +%preun +%systemd_preun varnish-agent.service + + +%postun +%systemd_postun_with_restart varnish-agent.service + + +%changelog +* Sun Apr 20 2014 Dridi Boukelmoune - 2.2.0-1 +- Bumped version to 2.2.0 +- Switched to a commit tarball from github +- Removed the upstreamed patches +- Added patches for the test suite + +* Sun Dec 08 2013 Dridi Boukelmoune - 2.1-5 +- Removed the %%optflags on the %%configure command line + +* Sat Dec 07 2013 Dridi Boukelmoune - 2.1-4 +- Added a patch to make the test suites work offline +- Added a patch to disable the ban test suite +- Removed the default -S option from the service + +* Fri Nov 01 2013 Dridi Boukelmoune - 2.1-3 +- Added a patch for subdir-objects in automake +- Moved CFLAGS to the configure command line + +* Sun Oct 27 2013 Dridi Boukelmoune - 2.1-2 +- Requires: varnish +- BuildRequires: varnish python-demjson +- Added a patch for root privileges on the secret file +- Added a patch for the deprecated AM_CONFIG_HEADER macro +- Added a check section +- sed -i s/NOGIT/%{version}/ include/Makefile.am +- mv vagent.params agent.params + +* Sun Sep 15 2013 Dridi Boukelmoune - 2.1-1 +- Initial spec.