New upstream version 2016.11

This commit is contained in:
Simon McVittie committed 2016-10-07 21:52:21 +01:00
commit f04805f646
179 files changed
+79036 -7233

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
!Makefile
ostree-http-server
run-apache
tmpdir-lifecycle
test-rollsum
test-bsdiff
test-checksum
test-gpg-verify-result
test-keyfile-utils
test-mutable-tree
test-ot-opt-utils
test-ot-tool-util
test-ot-unix-utils
test-rollsum-cli
-10
View File
@@ -1,10 +0,0 @@
FROM @ci_docker@
ENV container docker
ADD tests/ci-install.sh /ci-install.sh
RUN ci_suite="@ci_suite@" ci_distro="@ci_distro@" ci_in_docker=yes /ci-install.sh
ADD . /home/user/ostree
RUN chown -R user:user /home/user/ostree
WORKDIR /home/user/ostree
USER user
-67
View File
@@ -1,67 +0,0 @@
#!/bin/bash
set -euo pipefail
set -x
NULL=
: "${ci_docker:=}"
: "${ci_parallel:=1}"
: "${ci_sudo:=no}"
: "${ci_test:=yes}"
: "${ci_test_fatal:=yes}"
if [ -n "$ci_docker" ]; then
exec docker run \
--env=ci_docker="" \
--env=ci_parallel="${ci_parallel}" \
--env=ci_sudo=yes \
--env=ci_test="${ci_test}" \
--env=ci_test_fatal="${ci_test_fatal}" \
--privileged \
ostree-ci \
tests/ci-build.sh
fi
NOCONFIGURE=1 ./autogen.sh
srcdir="$(pwd)"
mkdir ci-build
cd ci-build
make="make -j${ci_parallel} V=1 VERBOSE=1"
../configure \
--enable-always-build-tests \
--enable-installed-tests \
"$@"
${make}
maybe_fail_tests () {
if [ "$ci_test_fatal" = yes ]; then
exit 1
fi
}
[ "$ci_test" = no ] || ${make} check || maybe_fail_tests
# TODO: if ostree aims to support distcheck, run that too
${make} install DESTDIR=$(pwd)/DESTDIR
( cd DESTDIR && find . )
if [ -n "$ci_sudo" ] && [ -n "$ci_test" ]; then
sudo ${make} install
env \
LD_LIBRARY_PATH=/usr/local/lib \
GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0 \
${make} installcheck || \
maybe_fail_tests
env \
LD_LIBRARY_PATH=/usr/local/lib \
GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0 \
gnome-desktop-testing-runner -d /usr/local/share ostree/ || \
maybe_fail_tests
fi
# vim:set sw=4 sts=4 et:
-85
View File
@@ -1,85 +0,0 @@
#!/bin/bash
set -euo pipefail
set -x
NULL=
: "${ci_docker:=}"
: "${ci_in_docker:=}"
: "${ci_suite:=jessie}"
if [ $(id -u) = 0 ]; then
sudo=
else
sudo=sudo
fi
if [ -n "$ci_docker" ]; then
sed \
-e "s/@ci_distro@/${ci_distro}/" \
-e "s/@ci_docker@/${ci_docker}/" \
-e "s/@ci_suite@/${ci_suite}/" \
< tests/ci-Dockerfile.in > Dockerfile
exec docker build -t ostree-ci .
fi
case "$ci_distro" in
(debian)
# Docker images use httpredir.debian.org but it seems to be
# unreliable; use a CDN instead
sed -i -e 's/httpredir\.debian\.org/deb.debian.org/g' /etc/apt/sources.list
;;
esac
case "$ci_distro" in
(debian|ubuntu)
# TODO: fetch this list from the Debian packaging git repository?
$sudo apt-get -y update
$sudo apt-get -y install \
attr \
bison \
cpio \
debhelper \
dh-autoreconf \
dh-systemd \
docbook-xml \
docbook-xsl \
e2fslibs-dev \
elfutils \
fuse \
gjs \
gnome-desktop-testing \
gobject-introspection \
gtk-doc-tools \
libarchive-dev \
libattr1-dev \
libcap-dev \
libfuse-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libgpgme11-dev \
liblzma-dev \
libmount-dev \
libselinux1-dev \
libsoup2.4-dev \
procps \
zlib1g-dev \
${NULL}
if [ -n "$ci_in_docker" ]; then
# Add the user that we will use to do the build inside the
# Docker container, and let them use sudo
adduser --disabled-password user </dev/null
apt-get -y install sudo systemd-sysv
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
chmod 0440 /etc/sudoers.d/nopasswd
fi
;;
(*)
echo "Don't know how to set up ${ci_distro}" >&2
exit 1
;;
esac
# vim:set sw=4 sts=4 et:
-562
View File
@@ -1,562 +0,0 @@
# This GLib suppressions file is known to be used at least by:
#
# - rpm-software-management/libhif
#
# Please use the upstream verison in libhif for changes.
{
gobject_init_1
Memcheck:Leak
...
fun:gobject_init
}
{
g_type_register_static_1
Memcheck:Leak
...
fun:g_type_register_static
}
{
g_type_register_dynamic
Memcheck:Leak
...
fun:g_type_register_dynamic
}
{
g_type_register_fundamental
Memcheck:Leak
...
fun:g_type_register_fundamental
}
{
g_type_init_with_debug_flags
Memcheck:Leak
...
fun:g_type_init_with_debug_flags
}
{
g_type_class_ref_1
Memcheck:Leak
...
fun:type_iface_vtable_base_init_Wm
...
fun:g_type_class_ref
}
{
g_type_class_ref_2
Memcheck:Leak
...
fun:type_class_init_Wm
...
fun:g_type_class_ref
}
{
g_type_add_interface_static
Memcheck:Leak
...
fun:g_type_add_interface_static
}
{
g_type_add_interface_dynamic
Memcheck:Leak
...
fun:g_type_add_interface_dynamic
}
{
g_param_spec_internal
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_type_create_instance
fun:g_param_spec_internal
}
{
g_param_spec_enum
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_enum
}
{
g_param_spec_flags
Memcheck:Leak
...
fun:g_type_class_ref
fun:g_param_spec_flags
}
{
g_quark_from_static_string
Memcheck:Leak
...
fun:g_quark_from_static_string
}
{
g_quark_from_string
Memcheck:Leak
...
fun:g_quark_from_string
}
{
g_value_register_transform_func
Memcheck:Leak
...
fun:g_value_register_transform_func
}
{
test_run_seed
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
fun:test_run_seed
...
fun:g_test_run_suite
}
{
g_test_init
Memcheck:Leak
...
fun:g_rand_new_with_seed_array
...
fun:g_test_init
}
{
g_intern_static_string
Memcheck:Leak
...
fun:g_intern_static_string
}
{
g_main_context_push_thread_default
Memcheck:Leak
...
fun:g_queue_new
fun:g_main_context_push_thread_default
}
{
g_main_context_push_thread_default_inlined
Memcheck:Leak
...
fun:g_slice_alloc0
fun:g_main_context_push_thread_default
}
{
g_dbus_error_register_error
Memcheck:Leak
...
fun:g_dbus_error_register_error
}
{
g_param_spec_pool_insert
Memcheck:Leak
...
fun:g_param_spec_pool_insert
}
{
g_main_context_default
Memcheck:Leak
...
fun:g_main_context_default
}
{
g_main_context_check
Memcheck:Leak
...
fun:g_ptr_array_add
fun:g_main_context_check
}
{
g_test_run_suite
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
fun:g_test_run_suite
}
{
g_dbus_interface_info_cache_build
Memcheck:Leak
...
fun:g_dbus_interface_info_cache_build
}
{
g_cancellable_push_current
Memcheck:Leak
...
fun:thread_memory_from_self
...
fun:g_cancellable_push_current
}
{
_g_io_module_get_default
Memcheck:Leak
...
fun:g_io_module_new
fun:g_io_modules_scan_all_in_directory_with_scope
fun:_g_io_modules_ensure_loaded
fun:_g_io_module_get_default
}
{
g_io_scheduler_push_job
Memcheck:Leak
...
fun:init_scheduler
fun:g_once_impl
fun:g_io_scheduler_push_job
}
{
g_io_scheduler_push_job_2
Memcheck:Leak
...
fun:g_system_thread_new
...
fun:g_io_scheduler_push_job
}
{
g_bus_get_sync__available_connections
Memcheck:Leak
...
fun:g_hash_table_new
fun:initable_init
fun:g_initable_init
fun:g_bus_get_sync
}
{
g_socket_connection_factory_register_type
Memcheck:Leak
...
fun:g_socket_connection_factory_register_type
}
{
g_test_add_vtable
Memcheck:Leak
...
fun:g_test_add_vtable
}
{
g_mutex_lock
Memcheck:Leak
...
fun:g_mutex_impl_new
fun:g_mutex_get_impl
fun:g_mutex_lock
}
{
g_thread_self
Memcheck:Leak
...
fun:g_thread_self
}
{
g_rec_mutex_lock
Memcheck:Leak
...
fun:g_rec_mutex_impl_new
fun:g_rec_mutex_get_impl
fun:g_rec_mutex_lock
}
{
test_case_run
Memcheck:Leak
...
fun:g_malloc0
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_get_charset
Memcheck:Leak
...
fun:g_get_charset
}
{
g_test_run_suite__timer_new
Memcheck:Leak
...
fun:g_timer_new
fun:test_case_run
...
fun:g_test_run_suite
}
{
g_test_run_suite__timer_new2
Memcheck:Leak
...
fun:g_timer_new
fun:test_case_run_suite_internal
...
fun:g_test_run_suite
}
{
g_test_run_suite__strconcat
Memcheck:Leak
...
fun:g_strconcat
fun:test_case_run
...
fun:g_test_run_suite
fun:g_test_run
}
{
g_type_interface_add_prerequisite
Memcheck:Leak
...
fun:g_type_interface_add_prerequisite
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:g_slist_copy
fun:g_test_run_suite_internal
...
fun:g_test_run_suite
}
{
g_set_prgname
Memcheck:Leak
...
fun:g_set_prgname
}
{
g_test_run_suite__strconcat_2
Memcheck:Leak
...
fun:g_strconcat
fun:g_test_run_suite_internal
}
{
g_test_run_suite__strdup
Memcheck:Leak
...
fun:g_strdup
fun:g_test_run_suite_internal
}
{
g_private_get
Memcheck:Leak
...
fun:g_private_get
}
{
g_private_set
Memcheck:Leak
...
fun:g_private_set
}
{
g_static_mutex_get_mutex_impl
Memcheck:Leak
...
fun:g_static_mutex_get_mutex_impl
}
{
g_variant_type_info_unref
Memcheck:Leak
...
fun:g_hash_table_remove
fun:g_variant_type_info_unref
}
{
g_rw_lock_reader_lock
Memcheck:Leak
...
fun:g_rw_lock_impl_new
fun:g_rw_lock_get_impl
fun:g_rw_lock_reader_lock
}
{
g_child_watch_finalize__rt_sigaction
Memcheck:Param
rt_sigaction(act->sa_flags)
fun:__libc_sigaction
...
fun:g_child_watch_finalize
}
{
g_dbus_worker_new
Memcheck:Leak
fun:calloc
...
fun:_g_dbus_worker_new
}
{
gdbus_shared_thread_func
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_malloc
...
fun:gdbus_shared_thread_func
}
{
g_task_start_task_thread
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
...
fun:g_thread_pool_push
fun:g_task_start_task_thread
}
{
g_task_to_pool
Memcheck:Leak
...
fun:g_thread_pool_start_thread
...
fun:g_task_run_in_thread
}
{
g_get_language_names
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:g_get_language_names
}
{
g_get_filename_charsets
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_get_filename_charsets
fun:g_filename_display_name
}
{
g_main_current_source
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
...
fun:g_main_current_source
fun:g_task_return
fun:g_task_thread_pool_thread
}
{
g_once_init_enter
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_once_init_enter
}
{
g_child_watch_source_new
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_thread_new
...
fun:g_child_watch_source_new
}
{
continue_writing_in_idle_cb
Memcheck:Leak
match-leak-kinds: definite
...
fun:g_task_new
...
fun:continue_writing_in_idle_cb
fun:g_main_context_dispatch
}
{
g_main_current_source
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_main_current_source
}
{
g_thread_pool_push
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_thread_pool_push
}
{
leak_test_dbus_dispose
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:g_main_loop_run
fun:g_test_dbus_down
}
{
leak_test_dbus_down
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
fun:g_main_loop_new
fun:g_test_dbus_down
}
{
leak_socket_client_connect
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:g_socket_client_connect_async
fun:g_socket_client_connect_to_uri_async
}
{
leak_signal_handlers_disconnect_matched
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
fun:g_malloc0
...
fun:g_slice_alloc
...
fun:g_signal_handlers_disconnect_matched
}
{
g_tls_connection_gnutls_init_priorities
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_strdup
fun:g_tls_connection_gnutls_init_priorities
}
{
g_tls_connection_gnutls_heisenbug_likely_same_as_above
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_strdup
...
fun:g_tls_client_connection_new
}
{
g_unix_signal_add_full
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
...
fun:g_thread_new
...
fun:g_unix_signal_add_full
}
{
glib_worker_1
Memcheck:Leak
...
fun:glib_worker_main
}
{
glib_worker_2
Memcheck:Leak
...
fun:g_thread_new
fun:g_get_worker_context
}
-1
View File
@@ -1 +0,0 @@
trusted/pubring.gpg
Binary file not shown.
-105
View File
@@ -1,105 +0,0 @@
#!/usr/bin/python
#
# Copyright (C) 2015 Red Hat
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
import os
import sys
if len(sys.argv) == 1:
loaderpath = '/boot/loader/entries'
grub2path = '/boot/grub2/grub.cfg'
else:
loaderpath = sys.argv[1]
grub2path = sys.argv[2]
def fatal(msg):
sys.stderr.write(msg)
sys.stderr.write('\n')
sys.exit(1)
def compare_entries_descending(a, b):
return int(b['version']) - int(a['version'])
def get_ostree_option(optionstring):
for o in optionstring.split():
if o.startswith('ostree='):
return o[8:]
raise ValueError('ostree= not found')
entries = []
grub2_entries = []
# Parse loader configs
for fname in os.listdir(loaderpath):
path = os.path.join(loaderpath, fname)
with open(path) as f:
entry = {}
for line in f:
line = line.strip()
if (line == '' or line.startswith('#')):
continue
s = line.find(' ')
assert s > 0
k = line[0:s]
v = line[s+1:]
entry[k] = v
entries.append(entry)
entries.sort(compare_entries_descending)
# Parse GRUB2 config
with open(grub2path) as f:
in_ostree_config = False
grub2_entry = None
for line in f:
if line.startswith('### BEGIN /etc/grub.d/15_ostree ###'):
in_ostree_config = True
elif line.startswith('### END /etc/grub.d/15_ostree ###'):
in_ostree_config = False
if grub2_entry is not None:
grub2_entries.append(grub2_entry)
elif in_ostree_config:
if line.startswith('menuentry '):
if grub2_entry is not None:
grub2_entries.append(grub2_entry)
grub2_entry = {}
elif line.startswith('linux'):
parts = line.split()
grub2_entry['linux'] = parts[1]
grub2_entry['options'] = ' '.join(parts[2:])
elif line.startswith('initrd'):
grub2_entry['initrd'] = line.split()[1]
if len(entries) != len(grub2_entries):
fatal("Found {0} loader entries, but {1} GRUB2 entries\n".format(len(entries), len(grub2_entries)))
def assert_matches_key(a, b, key):
aval = a[key]
bval = b[key]
if aval != bval:
fatal("Mismatch on {0}: {1} != {2}".format(key, aval, bval))
for i,(entry,grub2entry) in enumerate(zip(entries, grub2_entries)):
assert_matches_key(entry, grub2entry, 'linux')
assert_matches_key(entry, grub2entry, 'initrd')
entry_ostree = get_ostree_option(entry['options'])
grub2_ostree = get_ostree_option(grub2entry['options'])
if entry_ostree != grub2_ostree:
fatal("Mismatch on ostree option: {0} != {1}".format(entry_ostree, grub2_ostree))
sys.stdout.write('GRUB2 configuration validated\n')
sys.exit(0)
-1
View File
@@ -1 +0,0 @@
../src/boot/grub2/ostree-grub-generator
+101
View File
@@ -0,0 +1,101 @@
#!/bin/sh
# To use a custrom script for generating grub.cfg, set the --with-grub2-mkconfig=no
# configure switch when configuring and building OSTree.
#
# This script is called by ostree/src/libostree/ostree-bootloader-grub2.c whenever
# boot loader configuration file needs to be updated. It can be used as a template
# for a custom grub.cfg generator. What to consider when writing a custom grub.cfg
# generator:
#
# - The populate_menu() function converts boot loader entries as defined by
# https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ into GRUB2
# menuentry sections. This is the core logic that is required by OSTree
# based system.
#
# - Embedded systems: Be aware that this script is executed not only on a host machine by OS
# installer, but also on a target device, thus think about shell portability. A target device
# for example might be using busybox with a limited shell.
#
# Feel free to edit this script to fit your requirements.
set -e
script=$(basename ${0})
# Atomically safe location where to generete grub.cfg when executing system upgrade.
new_grub2_cfg=${2}
entries_path=$(dirname $new_grub2_cfg)/entries
read_config()
{
config_file=${entries_path}/${1}
title=""
initrd=""
options=""
linux=""
while read -r line
do
record=$(echo ${line} | cut -f 1 -d ' ')
value=$(echo ${line} | cut -s -f2- -d ' ')
case "${record}" in
"title")
title=${value}
;;
"initrd")
initrd=${value}
;;
"linux")
linux=${value}
;;
"options")
options=${value}
;;
esac
done < ${config_file}
if [ -z "${title}" ]; then
title="(Untitled)"
fi
}
populate_menu()
{
boot_prefix="${OSTREE_BOOT_PARTITION}"
for config in $(ls ${entries_path}); do
read_config ${config}
menu="${menu}menuentry '${title}' {\n"
menu="${menu}\t linux ${boot_prefix}${linux} ${options}\n"
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
menu="${menu}}\n\n"
done
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
printf "$menu" >> ${new_grub2_cfg}
}
populate_warning()
{
cat >> ${new_grub2_cfg} <<EOF
# This file was generated by ${script}. Do not modify the generated file - all changes will
# be lost the next time file is regenerated. For more details refer to the ${script} script.
EOF
}
populate_header()
{
cat >> ${new_grub2_cfg} <<EOF
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
default=boot
timeout=10
EOF
}
generate_grub2_cfg()
{
populate_warning
populate_header
populate_menu
}
generate_grub2_cfg
-1
View File
@@ -1 +0,0 @@
# Use this to suppress "possibly lost" for global statics
+33 -9
View File
@@ -31,25 +31,49 @@ static void
test_ostree_parse_delta_name (void)
{
{
g_autofree char *from;
g_autofree char *to;
_ostree_parse_delta_name ("30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d", &from, &to);
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (_ostree_parse_delta_name ("30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d", &from, &to, NULL));
g_assert_cmpstr (to, ==, "30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d");
g_assert_null (from);
}
{
g_autofree char *from;
g_autofree char *to;
_ostree_parse_delta_name ("30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d-5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", &from, &to);
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (_ostree_parse_delta_name ("30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d-5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", &from, &to, NULL));
g_assert_cmpstr (from, ==, "30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d");
g_assert_cmpstr (to, ==, "5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03");
}
{
g_autofree char *from;
g_autofree char *to;
_ostree_parse_delta_name ("", &from, &to);
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (!_ostree_parse_delta_name ("", &from, &to, NULL));
g_assert_null (from);
g_assert_null (to);
}
{
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (!_ostree_parse_delta_name ("GARBAGE", &from, &to, NULL));
g_assert_null (from);
g_assert_null (to);
}
{
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (!_ostree_parse_delta_name ("GARBAGE-5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", &from, &to, NULL));
g_assert_null (from);
g_assert_null (to);
}
{
g_autofree char *from = NULL;
g_autofree char *to = NULL;
g_assert (!_ostree_parse_delta_name ("30d13b73cfe1e6988ffc345eac905f82a18def8ef1f0666fc392019e9eac388d-GARBAGE", &from, &to, NULL));
g_assert_null (from);
g_assert_null (to);
}
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/env gjs
//
// Copyright (C) 2013 Colin Walters <walters@verbum.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
const Gio = imports.gi.Gio;
const OSTree = imports.gi.OSTree;
function assertEquals(a, b) {
if (a != b)
throw new Error("assertion failed " + JSON.stringify(a) + " == " + JSON.stringify(b));
}
let testDataDir = Gio.File.new_for_path('test-data');
testDataDir.make_directory(null);
testDataDir.get_child('some-file').replace_contents("hello world!", null, false, 0, null);
let repoPath = Gio.File.new_for_path('repo');
let repo = OSTree.Repo.new(repoPath);
repo.create(OSTree.RepoMode.ARCHIVE_Z2, null);
repo.open(null);
assertEquals(repo.get_mode(), OSTree.RepoMode.ARCHIVE_Z2);
repo.prepare_transaction(null);
let mtree = OSTree.MutableTree.new();
repo.write_directory_to_mtree(testDataDir, mtree, null, null);
let [,dirTree] = repo.write_mtree(mtree, null);
let [,commit] = repo.write_commit(null, 'Some subject', 'Some body', null, dirTree, null);
print("commit => " + commit);
repo.commit_transaction(null, null);
let [,root,checksum] = repo.read_commit(commit, null);
let child = root.get_child('some-file');
let info = child.query_info("standard::name,standard::type,standard::size", 0, null);
assertEquals(info.get_size(), 12);
print("test-core complete");
-43
View File
@@ -1,43 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
echo "1..2"
. $(dirname $0)/libtest.sh
setup_test_repository "bare"
$OSTREE checkout test2 checkout-test2
cd checkout-test2
chmod o+x firstfile
$OSTREE fsck -q && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
chmod o-x firstfile
$OSTREE fsck -q
echo "ok chmod"
cd ${test_tmpdir}
rm checkout-test2 -rf
$OSTREE checkout test2 checkout-test2
cd checkout-test2
chmod o+x firstfile
$OSTREE fsck -q --delete && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
echo "ok chmod"
+8 -1
View File
@@ -26,7 +26,7 @@ skip_without_user_xattrs
bindatafiles="bash true ostree"
morebindatafiles="false ls"
echo '1..10'
echo '1..11'
mkdir repo
${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2
@@ -235,3 +235,10 @@ ${CMD_PREFIX} ostree --repo=repo2 fsck
${CMD_PREFIX} ostree --repo=repo2 ls ${samerev} >/dev/null
echo 'ok pull empty delta part'
if ${CMD_PREFIX} ostree --repo=repo static-delta show GARBAGE 2> err.txt; then
assert_not_reached "static-delta show GARBAGE unexpectedly succeeded"
fi
assert_file_has_content err.txt "Invalid rev 'GARBAGE'"
echo 'ok handle bad delta name'
-82
View File
@@ -1,82 +0,0 @@
#!/usr/bin/env gjs
//
// Copyright (C) 2013 Colin Walters <walters@verbum.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const OSTree = imports.gi.OSTree;
function assertEquals(a, b) {
if (a != b)
throw new Error("assertion failed " + JSON.stringify(a) + " == " + JSON.stringify(b));
}
let testDataDir = Gio.File.new_for_path('test-data');
testDataDir.make_directory(null);
testDataDir.get_child('some-file').replace_contents("hello world!", null, false, 0, null);
testDataDir.get_child('another-file').replace_contents("hello world again!", null, false, 0, null);
let repoPath = Gio.File.new_for_path('repo');
let repo = OSTree.Repo.new(repoPath);
repo.create(OSTree.RepoMode.ARCHIVE_Z2, null);
repo.open(null);
let commitModifier = OSTree.RepoCommitModifier.new(OSTree.RepoCommitModifierFlags.GENERATE_SIZES, null);
assertEquals(repo.get_mode(), OSTree.RepoMode.ARCHIVE_Z2);
repo.prepare_transaction(null);
let mtree = OSTree.MutableTree.new();
repo.write_directory_to_mtree(testDataDir, mtree, commitModifier, null);
let [,dirTree] = repo.write_mtree(mtree, null);
let [,commit] = repo.write_commit(null, 'Some subject', 'Some body', null, dirTree, null);
print("commit => " + commit);
repo.commit_transaction(null, null);
// Test the sizes metadata
let [,commitVariant] = repo.load_variant(OSTree.ObjectType.COMMIT, commit);
let metadata = commitVariant.get_child_value(0);
let sizes = metadata.lookup_value('ostree.sizes', GLib.VariantType.new('aay'));
let nSizes = sizes.n_children();
assertEquals(nSizes, 2);
let expectedUncompressedSizes = [12, 18];
let foundExpectedUncompressedSizes = 0;
for (let i = 0; i < nSizes; i++) {
let sizeEntry = sizes.get_child_value(i).deep_unpack();
assertEquals(sizeEntry.length, 34);
let compressedSize = sizeEntry[32];
let uncompressedSize = sizeEntry[33];
print("compressed = " + compressedSize);
print("uncompressed = " + uncompressedSize);
for (let j = 0; j < expectedUncompressedSizes.length; j++) {
let expected = expectedUncompressedSizes[j];
if (expected == uncompressedSize) {
print("Matched expected uncompressed size " + expected);
expectedUncompressedSizes.splice(j, 1);
break;
}
}
}
if (expectedUncompressedSizes.length > 0) {
throw new Error("Failed to match expectedUncompressedSizes: " + JSON.stringify(expectedUncompressedSizes));
}
print("test-sizes complete");
-147
View File
@@ -1,147 +0,0 @@
#!/usr/bin/env gjs
//
// Copyright (C) 2013 Colin Walters <walters@verbum.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const OSTree = imports.gi.OSTree;
function assertEquals(a, b) {
if (a != b)
throw new Error("assertion failed " + JSON.stringify(a) + " == " + JSON.stringify(b));
}
function assertNotEquals(a, b) {
if (a == b)
throw new Error("assertion failed " + JSON.stringify(a) + " != " + JSON.stringify(b));
}
function libtestExec(shellCode) {
let testdatadir = GLib.getenv("G_TEST_SRCDIR");
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
let proc = Gio.Subprocess.new(['bash', '-c', 'set -xeuo pipefail; . ' + GLib.shell_quote(libtestPath) + '; ' + shellCode], 0);
proc.wait_check(null);
}
libtestExec('setup_os_repository archive-z2 syslinux');
let upstreamRepo = OSTree.Repo.new(Gio.File.new_for_path('testos-repo'));
upstreamRepo.open(null);
let runtimeRef = 'testos/buildmaster/x86_64-runtime';
let [,rev] = upstreamRepo.resolve_rev(runtimeRef, false);
print("testos => " + rev);
//// TEST: We should have no deployments
let sysroot = OSTree.Sysroot.new(Gio.File.new_for_path('sysroot'));
sysroot.load(null);
let deployments = sysroot.get_deployments();
assertEquals(deployments.length, 0);
//// Add the remote, and do a pull
let [,sysrootRepo] = sysroot.get_repo(null);
sysrootRepo.remote_add('testos', 'file://' + upstreamRepo.get_path().get_path(),
GLib.Variant.new('a{sv}', {'gpg-verify': GLib.Variant.new('b', false),
'branches': GLib.Variant.new('as', [runtimeRef])}), null);
sysrootRepo.pull('testos', null, 0, null, null);
//// TEST: We can deploy one tree
let mergeDeployment = sysroot.get_merge_deployment('testos');
let origin = sysroot.origin_new_from_refspec(runtimeRef);
let [,deployment] = sysroot.deploy_tree('testos', rev, origin,
mergeDeployment, null,
null);
let newDeployments = deployments;
deployments = null;
newDeployments.unshift(deployment);
sysroot.write_deployments(newDeployments, null);
deployments = sysroot.get_deployments();
assertEquals(deployments.length, newDeployments.length);
assertEquals(deployments[0].get_csum(), deployment.get_csum());
let deploymentPath = sysroot.get_deployment_directory(deployment);
assertEquals(deploymentPath.query_exists(null), true);
print("OK one deployment");
/// TEST: We can delete the deployment, going back to empty
sysroot.write_deployments([], null);
print("OK empty deployments");
assertEquals(deploymentPath.query_exists(null), false);
//// Ok, redeploy, then add a new revision upstream and pull it
let [,deployment] = sysroot.deploy_tree('testos', rev, origin,
mergeDeployment, null,
null);
newDeployments = deployments;
deployments = null;
newDeployments.unshift(deployment);
print(JSON.stringify(newDeployments));
sysroot.write_deployments(newDeployments, null);
libtestExec('os_repository_new_commit');
sysrootRepo.pull('testos', null, 0, null, null);
let [,newRev] = upstreamRepo.resolve_rev(runtimeRef, false);
print("testos => " + newRev);
assertNotEquals(rev, newRev);
mergeDeployment = sysroot.get_merge_deployment('testos');
assertEquals(mergeDeployment.get_csum(), deployment.get_csum());
let [,newDeployment] = sysroot.deploy_tree('testos', newRev, origin,
mergeDeployment, null,
null);
newDeployments = [newDeployment, mergeDeployment];
assertNotEquals(mergeDeployment.get_bootcsum(), newDeployment.get_bootcsum());
assertNotEquals(mergeDeployment.get_csum(), newDeployment.get_csum());
sysroot.write_deployments(newDeployments, null);
deployments = sysroot.get_deployments();
assertEquals(deployments.length, 2);
assertEquals(deploymentPath.query_exists(null), true);
let newDeploymentPath = sysroot.get_deployment_directory(newDeployment);
assertEquals(newDeploymentPath.query_exists(null), true);
print("OK two deployments");
libtestExec('os_repository_new_commit 0 1');
sysrootRepo.pull('testos', null, 0, null, null);
let [,thirdRev] = sysrootRepo.resolve_rev(runtimeRef, false);
assertNotEquals(newRev, thirdRev);
mergeDeployment = sysroot.get_merge_deployment('testos');
let [,thirdDeployment] = sysroot.deploy_tree('testos', thirdRev, origin,
mergeDeployment, null,
null);
assertEquals(mergeDeployment.get_bootcsum(), thirdDeployment.get_bootcsum());
assertNotEquals(mergeDeployment.get_csum(), thirdDeployment.get_csum());
newDeployments = [deployment, newDeployment, thirdDeployment];
sysroot.write_deployments(newDeployments, null);
deployments = sysroot.get_deployments();
assertEquals(deployments.length, 3);