diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/flatpak | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/flatpak')
5 files changed, 285 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/default.nix b/nixpkgs/pkgs/development/libraries/flatpak/default.nix new file mode 100644 index 000000000000..41ab930a30ed --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/flatpak/default.nix @@ -0,0 +1,81 @@ +{ stdenv, fetchurl, autoreconfHook, docbook_xml_dtd_412, docbook_xml_dtd_42, docbook_xml_dtd_43, docbook_xsl, which, libxml2 +, gobject-introspection, gtk-doc, intltool, libxslt, pkgconfig, xmlto, appstream-glib, substituteAll, glibcLocales, yacc, xdg-dbus-proxy, p11-kit +, bubblewrap, bzip2, dbus, glib, gpgme, json-glib, libarchive, libcap, libseccomp, coreutils, python2, hicolor-icon-theme +, libsoup, lzma, ostree, polkit, python3, systemd, xorg, valgrind, glib-networking, makeWrapper, gnome3 }: + +let + version = "1.0.5"; + desktop_schemas = gnome3.gsettings-desktop-schemas; +in stdenv.mkDerivation rec { + name = "flatpak-${version}"; + + # TODO: split out lib once we figure out what to do with triggerdir + outputs = [ "out" "man" "doc" "installedTests" ]; + + src = fetchurl { + url = "https://github.com/flatpak/flatpak/releases/download/${version}/${name}.tar.xz"; + sha256 = "1wj88lp23bzz0c5n1i84nr2xff572i5cc10fqd9xh7qhj3ivk1w0"; + }; + + patches = [ + (substituteAll { + src = ./fix-test-paths.patch; + inherit coreutils glibcLocales; + hicolorIconTheme = hicolor-icon-theme; + }) + (substituteAll { + src = ./fix-paths.patch; + p11 = p11-kit; + }) + # patch taken from gtk_doc + ./respect-xml-catalog-files-var.patch + ./use-flatpak-from-path.patch + ]; + + nativeBuildInputs = [ + autoreconfHook libxml2 docbook_xml_dtd_412 docbook_xml_dtd_42 docbook_xml_dtd_43 docbook_xsl which gobject-introspection + gtk-doc intltool libxslt pkgconfig xmlto appstream-glib yacc makeWrapper + ]; + + buildInputs = [ + bubblewrap bzip2 dbus glib gpgme json-glib libarchive libcap libseccomp + libsoup lzma ostree polkit python3 systemd xorg.libXau + ]; + + checkInputs = [ valgrind ]; + + doCheck = false; # TODO: some issues with temporary files + + enableParallelBuilding = true; + + configureFlags = [ + "--with-system-bubblewrap=${bubblewrap}/bin/bwrap" + "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy" + "--localstatedir=/var" + "--enable-installed-tests" + ]; + + makeFlags = [ + "installed_testdir=$(installedTests)/libexec/installed-tests/flatpak" + "installed_test_metadir=$(installedTests)/share/installed-tests/flatpak" + ]; + + postPatch = '' + patchShebangs buildutil + patchShebangs tests + ''; + + postFixup = '' + wrapProgram $out/bin/flatpak \ + --prefix GIO_EXTRA_MODULES : "${glib-networking.out}/lib/gio/modules" \ + --prefix XDG_DATA_DIRS : "${desktop_schemas}/share/gsettings-schemas/${desktop_schemas.name}" + ''; + + meta = with stdenv.lib; { + description = "Linux application sandboxing and distribution framework"; + homepage = https://flatpak.org/; + license = licenses.lgpl21; + maintainers = with maintainers; [ jtojnar ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch new file mode 100644 index 000000000000..49fcaa2b3f9b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch @@ -0,0 +1,20 @@ +--- a/session-helper/flatpak-session-helper.c ++++ b/session-helper/flatpak-session-helper.c +@@ -624,7 +624,7 @@ + g_auto(GStrv) stdout_lines = NULL; + int i; + char *p11_argv[] = { +- "p11-kit", "server", ++ "@p11@/bin/p11-kit", "server", + /* We explicitly request --sh here, because we then fail on earlier versions that doesn't support + * this flag. This is good, because those earlier versions did not properly daemonize and caused + * the spawn_sync to hang forever, waiting for the pipe to close. +@@ -770,7 +770,7 @@ + exit (1); + } + +- if (g_find_program_in_path ("p11-kit")) ++ if (TRUE) + start_p11_kit_server (flatpak_dir); + else + g_debug ("p11-kit not found"); diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch new file mode 100644 index 000000000000..d00e4fa7f895 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch @@ -0,0 +1,123 @@ +--- a/tests/libtest.sh ++++ b/tests/libtest.sh +@@ -296,7 +296,7 @@ + # running installed-tests: assume we know what we're doing + : + elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \ +- --ro-bind / / /bin/true > bwrap-result 2>&1; then ++ --ro-bind / / @coreutils@/bin/true > bwrap-result 2>&1; then + sed -e 's/^/# /' < bwrap-result + echo "1..0 # SKIP Cannot run bwrap" + exit 0 +@@ -309,12 +309,12 @@ + export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)" + DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)" + +-if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then ++if ! @coreutils@/bin/kill -0 "$DBUS_SESSION_BUS_PID"; then + assert_not_reached "Failed to start dbus-daemon" + fi + + cleanup () { +- /bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} ++ @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} + gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true + fusermount -u $XDG_RUNTIME_DIR/doc || : + if test -n "${TEST_SKIP_CLEANUP:-}"; then +--- a/tests/make-test-runtime.sh ++++ b/tests/make-test-runtime.sh +@@ -26,6 +26,7 @@ + PATH="$PATH:/usr/sbin:/sbin" + + # Add bash and dependencies ++mkdir -p ${DIR}/nix/store + mkdir -p ${DIR}/usr/bin + mkdir -p ${DIR}/usr/lib + ln -s ../lib ${DIR}/usr/lib64 +@@ -35,48 +36,27 @@ + else + cp `which ldconfig` ${DIR}/usr/bin + fi +-LIBS=`mktemp` +-BINS=`mktemp` +- +-add_bin() { +- local f=$1 +- shift +- +- if grep -qFe "${f}" $BINS; then +- # Already handled +- return 0 +- fi +- +- echo $f >> $BINS +- +- # Add library dependencies +- (ldd "${f}" | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -) || true +- +- local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}") +- if [ x$shebang != x ]; then +- add_bin "$shebang" +- fi +-} +- + for i in $@; do +- I=`which $i` +- add_bin $I +-done +-for i in `cat $BINS`; do +- echo Adding binary $i 1>&2 +- cp "$i" ${DIR}/usr/bin/ +-done +-for i in `cat $LIBS`; do +- echo Adding library $i 1>&2 +- cp "$i" ${DIR}/usr/lib/ ++ I=$(readlink -f $(which $i)) ++ requisites=$(nix-store --query --requisites "$I") ++ for r in $requisites; do ++ # a single store item can be needed by multiple paths, no need to copy it again ++ if [ ! -e ${DIR}/$r ]; then ++ cp -r $r ${DIR}/$r ++ fi ++ done ++ ln -s $I ${DIR}/usr/bin/$i + done + ln -s bash ${DIR}/usr/bin/sh + +-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but +-# the real en_US locale is often not available, because its in the +-# local archive. ++mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store ++chmod -R u+w ${DIR} # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed ++find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths ++find ${DIR} -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets ++ ++# We copy the whole locale archive because we do not have C.UTF8 locale + mkdir -p ${DIR}/usr/lib/locale/ +-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US ++cp @glibcLocales@/lib/locale/locale-archive ${DIR}/usr/lib/locale/locale-archive + + if [ x$COLLECTION_ID != x ]; then + collection_args=--collection-id=${COLLECTION_ID} +--- a/tests/testlibrary.c ++++ b/tests/testlibrary.c +@@ -584,7 +584,7 @@ + { + gint exit_code = 0; + char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net", +- "--unshare-pid", "--ro-bind", "/", "/", "/bin/true", NULL }; ++ "--unshare-pid", "--ro-bind", "/", "/", "@coreutils@/bin/true", NULL }; + g_autofree char *argv_str = g_strjoinv (" ", argv); + g_test_message ("Spawning %s", argv_str); + g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error); +--- a/triggers/gtk-icon-cache.trigger ++++ b/triggers/gtk-icon-cache.trigger +@@ -1,7 +1,7 @@ + #!/bin/sh + + if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then +- cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ ++ cp @hicolorIconTheme@/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ + for dir in $1/exports/share/icons/*; do + if test -f $dir/index.theme; then + if ! gtk-update-icon-cache --quiet $dir; then diff --git a/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch b/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch new file mode 100644 index 000000000000..0e259aebd8a5 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/flatpak/respect-xml-catalog-files-var.patch @@ -0,0 +1,13 @@ +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -40,8 +40,8 @@ + [ + AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl + AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog]) +- if $jh_found_xmlcatalog && \ +- AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then ++ # empty argument forces libxml to use XML_CATALOG_FILES variable ++ if AC_RUN_LOG([$XMLCATALOG --noout "" "$1" >&2]); then + AC_MSG_RESULT([found]) + ifelse([$3],,,[$3 + ])dnl diff --git a/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch new file mode 100644 index 000000000000..408198bda5cb --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch @@ -0,0 +1,48 @@ +--- a/common/flatpak-dir.c ++++ b/common/flatpak-dir.c +@@ -5758,7 +5758,7 @@ export_desktop_file (const char *app, + + new_exec = g_string_new (""); + g_string_append_printf (new_exec, +- FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s", ++ "flatpak run --branch=%s --arch=%s", + escaped_branch, + escaped_arch); + +@@ -6935,8 +6935,8 @@ flatpak_dir_deploy (FlatpakDir *self, + error)) + return FALSE; + +- bin_data = g_strdup_printf ("#!/bin/sh\nexec %s/flatpak run --branch=%s --arch=%s %s \"$@\"\n", +- FLATPAK_BINDIR, escaped_branch, escaped_arch, escaped_app); ++ bin_data = g_strdup_printf ("#!/bin/sh\nexec flatpak run --branch=%s --arch=%s %s \"$@\"\n", ++ escaped_branch, escaped_arch, escaped_app); + if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE, + G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) + return FALSE; +diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh +index 6937b041..01f8add7 100755 +--- a/tests/test-bundle.sh ++++ b/tests/test-bundle.sh +@@ -59,7 +59,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files + assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export + assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop + # Ensure Exec key is rewritten +-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$" ++assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$" + assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png + assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png + +diff --git a/tests/test-run.sh b/tests/test-run.sh +index 9d83d82e..234e4ec6 100755 +--- a/tests/test-run.sh ++++ b/tests/test-run.sh +@@ -42,7 +42,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files + assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export + assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop + # Ensure Exec key is rewritten +-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$" ++assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$" + assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png + assert_not_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/dont-export.png + assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png |