1 From 977fdfad2ceba7232b4f78144b20640d7fd0aedb Mon Sep 17 00:00:00 2001
2 From: Colin Walters <walters@verbum.org>
3 Date: Tue, 19 Jun 2018 09:34:18 -0400
4 Subject: [PATCH] Drop "ostree trivial-httpd" CLI, move to tests directory
6 See https://github.com/ostreedev/ostree/issues/1593
8 Basically this makes it easier for people packaging, as the trivial-httpd
9 is only for tests, and this way the binary will live with the tests.
11 Also at this point nothing should depend on `ostree trivial-httpd`.
13 Makefile-man.am | 6 --
14 Makefile-ostree.am | 7 ---
15 Makefile-tests.am | 7 +++
17 man/ostree-trivial-httpd.xml | 118 -----------------------------------
18 src/ostree/main.c | 5 --
19 tests/libtest.sh | 13 ++--
20 7 files changed, 12 insertions(+), 153 deletions(-)
21 delete mode 100644 man/ostree-trivial-httpd.xml
23 diff --git a/Makefile-man.am b/Makefile-man.am
24 index bc58103b..bcfde285 100644
27 @@ -34,12 +34,6 @@ ostree-init.1 ostree-log.1 ostree-ls.1 ostree-prune.1 ostree-pull-local.1 \
28 ostree-pull.1 ostree-refs.1 ostree-remote.1 ostree-reset.1 \
29 ostree-rev-parse.1 ostree-show.1 ostree-summary.1 \
32 -man1_files += ostree-trivial-httpd.1
34 -# We still want to distribute the source, even if we are not building it
35 -EXTRA_DIST += man/ostree-trivial-httpd.xml
39 man1_files += rofiles-fuse.1
40 diff --git a/Makefile-ostree.am b/Makefile-ostree.am
41 index f861afe4..497d99b0 100644
42 --- a/Makefile-ostree.am
43 +++ b/Makefile-ostree.am
44 @@ -144,13 +144,6 @@ ostree_SOURCES += src/ostree/ot-builtin-pull.c
48 -# Eventually once we stop things from using this, we should support disabling this
49 -ostree_SOURCES += src/ostree/ot-builtin-trivial-httpd.c
50 -pkglibexec_PROGRAMS += ostree-trivial-httpd
51 -ostree_trivial_httpd_SOURCES = src/ostree/ostree-trivial-httpd.c
52 -ostree_trivial_httpd_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_SOUP_CFLAGS)
53 -ostree_trivial_httpd_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_SOUP_LIBS)
56 # This is necessary for the cookie jar bits
57 ostree_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS)
58 diff --git a/Makefile-tests.am b/Makefile-tests.am
59 index fc2f2d91..7343b63f 100644
60 --- a/Makefile-tests.am
61 +++ b/Makefile-tests.am
62 @@ -263,6 +263,13 @@ _installed_or_uninstalled_test_programs += \
67 +test_extra_programs += ostree-trivial-httpd
68 +ostree_trivial_httpd_SOURCES = src/ostree/ostree-trivial-httpd.c
69 +ostree_trivial_httpd_CFLAGS = $(common_tests_cflags) $(OT_INTERNAL_SOUP_CFLAGS)
70 +ostree_trivial_httpd_LDADD = $(common_tests_ldadd) $(OT_INTERNAL_SOUP_LIBS)
74 test_programs += tests/test-repo-finder-avahi
76 diff --git a/configure.ac b/configure.ac
77 index 46a900f5..2f91cdec 100644
80 @@ -190,14 +190,6 @@ if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libsoup"; fi
81 AM_CONDITIONAL(USE_LIBSOUP, test x$with_soup != xno)
82 AM_CONDITIONAL(HAVE_LIBSOUP_CLIENT_CERTS, test x$have_libsoup_client_certs = xyes)
84 -AC_ARG_ENABLE(trivial-httpd-cmdline,
85 - [AS_HELP_STRING([--enable-trivial-httpd-cmdline],
86 - [Continue to support "ostree trivial-httpd" [default=no]])],,
87 - enable_trivial_httpd_cmdline=no)
88 -AS_IF([test x$enable_trivial_httpd_cmdline = xyes],
89 - [AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])]
92 AS_IF([test x$with_curl = xyes && test x$with_soup = xno], [
93 AC_MSG_WARN([Curl enabled, but libsoup is not; libsoup is needed for tests (make check, etc.)])
95 @@ -617,7 +609,6 @@ echo "
96 Rust (internal oxidation): $rust_debug_release
97 rofiles-fuse: $enable_rofiles_fuse
98 HTTP backend: $fetcher_backend
99 - \"ostree trivial-httpd\": $enable_trivial_httpd_cmdline
100 SELinux: $with_selinux
101 cryptographic checksums: $with_crypto
102 systemd: $have_libsystemd
103 diff --git a/man/ostree-trivial-httpd.xml b/man/ostree-trivial-httpd.xml
104 deleted file mode 100644
105 index d03c12be..00000000
106 --- a/man/ostree-trivial-httpd.xml
109 -<?xml version='1.0'?> <!--*-nxml-*-->
110 -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
111 - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
114 -Copyright 2011,2013 Colin Walters <walters@verbum.org>
116 -SPDX-License-Identifier: LGPL-2.0+
118 -This library is free software; you can redistribute it and/or
119 -modify it under the terms of the GNU Lesser General Public
120 -License as published by the Free Software Foundation; either
121 -version 2 of the License, or (at your option) any later version.
123 -This library is distributed in the hope that it will be useful,
124 -but WITHOUT ANY WARRANTY; without even the implied warranty of
125 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
126 -Lesser General Public License for more details.
128 -You should have received a copy of the GNU Lesser General Public
129 -License along with this library; if not, write to the
130 -Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131 -Boston, MA 02111-1307, USA.
134 -<refentry id="ostree">
137 - <title>ostree trivial-httpd</title>
138 - <productname>OSTree</productname>
142 - <contrib>Developer</contrib>
143 - <firstname>Colin</firstname>
144 - <surname>Walters</surname>
145 - <email>walters@verbum.org</email>
151 - <refentrytitle>ostree trivial-httpd</refentrytitle>
152 - <manvolnum>1</manvolnum>
156 - <refname>ostree-trivial-httpd</refname>
157 - <refpurpose>Simple webserver</refpurpose>
162 - <command>ostree trivial-httpd</command> <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt">DIR</arg>
166 -<!-- Don't entirely understand this command. Needs details, better content-->
168 - <title>Description</title>
171 - This runs a simple webserver and keeps it running until killed. If DIR is not specified, it defaults to the current directory.
176 - <title>Options</title>
180 - <term><option>--daemonize</option>,<option>-d</option></term>
183 - Fork into background when ready.
188 - <term><option>--autoexit</option></term>
191 - Automatically exit when directory is deleted.
196 - <term><option>--port-file</option>,<option>-p</option>="PATH"</term>
199 - Write port number to PATH (- for standard output).
204 - <term><option>--port</option>,<option>-P</option></term>
207 - Use the specified TCP port to listen on.
212 - <term><option>--force-range-requests</option></term>
215 - Force range requests by only serving half of files.
221 -<!-- NEED EXAMPLE OUTPUT HERE!-->
223 - <title>Example</title>
224 - <para><command>$ ostree trivial-httpd</command></para>
227 diff --git a/src/ostree/main.c b/src/ostree/main.c
228 index a523ff9a..61ea742d 100644
229 --- a/src/ostree/main.c
230 +++ b/src/ostree/main.c
231 @@ -118,11 +118,6 @@ static OstreeCommand commands[] = {
232 { "summary", OSTREE_BUILTIN_FLAG_NONE,
233 ostree_builtin_summary,
234 "Manage summary metadata" },
235 -#if defined(HAVE_LIBSOUP) && defined(BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE)
236 - { "trivial-httpd", OSTREE_BUILTIN_FLAG_NONE,
237 - ostree_builtin_trivial_httpd,
243 diff --git a/tests/libtest.sh b/tests/libtest.sh
244 index 3f5fd931..eacd96de 100755
245 --- a/tests/libtest.sh
246 +++ b/tests/libtest.sh
247 @@ -160,15 +160,12 @@ fi
248 if test -n "${OSTREE_UNINSTALLED:-}"; then
249 OSTREE_HTTPD=${OSTREE_UNINSTALLED}/ostree-trivial-httpd
251 - # trivial-httpd is now in $libexecdir by default, which we don't
252 - # know at this point. Fortunately, libtest.sh is also in
253 - # $libexecdir, so make an educated guess. If it's not found, assume
254 - # it's still runnable as "ostree trivial-httpd".
255 - if [ -x "${test_srcdir}/../../libostree/ostree-trivial-httpd" ]; then
256 - OSTREE_HTTPD="${CMD_PREFIX} ${test_srcdir}/../../libostree/ostree-trivial-httpd"
258 - OSTREE_HTTPD="${CMD_PREFIX} ostree trivial-httpd"
259 + # trivial-httpd is now the test directory.
260 + OSTREE_HTTPD="${G_TEST_BUILDDIR}/ostree-trivial-httpd"
261 + if ! [ -x "${OSTREE_HTTPD}" ]; then
262 + fatal "Failed to find ${OSTREE_HTTPD}"
264 + OSTREE_HTTPD="${CMD_PREFIX} ${OSTREE_HTTPD}"
267 files_are_hardlinked() {