[systemd-commits] 3 commits - configure.ac Makefile.am src/libsystemd-terminal TODO tools/compile-unifont.py

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Mon Jan 26 20:56:56 PST 2015


 Makefile.am                        |   10 ++-------
 TODO                               |    2 -
 configure.ac                       |   15 ++++++++++---
 dev/null                           |binary
 src/libsystemd-terminal/.gitignore |    1 
 tools/compile-unifont.py           |   41 +++++++++++++++++++------------------
 6 files changed, 38 insertions(+), 31 deletions(-)

New commits:
commit 2a481c84561d6c8ce37d75cc334f7c149ffb2bb9
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Jan 26 23:19:14 2015 -0500

    compile-unifont: Python 2 compatibility
    
    Under Python 2, sys.stdout.buffer is missing.

diff --git a/tools/compile-unifont.py b/tools/compile-unifont.py
index 7004b94..5464c53 100755
--- a/tools/compile-unifont.py
+++ b/tools/compile-unifont.py
@@ -31,6 +31,9 @@ import struct
 # Write "bits" array as binary output.
 #
 
+
+write = getattr(sys.stdout, 'buffer', sys.stdout).write
+
 def write_bin_entry(entry):
     l = len(entry)
     if l != 32 and l != 64:
@@ -39,10 +42,10 @@ def write_bin_entry(entry):
     elif l < 64:
         entry += "0" * (64 - l)
 
-    sys.stdout.buffer.write(struct.pack('B', int(l / 32)))  # width
-    sys.stdout.buffer.write(struct.pack('B', 0))            # padding
-    sys.stdout.buffer.write(struct.pack('H', 0))            # padding
-    sys.stdout.buffer.write(struct.pack('I', 0))            # padding
+    write(struct.pack('B', int(l / 32)))  # width
+    write(struct.pack('B', 0))            # padding
+    write(struct.pack('H', 0))            # padding
+    write(struct.pack('I', 0))            # padding
 
     i = 0
     for j in range(0, 16):
@@ -53,23 +56,23 @@ def write_bin_entry(entry):
                 c = int(entry[i:i+2], 16)
                 i += 2
 
-            sys.stdout.buffer.write(struct.pack('B', c))
+            write(struct.pack('B', c))
 
 def write_bin(bits):
-    sys.stdout.buffer.write(struct.pack('B', 0x44))         # ASCII: 'D'
-    sys.stdout.buffer.write(struct.pack('B', 0x56))         # ASCII: 'V'
-    sys.stdout.buffer.write(struct.pack('B', 0x44))         # ASCII: 'D'
-    sys.stdout.buffer.write(struct.pack('B', 0x48))         # ASCII: 'H'
-    sys.stdout.buffer.write(struct.pack('B', 0x52))         # ASCII: 'R'
-    sys.stdout.buffer.write(struct.pack('B', 0x4d))         # ASCII: 'M'
-    sys.stdout.buffer.write(struct.pack('B', 0x55))         # ASCII: 'U'
-    sys.stdout.buffer.write(struct.pack('B', 0x46))         # ASCII: 'F'
-    sys.stdout.buffer.write(struct.pack('<I', 0))           # compatible-flags
-    sys.stdout.buffer.write(struct.pack('<I', 0))           # incompatible-flags
-    sys.stdout.buffer.write(struct.pack('<I', 32))          # header-size
-    sys.stdout.buffer.write(struct.pack('<H', 8))           # glyph-header-size
-    sys.stdout.buffer.write(struct.pack('<H', 2))           # glyph-stride
-    sys.stdout.buffer.write(struct.pack('<Q', 32))          # glyph-body-size
+    write(struct.pack('B', 0x44))         # ASCII: 'D'
+    write(struct.pack('B', 0x56))         # ASCII: 'V'
+    write(struct.pack('B', 0x44))         # ASCII: 'D'
+    write(struct.pack('B', 0x48))         # ASCII: 'H'
+    write(struct.pack('B', 0x52))         # ASCII: 'R'
+    write(struct.pack('B', 0x4d))         # ASCII: 'M'
+    write(struct.pack('B', 0x55))         # ASCII: 'U'
+    write(struct.pack('B', 0x46))         # ASCII: 'F'
+    write(struct.pack('<I', 0))           # compatible-flags
+    write(struct.pack('<I', 0))           # incompatible-flags
+    write(struct.pack('<I', 32))          # header-size
+    write(struct.pack('<H', 8))           # glyph-header-size
+    write(struct.pack('<H', 2))           # glyph-stride
+    write(struct.pack('<Q', 32))          # glyph-body-size
 
     # write glyphs
     for idx in range(len(bits)):

