2
0
Fork 0

Patch Genode sources per-package

Avoid cross package rebuilds when patching. Remove init schema
validation, as its not worth patching.
This commit is contained in:
Ehmry - 2020-04-08 19:20:54 +05:30
parent ed3cf7f063
commit 7a04959417
8 changed files with 29 additions and 86 deletions

View File

@ -47,9 +47,6 @@ in nixpkgs.writeScriptBin "hw-image" (with nixpkgs.buildPackages;
${apps.dhall.program} text \ ${apps.dhall.program} text \
<<< "(env:DHALL_GENODE).Init.render ($@).config" \ <<< "(env:DHALL_GENODE).Init.render ($@).config" \
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \
-schema ${packages.genodeSources}/repos/os/src/init/config.xsd - \
| sed 's/&gt;/>/g' \
> $TMPDIR/config > $TMPDIR/config
${apps.dhall.program} \ ${apps.dhall.program} \

View File

@ -20,9 +20,6 @@ in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
${apps.dhall.program} text \ ${apps.dhall.program} text \
<<< "(env:DHALL_GENODE).Init.render ($@).config" \ <<< "(env:DHALL_GENODE).Init.render ($@).config" \
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \
-schema ${packages.genodeSources}/repos/os/src/init/config.xsd - \
| sed 's/&gt;/>/g' \
> $TMPDIR/config > $TMPDIR/config
${apps.dhall.program} text \ ${apps.dhall.program} text \

View File

@ -8,9 +8,6 @@ nixpkgs.writeScriptBin "render-init" (with nixpkgs.buildPackages; ''
export DHALL_GENODE=''${DHALL_GENODE:-${packages.dhallGenode}/source.dhall} export DHALL_GENODE=''${DHALL_GENODE:-${packages.dhallGenode}/source.dhall}
${apps.dhall.program} text \ ${apps.dhall.program} text \
<<< "(env:DHALL_GENODE).Init.render ($(cat))" \ <<< "(env:DHALL_GENODE).Init.render ($(cat))" \
| ${nixpkgs.buildPackages.libxml2}/bin/xmllint \ | ${nixpkgs.buildPackages.libxml2}/bin/xmllint -format - \
-format \
-schema ${packages.genodeSources}/repos/os/src/init/config.xsd \
- \
| sed 's/&gt;/>/g' | sed 's/&gt;/>/g'
'') '')

View File

