uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,158 @@
{ lib, stdenv
, fetchurl
, substituteAll
, nixosTests
, autoreconfHook
, docbook_xml_dtd_412
, docbook_xml_dtd_42
, docbook_xml_dtd_43
, docbook_xsl
, gettext
, libxml2
, libxslt
, pkg-config
, xmlto
, acl
, breezy
, binutils
, bzip2
, coreutils
, cpio
, curl
, debugedit
, elfutils
, flatpak
, gitMinimal
, glib
, glibcLocales
, gnumake
, gnupg
, gnutar
, json-glib
, libcap
, libdwarf
, libsoup
, libyaml
, ostree
, patch
, python2
, rpm
, unzip
}:
let
installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder";
installed_test_metadir = "${placeholder "installedTests"}/share/installed-tests/flatpak-builder";
in stdenv.mkDerivation rec {
pname = "flatpak-builder";
version = "1.2.2";
outputs = [ "out" "doc" "man" "installedTests" ];
src = fetchurl {
url = "https://github.com/flatpak/flatpak-builder/releases/download/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-if2mjlN8Hp3gI1JpC9icMhenKRZFWNNfNbCPea2E4D4=";
};
patches = [
# patch taken from gtk_doc
./respect-xml-catalog-files-var.patch
# Hardcode paths
(substituteAll {
src = ./fix-paths.patch;
brz = "${breezy}/bin/brz";
cp = "${coreutils}/bin/cp";
patch = "${patch}/bin/patch";
tar = "${gnutar}/bin/tar";
unzip = "${unzip}/bin/unzip";
rpm2cpio = "${rpm}/bin/rpm2cpio";
cpio = "${cpio}/bin/cpio";
git = "${gitMinimal}/bin/git";
rofilesfuse = "${ostree}/bin/rofiles-fuse";
strip = "${binutils}/bin/strip";
eustrip = "${elfutils}/bin/eu-strip";
euelfcompress = "${elfutils}/bin/eu-elfcompress";
})
# The test scripts in Flatpak repo were updated so we are basing
# this on our patch for Flatpak 0.99.
(substituteAll {
src = ./fix-test-paths.patch;
inherit glibcLocales python2;
})
];
nativeBuildInputs = [
autoreconfHook
docbook_xml_dtd_43
docbook_xsl
gettext
libxml2
libxslt
pkg-config
xmlto
];
buildInputs = [
acl
bzip2
curl
debugedit
elfutils
flatpak
glib
json-glib
libcap
libdwarf
libsoup
libxml2
libyaml
ostree
];
configureFlags = [
"--enable-installed-tests"
"--with-system-debugedit"
];
makeFlags = [
"installed_testdir=${installed_testdir}"
"installed_test_metadir=${installed_test_metadir}"
];
# Some scripts used by tests need to use shebangs that are available in Flatpak runtimes.
dontPatchShebangs = true;
enableParallelBuilding = true;
# Installed tests
postFixup = ''
for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh}; do
patchShebangs $file
done
'';
passthru = {
installedTestsDependencies = [
gnupg
ostree
python2
gnumake
];
tests = {
installedTests = nixosTests.installed-tests.flatpak-builder;
};
};
meta = with lib; {
description = "Tool to build flatpaks from source";
homepage = "https://github.com/flatpak/flatpak-builder";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ jtojnar ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,151 @@
diff --git a/src/builder-context.c b/src/builder-context.c
index dde12790..3a379297 100644
--- a/src/builder-context.c
+++ b/src/builder-context.c
@@ -256,7 +256,7 @@ builder_context_init (BuilderContext *self)
g_autofree char *path = NULL;
self->rofiles_file_lock = init;
- path = g_find_program_in_path ("rofiles-fuse");
+ path = g_find_program_in_path ("@rofilesfuse@");
self->have_rofiles = path != NULL;
}
@@ -800,7 +800,7 @@ builder_context_enable_rofiles (BuilderContext *self,
g_autoptr(GFile) rofiles_base = NULL;
g_autoptr(GFile) rofiles_dir = NULL;
g_autofree char *tmpdir_name = NULL;
- char *argv[] = { "rofiles-fuse",
+ char *argv[] = { "@rofilesfuse@",
"-o",
"kernel_cache,entry_timeout=60,attr_timeout=60,splice_write,splice_move",
(char *)flatpak_file_get_path_cached (self->app_dir),
diff --git a/src/builder-git.c b/src/builder-git.c
index ef517adb..6ab095f0 100644
--- a/src/builder-git.c
+++ b/src/builder-git.c
@@ -44,7 +44,7 @@ git (GFile *dir,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (dir, output, flags, error, "git", ap);
+ res = flatpak_spawn (dir, output, flags, error, "@git@", ap);
va_end (ap);
return res;
@@ -58,7 +58,7 @@ cp (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "cp", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@cp@", ap);
va_end (ap);
return res;
diff --git a/src/builder-source-archive.c b/src/builder-source-archive.c
index 3c694e57..0de62318 100644
--- a/src/builder-source-archive.c
+++ b/src/builder-source-archive.c
@@ -443,7 +443,7 @@ tar (GFile *dir,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (dir, NULL, 0, error, "tar", ap);
+ res = flatpak_spawn (dir, NULL, 0, error, "@tar@", ap);
va_end (ap);
return res;
@@ -458,7 +458,7 @@ unzip (GFile *dir,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (dir, NULL, 0, error, "unzip", ap);
+ res = flatpak_spawn (dir, NULL, 0, error, "@unzip@", ap);
va_end (ap);
return res;
@@ -483,7 +483,7 @@ unrpm (GFile *dir,
GError **error)
{
gboolean res;
- const gchar *argv[] = { "sh", "-c", "rpm2cpio \"$1\" | cpio -i -d",
+ const gchar *argv[] = { "sh", "-c", "@rpm2cpio@ \"$1\" | @cpio@ -i -d",
"sh", /* shell's $0 */
rpm_path, /* shell's $1 */
NULL };
@@ -631,7 +631,7 @@ git (GFile *dir,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (dir, NULL, 0, error, "git", ap);
+ res = flatpak_spawn (dir, NULL, 0, error, "@git@", ap);
va_end (ap);
return res;
diff --git a/src/builder-source-bzr.c b/src/builder-source-bzr.c
index ceeec94a..8abe6f53 100644
--- a/src/builder-source-bzr.c
+++ b/src/builder-source-bzr.c
@@ -124,7 +124,7 @@ bzr (GFile *dir,
gboolean res;
va_list ap;
- brz = g_find_program_in_path ("brz");
+ brz = g_find_program_in_path ("@brz@");
va_start (ap, error);
res = flatpak_spawn (dir, output, 0, error, brz ? brz : "bzr", ap);
diff --git a/src/builder-source-patch.c b/src/builder-source-patch.c
index 8721e1e4..d7f4d840 100644
--- a/src/builder-source-patch.c
+++ b/src/builder-source-patch.c
@@ -247,15 +247,15 @@ patch (GFile *dir,
args = g_ptr_array_new ();
if (use_git) {
- g_ptr_array_add (args, "git");
+ g_ptr_array_add (args, "@git@");
g_ptr_array_add (args, "apply");
g_ptr_array_add (args, "-v");
} else if (use_git_am) {
- g_ptr_array_add (args, "git");
+ g_ptr_array_add (args, "@git@");
g_ptr_array_add (args, "am");
g_ptr_array_add (args, "--keep-cr");
} else {
- g_ptr_array_add (args, "patch");
+ g_ptr_array_add (args, "@patch@");
}
for (i = 0; extra_options != NULL && extra_options[i] != NULL; i++)
g_ptr_array_add (args, (gchar *) extra_options[i]);
diff --git a/src/builder-utils.c b/src/builder-utils.c
index f1c06db5..2e3347c5 100644
--- a/src/builder-utils.c
+++ b/src/builder-utils.c
@@ -149,7 +149,7 @@ strip (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "strip", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@strip@", ap);
va_end (ap);
return res;
@@ -163,7 +163,7 @@ eu_strip (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "eu-strip", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@eustrip@", ap);
va_end (ap);
return res;
@@ -177,7 +177,7 @@ eu_elfcompress (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "eu-elfcompress", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@euelfcompress@", ap);
va_end (ap);
return res;

View file

@ -0,0 +1,111 @@
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -301,7 +301,7 @@
}
skip_without_python2 () {
- if ! test -f /usr/bin/python2 || ! /usr/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then
+ if ! test -f @python2@/bin/python2 || ! @python2@/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then
echo "1..0 # SKIP this test requires /usr/bin/python2 (2.7) support"
exit 0
fi
--- 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,73 +36,28 @@
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
- if test $i == python2; then
- mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload
- # This is a hardcoded minimal set of modules we need in the current tests.
- # Pretty hacky stuff. Add modules as needed.
- PYDIR=/usr/lib/python2.7
- if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi
- for py in site os stat posixpath genericpath warnings \
- linecache types UserDict abc _abcoll \
- _weakrefset copy_reg traceback sysconfig \
- re sre_compile sre_parse sre_constants \
- _sysconfigdata ; do
- cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7
- done
- # These might not exist, depending how Python was configured; and the
- # part after ${so} might be "module" or ".x86_64-linux-gnu" or
- # something else
- for so in _locale strop ; do
- cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || :
- done
- for plat in $( cd ${PYDIR} && echo plat-* ); do
- test -e ${PYDIR}/${plat} || continue
- mkdir -p ${DIR}/usr/lib/python2.7/${plat}
- cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/
- done
- fi
-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}

View file

@ -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