Title: [259864] trunk/Tools
Revision
259864
Author
ph...@webkit.org
Date
2020-04-10 04:06:46 -0700 (Fri, 10 Apr 2020)

Log Message

[Flatpak SDK] Flatpak build broken when using 'git config core.webkitbranchbuild=true'
https://bugs.webkit.org/show_bug.cgi?id=210292

Reviewed by Žan Doberšek.

* Scripts/webkitdirs.pm:
(getUserFlatpakPath): Ensure we probe for UserFlatpak always in
WebKitBuild, wether we're doing a "git branch" build or not.
* flatpak/flatpakutils.py:
(WebkitFlatpak.is_branch_build):
(WebkitFlatpak.run_in_sandbox): Make and bind-mount default build
directory only when not doing "git branch" builds.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (259863 => 259864)


--- trunk/Tools/ChangeLog	2020-04-10 11:04:47 UTC (rev 259863)
+++ trunk/Tools/ChangeLog	2020-04-10 11:06:46 UTC (rev 259864)
@@ -1,5 +1,20 @@
 2020-04-10  Philippe Normand  <pnorm...@igalia.com>
 
+        [Flatpak SDK] Flatpak build broken when using 'git config core.webkitbranchbuild=true'
+        https://bugs.webkit.org/show_bug.cgi?id=210292
+
+        Reviewed by Žan Doberšek.
+
+        * Scripts/webkitdirs.pm:
+        (getUserFlatpakPath): Ensure we probe for UserFlatpak always in
+        WebKitBuild, wether we're doing a "git branch" build or not.
+        * flatpak/flatpakutils.py:
+        (WebkitFlatpak.is_branch_build):
+        (WebkitFlatpak.run_in_sandbox): Make and bind-mount default build
+        directory only when not doing "git branch" builds.
+
+2020-04-10  Philippe Normand  <pnorm...@igalia.com>
+
         [Flatpak SDK] Generate one IceCC archive per toolchain
         https://bugs.webkit.org/show_bug.cgi?id=210189
 

Modified: trunk/Tools/Scripts/webkitdirs.pm (259863 => 259864)


--- trunk/Tools/Scripts/webkitdirs.pm	2020-04-10 11:04:47 UTC (rev 259863)
+++ trunk/Tools/Scripts/webkitdirs.pm	2020-04-10 11:06:46 UTC (rev 259864)
@@ -2052,7 +2052,12 @@
 
 sub getUserFlatpakPath()
 {
-    my @flatpakPath = File::Spec->splitdir(baseProductDir());
+    my $productDir = baseProductDir();
+    if (isGit() && isGitBranchBuild() && gitBranch()) {
+        my $branch = gitBranch();
+        $productDir =~ s/$branch//;
+    }
+    my @flatpakPath = File::Spec->splitdir($productDir);
     push(@flatpakPath, "UserFlatpak");
     return File::Spec->catdir(@flatpakPath);
 }

Modified: trunk/Tools/flatpak/flatpakutils.py (259863 => 259864)


--- trunk/Tools/flatpak/flatpakutils.py	2020-04-10 11:04:47 UTC (rev 259863)
+++ trunk/Tools/flatpak/flatpakutils.py	2020-04-10 11:06:46 UTC (rev 259864)
@@ -557,6 +557,19 @@
 
         return [os.path.join(gst_dir, 'gst-env.py'), '--builddir', gst_builddir, '--srcdir', gst_dir]
 
+    def is_branch_build(self):
+        git_branch_name = subprocess.check_output(("git", "rev-parse", "--abbrev-ref", "HEAD")).decode("utf-8").strip()
+        for option_name in ("branch.%s.webKitBranchBuild" % git_branch_name,
+                            "webKitBranchBuild"):
+            try:
+                output = subprocess.check_output(("git", "config", "--bool", option_name)).strip()
+            except subprocess.CalledProcessError:
+                continue
+
+            if output == "true":
+                return True
+        return False
+
     def run_in_sandbox(self, *args, **kwargs):
         self.setup_builddir(stdout=kwargs.get("stdout", sys.stdout))
         cwd = kwargs.pop("cwd", None)
@@ -596,7 +609,7 @@
                            "--bind-mount=/run/systemd/journal=/run/systemd/journal",
                            "--bind-mount=%s=%s" % (self.sandbox_source_root, self.source_root)]
 
-        if args and args[0].endswith("build-webkit"):
+        if args and args[0].endswith("build-webkit") and not self.is_branch_build():
             # Ensure self.build_path exists.
             try:
                 os.makedirs(self.build_path)
@@ -606,8 +619,9 @@
 
         # We mount WebKitBuild/PORTNAME/BuildType to /app/webkit/WebKitBuild/BuildType
         # so we can build WPE and GTK in a same source tree.
-        # The bind-mount is always needed, not only when running build-webkit.
-        flatpak_command.append("--bind-mount=%s=%s" % (sandbox_build_path, self.build_path))
+        # The bind-mount is always needed, excepted during the initial setup (SDK install/updates).
+        if os.path.isdir(self.build_path):
+            flatpak_command.append("--bind-mount=%s=%s" % (sandbox_build_path, self.build_path))
 
         forwarded = {
             "WEBKIT_TOP_LEVEL": "/app/",
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to