@ -39,13 +39,6 @@ in rec {
dhall to-directory-tree --output $out \ dhall to-directory-tree --output $out \
<<< "${./compile-boot.dhall} (${bootDhall}) \"$out\"" <<< "${./compile-boot.dhall} (${bootDhall}) \"$out\""
substituteInPlace "$out/modules_asm" \
--replace '.incbin "./config"' ".incbin \"$out/config\""
${buildPackages.libxml2}/bin/xmllint \
-schema ${testPkgs.genodeSources}/repos/os/src/init/config.xsd \
-noout $out/config
''; '';
novaImage = name: env: boot: novaImage = name: env: boot:

View File

@ -46,6 +46,7 @@ in depotPkgs // {
KERNEL = "hw"; KERNEL = "hw";
BOARD = "pc"; BOARD = "pc";
targets = [ "bootstrap" "core" "timer" "lib/ld" ]; targets = [ "bootstrap" "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
postInstall = '' postInstall = ''
mv $out/core-hw-pc.o $coreObj mv $out/core-hw-pc.o $coreObj
mv $out/bootstrap-hw-pc.o $bootstrapObj mv $out/bootstrap-hw-pc.o $bootstrapObj
@ -58,6 +59,7 @@ in depotPkgs // {
name = "base-linux"; name = "base-linux";
KERNEL = "linux"; KERNEL = "linux";
targets = [ "core" "timer" "lib/ld" ]; targets = [ "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
postInstall = '' postInstall = ''
mkdir -p $out/lib mkdir -p $out/lib
mv $out/ld-linux.lib.so $out/lib/ld.lib.so mv $out/ld-linux.lib.so $out/lib/ld.lib.so
@ -71,6 +73,7 @@ in depotPkgs // {
outputs = [ "out" "coreObj" ]; outputs = [ "out" "coreObj" ];
KERNEL = "nova"; KERNEL = "nova";
targets = [ "core" "timer" "lib/ld" ]; targets = [ "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
postInstall = '' postInstall = ''
mv $out/core-nova.o $coreObj mv $out/core-nova.o $coreObj
mv $out/ld-nova.lib.so $out/ld.lib.so mv $out/ld-nova.lib.so $out/ld.lib.so

View File

@ -27,8 +27,6 @@ let
}; };
nativeBuildInputs = [ expect gnumake tcl ]; nativeBuildInputs = [ expect gnumake tcl ];
patches =
[ ./init.xsd.patch ./openssl.patch ./svn-trust-server-cert.patch ];
configurePhase = '' configurePhase = ''
patchShebangs ./tool patchShebangs ./tool
substituteInPlace repos/base/etc/tools.conf \ substituteInPlace repos/base/etc/tools.conf \
@ -54,13 +52,15 @@ let
throw "unknown Genode arch for platform ${platform.system}"; throw "unknown Genode arch for platform ${platform.system}";
preparePort = name: preparePort = name:
{ hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", ... }@args: { hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
stdenvNoCC.mkDerivation (args // { , patches ? [ ], ... }@args:
let havePatches = patches != [ ];
in stdenvNoCC.mkDerivation (args // {
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = hash; outputHash = hash;
pname = name; pname = name;
inherit (genodeSources) version; inherit (genodeSources) version;
GENODE_DIR = genodeSources; inherit patches;
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
VERBOSE = ""; VERBOSE = "";
@ -69,7 +69,9 @@ let
impureEnvVars = stdenv'.lib.fetchers.proxyImpureEnvVars impureEnvVars = stdenv'.lib.fetchers.proxyImpureEnvVars
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ]; ++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
dontUnpack = true; src = if havePatches then genodeSources else null;
dontUnpack = !havePatches;
dontConfigure = true; dontConfigure = true;
nativeBuildInputs = nativeBuildInputs =
@ -81,6 +83,7 @@ let
'' ''
runHook preBuild runHook preBuild
export CONTRIB_DIR=$NIX_BUILD_TOP/contrib export CONTRIB_DIR=$NIX_BUILD_TOP/contrib
export GENODE_DIR=${if havePatches then "$(pwd)" else genodeSources}
mkdir $CONTRIB_DIR mkdir $CONTRIB_DIR
$GENODE_DIR/tool/ports/prepare_port $pname CHECK_HASH=no $GENODE_DIR/tool/ports/prepare_port $pname CHECK_HASH=no
runHook postBuild runHook postBuild
@ -106,15 +109,16 @@ let
(import ./ports.nix { inherit buildPackages; }); (import ./ports.nix { inherit buildPackages; });
buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ] buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ]
, enableParallelBuilding ? true, ... }@extraAttrs: , patches ? [ ], enableParallelBuilding ? true, ... }@extraAttrs:
let havePatches = patches != [ ];
stdenv'.mkDerivation (extraAttrs // { in stdenv'.mkDerivation (extraAttrs // {
pname = name; pname = name;
inherit (genodeSources) version; inherit (genodeSources) version;
inherit targets enableParallelBuilding; inherit targets patches enableParallelBuilding;
dontUnpack = true; src = if havePatches then genodeSources else null;
GENODE_DIR = genodeSources; dontUnpack = !havePatches;
nativeBuildInputs = [ binutils bison flex stdenv.cc tcl which ] nativeBuildInputs = [ binutils bison flex stdenv.cc tcl which ]
++ nativeBuildInputs; ++ nativeBuildInputs;
@ -125,15 +129,17 @@ let
in '' in ''
runHook preConfigure runHook preConfigure
export CONTRIB_DIR=$NIX_BUILD_TOP/contrib export CONTRIB_DIR=$NIX_BUILD_TOP/contrib
export BUILD_DIR=$NIX_BUILD_TOP/build export BUILD_DIR=$(pwd)/build
export GENODE_DIR=${if havePatches then "$(pwd)" else genodeSources}
$GENODE_DIR/tool/create_builddir ${arch} $GENODE_DIR/tool/create_builddir ${arch}
substituteInPlace build/etc/build.conf \ substituteInPlace $BUILD_DIR/etc/build.conf \
--replace "#REPOSITORIES" "REPOSITORIES" --replace "#REPOSITORIES" "REPOSITORIES"
mkdir $CONTRIB_DIR; ${linkPorts} mkdir $CONTRIB_DIR; ${linkPorts}
runHook postConfigure runHook postConfigure
''; '';
makeFlags = [ "-C build" ] ++ targets; makeFlags = [ "-C build" "VERBOSE=" ] ++ targets;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View File

@ -1,54 +0,0 @@
commit c0a6db17001fb088d3289613a02660d8725bbde8
Author: Emery Hemingway <ehmry@posteo.net>
Date: Sat Feb 22 15:40:56 2020 +0100
Update Init config schema
- Add <exit propagate="…"/> to the Init schema
- Use a relative path for base_types.xsd
- Allow empty <provides/> nodes
- Allow "label" attributes within <parent-provides/>
diff --git a/repos/os/src/init/config.xsd b/repos/os/src/init/config.xsd
index 938dcdb8fb..e7bfb5dfc5 100644
--- a/repos/os/src/init/config.xsd
+++ b/repos/os/src/init/config.xsd
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:include schemaLocation="base_types.xsd"/>
+ <xs:include schemaLocation="../../../base/xsd/base_types.xsd"/>
<xs:complexType name="template_service">
<xs:choice minOccurs="1" maxOccurs="3">
@@ -90,6 +90,7 @@
<xs:element name="service" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="label" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
@@ -160,6 +161,12 @@
</xs:complexType>
</xs:element> <!-- "resource" -->
+ <xs:element name="exit">
+ <xs:complexType>
+ <xs:attribute name="propagate" type="Boolean" />
+ </xs:complexType>
+ </xs:element> <!-- "exit" -->
+
<xs:element name="configfile">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
@@ -168,7 +175,7 @@
<xs:element name="provides">
<xs:complexType>
- <xs:choice maxOccurs="unbounded">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="service">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />

View File

@ -7,6 +7,7 @@ with buildPackages; {
dde_rump = { dde_rump = {
hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI="; hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI=";
nativeBuildInputs = [ subversion ]; nativeBuildInputs = [ subversion ];
patches = [ ./svn-trust-server-cert.patch ];
}; };
expat.hash = "sha256-6Kz8qHmSg9/r+o3UJX8ZyB5aDjmfrbsUW/TppbB16jk="; expat.hash = "sha256-6Kz8qHmSg9/r+o3UJX8ZyB5aDjmfrbsUW/TppbB16jk=";
jitterentropy.hash = "sha256-6KS732GxtUMz0xPYKtshdn039DgdJq11vTDQesZn4Ds="; jitterentropy.hash = "sha256-6KS732GxtUMz0xPYKtshdn039DgdJq11vTDQesZn4Ds=";
@ -26,7 +27,10 @@ with buildPackages; {
nativeBuildInputs = [ python ]; nativeBuildInputs = [ python ];
}; };
mupdf.hash = "sha256-+Q4IwYGLynoud2IEsKGfZQjpPRV6wFv5iI/ReAKBZcM="; mupdf.hash = "sha256-+Q4IwYGLynoud2IEsKGfZQjpPRV6wFv5iI/ReAKBZcM=";
openssl.hash = "sha256-F0olTWYUwD//eJZ14ibN/IvbFXw3WQUZ/6cPI3lsxZI="; openssl = {
hash = "sha256-F0olTWYUwD//eJZ14ibN/IvbFXw3WQUZ/6cPI3lsxZI=";
patches = [ ./openssl.patch ];
};
qemu-usb.hash = "sha256-F4ZXeH5sx3FOcD42zFOxKFMsqGookKdav1NJ7YgVw98="; qemu-usb.hash = "sha256-F4ZXeH5sx3FOcD42zFOxKFMsqGookKdav1NJ7YgVw98=";
stb.hash = "sha256-9LSH1i8jcEvjRAmTvgtK+Axy9hO7uiSzmSgBvs0zkTc="; stb.hash = "sha256-9LSH1i8jcEvjRAmTvgtK+Axy9hO7uiSzmSgBvs0zkTc=";
stdcxx.hash = "sha256-U5/+yUBXQ+rKmy6hP7OomIU4g2KvSn2qTltQFzNz9Wo="; stdcxx.hash = "sha256-U5/+yUBXQ+rKmy6hP7OomIU4g2KvSn2qTltQFzNz9Wo=";