forked from Mirrors/flatpak-builder
Stop using ostree trivial-httpd
This isn't always available in recent ostree. This work is based on https://github.com/flatpak/flatpak/pull/658 and fixes https://github.com/ostreedev/ostree/pull/723tingping/wmclass
parent
82aad1ccb1
commit
32eb260d24
|
@ -80,6 +80,7 @@ dist_installed_test_extra_scripts += \
|
|||
tests/make-test-runtime.sh \
|
||||
tests/make-test-bundles.sh \
|
||||
tests/testpython.py \
|
||||
tests/test-webserver.sh \
|
||||
$(NULL)
|
||||
|
||||
dist_installed_test_data = \
|
||||
|
|
|
@ -180,8 +180,9 @@ setup_repo () {
|
|||
GPGARGS="$FL_GPGARGS" . $(dirname $0)/make-test-runtime.sh org.test.Platform bash ls cat echo readlink > /dev/null
|
||||
GPGARGS="$FL_GPGARGS" . $(dirname $0)/make-test-app.sh > /dev/null
|
||||
update_repo
|
||||
ostree trivial-httpd --autoexit --daemonize -p httpd-port repos
|
||||
$(dirname $0)/test-webserver.sh repos
|
||||
port=$(cat httpd-port)
|
||||
FLATPAK_HTTP_PID=$(cat httpd-pid)
|
||||
flatpak remote-add ${U} --gpg-import=${FL_GPG_HOMEDIR}/pubring.gpg test-repo "http://127.0.0.1:${port}/test"
|
||||
}
|
||||
|
||||
|
@ -266,7 +267,7 @@ if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
|
|||
fi
|
||||
|
||||
cleanup () {
|
||||
/bin/kill $DBUS_SESSION_BUS_PID
|
||||
/bin/kill $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-}
|
||||
gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true
|
||||
fusermount -u $XDG_RUNTIME_DIR/doc || :
|
||||
rm -rf $TEST_DATA_DIR
|
||||
|
|
|
@ -79,8 +79,9 @@ flatpak uninstall ${U} org.test.Hello
|
|||
make_updated_app HTTP
|
||||
${FLATPAK} build-bundle --oci repos/test oci/registry org.test.Hello
|
||||
|
||||
ostree trivial-httpd --autoexit --daemonize -p oci-port `pwd`/oci
|
||||
ociport=$(cat oci-port)
|
||||
$(dirname $0)/test-webserver.sh `pwd`/oci
|
||||
ociport=$(cat httpd-port)
|
||||
FLATPAK_HTTP_PID="${FLATPAK_HTTP_PID} $(cat httpd-pid)"
|
||||
|
||||
${FLATPAK} remote-add ${U} --oci oci-remote-http http://127.0.0.1:${ociport}/registry
|
||||
${FLATPAK} install -v ${U} oci-remote-http org.test.Hello
|
||||
|
|
|
@ -12,6 +12,7 @@ static char *flatpak_installationsdir;
|
|||
static char *gpg_homedir;
|
||||
static char *gpg_args;
|
||||
static char *repo_url;
|
||||
int httpd_pid = -1;
|
||||
|
||||
static const char *gpg_id = "7B0961FD";
|
||||
const char *repo_name = "test-repo";
|
||||
|
@ -605,7 +606,8 @@ launch_httpd (void)
|
|||
{
|
||||
int status;
|
||||
g_autoptr(GError) error = NULL;
|
||||
char *argv[] = { "ostree", "trivial-httpd", "--autoexit", "--daemonize", "-p", "http-port", "repos", NULL };
|
||||
g_autofree char *path = g_test_build_filename (G_TEST_DIST, "test-webserver.sh", NULL);
|
||||
char *argv[] = {path , "repos", NULL };
|
||||
GSpawnFlags flags = G_SPAWN_SEARCH_PATH;
|
||||
|
||||
if (g_test_verbose ())
|
||||
|
@ -629,11 +631,18 @@ add_remote (void)
|
|||
char *argv[] = { "flatpak", "remote-add", "--user", "--gpg-import=", "name", "url", NULL };
|
||||
g_autofree char *gpgimport = NULL;
|
||||
g_autofree char *port = NULL;
|
||||
g_autofree char *pid = NULL;
|
||||
GSpawnFlags flags = G_SPAWN_SEARCH_PATH;
|
||||
|
||||
launch_httpd ();
|
||||
|
||||
g_file_get_contents ("http-port", &port, NULL, &error);
|
||||
g_file_get_contents ("httpd-pid", &pid, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
httpd_pid = atoi (pid);
|
||||
g_assert_cmpint (httpd_pid, !=, 0);
|
||||
|
||||
g_file_get_contents ("httpd-port", &port, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
if (port[strlen (port) - 1] == '\n')
|
||||
|
@ -824,6 +833,9 @@ global_teardown (void)
|
|||
flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;
|
||||
}
|
||||
|
||||
if (httpd_pid != -1)
|
||||
kill (httpd_pid, SIGKILL);
|
||||
|
||||
/* mostly ignore failure here */
|
||||
if (!g_spawn_sync (NULL, (char **)argv, NULL, flags, NULL, NULL, NULL, NULL, &status, &error) ||
|
||||
!g_spawn_check_exit_status (status, &error))
|
||||
|
|
Loading…
Reference in New Issue