Merge branch 'master' into deploy.spirit
authorMark Wooding <mdw@distorted.org.uk>
Sun, 19 Apr 2020 17:51:46 +0000 (18:51 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 19 Apr 2020 17:51:46 +0000 (18:51 +0100)
* master:
  src/jobclient.c: Cope if the jobserver pipe is set nonblocking.
  bin/chroot-maint: Force `--no-merged-usr'.
  bin/chroot-maint: Update the path correctly when following a symlink.
  bin/chroot-maint: Don't forget to copy symlinks to directories.

bin/chroot-maint
src/jobclient.c

index 2f91e9c..6202f49 100755 (executable)
@@ -1944,7 +1944,7 @@ class ChrootJob (BaseJob):
             continue
           ff.append(f)
           path = OS.path.join(dir, f)
-          if not OS.path.isdir(path): examine(path)
+          if OS.path.islink(path) or not OS.path.isdir(path): examine(path)
         files[:] = ff
       OS.path.walk(crossdir, visit, None)
       OS.path.walk(OS.path.join(crossdir, "TOOLCHAIN", gnuarch),
@@ -2116,7 +2116,7 @@ class ChrootJob (BaseJob):
 
         ## Install the base system.
         progress("install base system")
-        run_root(["eatmydata", "debootstrap"] +
+        run_root(["eatmydata", "debootstrap", "--no-merged-usr"] +
                  (arch in C.FOREIGN_ARCHS and ["--foreign"] or []) +
                  ["--arch=" + arch, "--variant=minbase",
                   "--include=" + ",".join(C.BASE_PACKAGES),
@@ -2375,7 +2375,7 @@ class CrossToolsJob (BaseJob):
               try: dest = dest[:dest.rindex("/")]
               except ValueError: dest = ""
             if path == "": path = link
-            else: path = "%s/%s" % (path, link)
+            else: path = "%s/%s" % (link, path)
 
       ## Work through the shopping list, copying the things it names into the
       ## cross-tools tree.
index bc8d858..02141d4 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/select.h>
 #include <unistd.h>
 
 #define PY_SSIZE_T_CLEAN
@@ -52,6 +53,7 @@ static PyObject *pymeth_jobclient(PyObject *me, PyObject *arg)
   PyObject *rc = 0;
   struct sigaction sa, oldsa;
   sigset_t mask, oldmask;
+  fd_set infd;
   int rstrchld = 0;
   int fd, sfd;
   int kid, st;
@@ -101,7 +103,11 @@ again:
    * like this happens, then we go back and try reaping children again.
    */
   Py_BEGIN_ALLOW_THREADS
-  n = read(sigfd, &ch, 1);
+  for (;;) {
+    n = read(sigfd, &ch, 1); if (n >= 0 || errno != EAGAIN) break;
+    FD_ZERO(&infd); FD_SET(sigfd, &infd);
+    n = select(sigfd + 1, &infd, 0, 0, 0); if (n < 0) break;
+  }
   Py_END_ALLOW_THREADS
   if (n == 1) rc = Py_BuildValue("(cOO)", ch, Py_None, Py_None);
   else if (!n) rc = Py_BuildValue("(sOO)", "", Py_None, Py_None);