commit 10bc4cd469fc677892b07748ec85804ca120825f
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Jan 26 19:12:56 2015 -0500

    build-sys: unbundle unifont
    
    We should prefer the unifont.hex file from the system, instead of our
    own. Upstream has made a few releases since our version was included,
    and we should follow upstream changes. But adding 2.6MB to our source
    repo every time upstream releases is not nice.

diff --git a/Makefile.am b/Makefile.am
index c463f23..f42f132 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3326,7 +3326,7 @@ noinst_PROGRAMS += \
 	systemd-subterm
 
 dist_pkgdata_DATA += \
-	src/libsystemd-terminal/unifont-glyph-array.bin
+       src/libsystemd-terminal/unifont-glyph-array.bin
 
 nodist_userunit_DATA += \
 	units/user/systemd-consoled.service
@@ -3454,12 +3454,8 @@ test_unifont_LDADD = \
 	libsystemd-internal.la \
 	libsystemd-shared.la
 
-.PHONY: update-unifont
-update-unifont: tools/compile-unifont.py
-	$(AM_V_GEN)$(PYTHON) $< \
-		<$(top_srcdir)/src/libsystemd-terminal/unifont.hex \
-		>$(top_srcdir)/src/libsystemd-terminal/unifont-glyph-array.bin
-	@echo "unifont-glyph-array.bin has been regenerated"
+src/libsystemd-terminal/unifont-glyph-array.bin: tools/compile-unifont.py $(UNIFONT)
+	$(AM_V_GEN)$(PYTHON) $< <$(UNIFONT) >$@
 
 # ------------------------------------------------------------------------------
 if ENABLE_GTK_DOC
diff --git a/configure.ac b/configure.ac
index 12e4ab2..cf19681 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1142,16 +1142,25 @@ fi
 AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
 
 # ------------------------------------------------------------------------------
+AC_ARG_WITH(unifont,
+        AS_HELP_STRING([--with-unifont=PATH],
+                [Path to unifont.hex]),
+        [UNIFONT="$withval"],
+        [UNIFONT="/usr/share/unifont/unifont.hex"])
+AC_SUBST(UNIFONT)
+
 have_terminal=no
+have_unifont=no
 AC_ARG_ENABLE(terminal, AS_HELP_STRING([--enable-terminal], [enable terminal support]))
 if test "x$enable_terminal" = "xyes"; then
         PKG_CHECK_MODULES([TERMINAL], [ libevdev >= 1.2 xkbcommon >= 0.5 libdrm >= 2.4], [have_terminal=yes])
-        AS_IF([test "x$have_terminal" != xyes -a "x$enable_terminal" = xyes],
+        AC_CHECK_FILE($UNIFONT, [have_unifont=yes])
+        AS_IF([test "x$have_terminal" != xyes -o "x$have_unifont" != "xyes" -a "x$enable_terminal" = xyes],
               [AC_MSG_ERROR([*** terminal support requested but required dependencies not available])],
-              [test "x$have_terminal" = xyes],
+              [test "x$have_terminal" = xyes -a "x$have_unifont" = "xyes"],
               [AC_DEFINE(ENABLE_TERMINAL, 1, [Define if terminal support is to be enabled])])
 fi
-AM_CONDITIONAL(ENABLE_TERMINAL, [test "x$have_terminal" = "xyes"])
+AM_CONDITIONAL(ENABLE_TERMINAL, [test "x$have_terminal" = "xyes" -a "x$have_unifont" = "xyes"])
 
 # ------------------------------------------------------------------------------
 have_kdbus=no
diff --git a/src/libsystemd-terminal/.gitignore b/src/libsystemd-terminal/.gitignore
new file mode 100644
index 0000000..7de83bd
--- /dev/null
+++ b/src/libsystemd-terminal/.gitignore
@@ -0,0 +1 @@
+/unifont-glyph-array.bin
diff --git a/src/libsystemd-terminal/unifont-glyph-array.bin b/src/libsystemd-terminal/unifont-glyph-array.bin
deleted file mode 100644
index 46f150c..0000000
Binary files a/src/libsystemd-terminal/unifont-glyph-array.bin and /dev/null differ

commit 4a84f3e61434cdc52f91477d7fd937600159e4f1
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Jan 26 18:12:45 2015 -0500

    TODO: remove laccess conversion
    
    I looked over all access invocations, and I think are using access()
    correctly. Accepting dangling symlinks makes sense only in special
    circumstances.
    
    So far we do not allow "flag" files like "/fastboot" to be dangling
    symlinks. We could, but I don't see a reason to.

diff --git a/TODO b/TODO
index c87469a..62f673b 100644
--- a/TODO
+++ b/TODO
@@ -67,8 +67,6 @@ Features:
 
 * Port various tools to make use of verbs.[ch], where applicable
 
-* Check all invocations of access() and consider turning them into laccess()
-
 * "machinectl history"
 
 * "machinectl diff"



More information about the systemd-commits mailing list