Skip to contentSkip to conversation

xen/build: Remove hacked up version of figlet

PATCH In review Andrew Cooper 5 participants 11 messages Sep 12, 2013 – Oct 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/build: Remove hacked up version of figlet

This hacked up version of figlet contributes a supprisingly large proportion of the Coverity issues found under xen/ (and therefore attributed against Xen)

Figlet can be found in all distros, so make use of it.

We keep xen.flf (being the Xen figlet font) and replace the hacked up octal transform with a short python script.

The Xen Makefile has been tweaked in such a way that it still prints the figlet banner for the build.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
---
 .gitignore                     |    3 -
 xen/Makefile                   |   14 +-
 xen/tools/Makefile             |    2 -
 xen/tools/fig-to-oct.py        |   18 +
 xen/tools/figlet/LICENSE       |  111 ---
 xen/tools/figlet/Makefile      |    9 -
 xen/tools/figlet/README        |    9 -
 xen/tools/figlet/figlet.c      | 2076 ----------------------------------------
 xen/tools/{figlet => }/xen.flf |    0
 9 files changed, 22 insertions(+), 2220 deletions(-)
 create mode 100644 xen/tools/fig-to-oct.py
 delete mode 100644 xen/tools/figlet/LICENSE
 delete mode 100644 xen/tools/figlet/Makefile
 delete mode 100644 xen/tools/figlet/README
 delete mode 100644 xen/tools/figlet/figlet.c
 rename xen/tools/{figlet => }/xen.flf (100%)
.gitignore +0 -3
index c82a372..02f9e27 100644
@@ -291,7 +291,6 @@ tools/xm-test/lib/XmTestLib/config.py
 tools/xm-test/lib/XmTestReport/xmtest.py
 tools/xm-test/tests/*.test
 tools/ocaml-xenstored*
-xen/.banner*
 xen/System.map
 xen/arch/arm/asm-offsets.s
 xen/arch/arm/xen.lds
@@ -314,9 +313,7 @@ xen/include/linux
 xen/include/public/public
 xen/include/xen/*.new
 xen/include/xen/acm_policy.h
-xen/include/xen/banner.h
 xen/include/xen/compile.h
-xen/tools/figlet/figlet
 xen/tools/symbols
 xen/xsm/flask/include/av_perm_to_string.h
 xen/xsm/flask/include/av_permissions.h
xen/Makefile +4 -10
index 597972d..a3058f1 100644
@@ -86,7 +86,6 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
 	rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET)-syms *~ core
 	rm -f include/asm-*/asm-offsets.h
-	[ -d tools/figlet ] && rm -f .banner*
 
 .PHONY: _distclean
 _distclean: clean
@@ -113,14 +112,8 @@ delete-unfresh-files:
 		rm -f include/xen/compile.h; \
 	fi
 
-.banner: Makefile
-	$(MAKE) -C tools
-	@tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) 2>$@2 >$@1
-	@cat $@1 $@2 >$@
-	@rm -f $@1 $@2
-
 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
-include/xen/compile.h: include/xen/compile.h.in .banner
+include/xen/compile.h: include/xen/compile.h.in
 	@sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \
 	    -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \
 	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
@@ -132,8 +125,9 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
 	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
 	    < include/xen/compile.h.in > [email protected]
-	@grep \" .banner >> [email protected]
-	@grep -v \" .banner
+	@echo " Xen $(XEN_FULLVERSION)" | figlet -f tools/xen.flf | tee .banner
+	@python tools/fig-to-oct.py < .banner >> [email protected]
+	@rm -f .banner
 	@mv -f [email protected] $@
 
 include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
xen/tools/Makefile +0 -2
index 612e36d..e940939 100644
@@ -3,12 +3,10 @@ include $(XEN_ROOT)/Config.mk
 
 .PHONY: default
 default:
-	[ -d figlet ] && $(MAKE) -C figlet
 	$(MAKE) symbols
 
 .PHONY: clean
 clean:
-	[ -d figlet ] && $(MAKE) -C figlet clean
 	rm -f *.o symbols
 
 symbols: symbols.c
xen/tools/fig-to-oct.py new file +18 -0
new file mode 100644
index 0000000..db4fd32
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+import sys
+
+chars_per_line = 18
+chars_so_far = 0
+
+sys.stdout.write('"')
+
+for char in sys.stdin.read():
+
+    sys.stdout.write("\\%03o" % ord(char))
+    chars_so_far = chars_so_far + 1
+
+    if chars_so_far == chars_per_line:
+        chars_so_far = 0
+        sys.stdout.write('" \\\n"')
+
+sys.stdout.write('"\n')
xen/tools/figlet/LICENSE deleted +0 -111

111 lines not on this page · raw message

xen/tools/figlet/Makefile deleted +0 -9
deleted file mode 100644
index b1f1045..0000000
@@ -1,9 +0,0 @@
-
-include $(XEN_ROOT)/Config.mk
-
-figlet: figlet.c
-	$(HOSTCC) -o $@ $<
-
-.PHONY: clean
-clean:
-	rm -f *.o figlet
xen/tools/figlet/README deleted +0 -9
deleted file mode 100644
index b4c58b3..0000000
@@ -1,9 +0,0 @@
-
-NB. This is a very hacked version of Figlet 2.2.1. 
-
-Don't use this outside the Xen build system. A proper version of Figlet
-can be had from <http://www.figlet.org>.
-
-The distribution license is intact in the LICENSE file.
-
- -- Keir Fraser (2/5/2003)
xen/tools/figlet/figlet.c deleted +0 -2076

2,076 lines not on this page · raw message

xen/tools/xen.flf renamed from xen/tools/figlet/xen.flf +0 -0
similarity index 100%
rename from xen/tools/figlet/xen.flf
rename to xen/tools/xen.flf
Signature · 1 line
1.7.10.4
#1 lore raw

xen/Makefile include/xen/compile.h: include/xen/compile.h.in .banner · line 129

Quoted 1 line · Andrew Cooper
xen/Makefile +1 -0
+	@python tools/fig-to-oct.py < .banner >> [email protected]

I think you need $(PYTHON) here, else the NetBSD guys' builds stop working.

The rest looks good to me, assuming it produces the same output, but this is Keir's call.

Ian.

#2 lore raw
Quoted 11 lines · Ian Campbell

xen/Makefile include/xen/compile.h: include/xen/compile.h.in .banner · line 129

Quoted 1 line · Andrew Cooper
xen/Makefile +1 -0
+	@python tools/fig-to-oct.py < .banner >> [email protected]

I think you need $(PYTHON) here, else the NetBSD guys' builds stop working.

The rest looks good to me, assuming it produces the same output, but this is Keir's call.

Ian.

Oops yes - I shall tweak that, but avoid the gratuitous repost of the huge series.

~Andrew

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

This hacked up version of figlet contributes a supprisingly large proportion of the Coverity issues found under xen/ (and therefore attributed against Xen)

Figlet can be found in all distros, so make use of it.

We keep xen.flf (being the Xen figlet font) and replace the hacked up octal transform with a short python script.

The Xen Makefile has been tweaked in such a way that it still prints the figlet banner for the build.

Quoted 6 lines
CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
#4 lore raw
In reply to Andrew Cooper
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

This hacked up version of figlet contributes a supprisingly large proportion of the Coverity issues found under xen/ (and therefore attributed against Xen)

Figlet can be found in all distros, so make use of it.

None of the systems I checked (SLE10 and SLE11) have this installed, and I also don't know what package to look for. Which you can read as an almost definitive NAK from me. I also can't see why you can't just exclude xen/tools/ from the Coverity scan...

Jan

#5 lore raw
Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

This hacked up version of figlet contributes a supprisingly large proportion of the Coverity issues found under xen/ (and therefore attributed against Xen)

Figlet can be found in all distros, so make use of it.

None of the systems I checked (SLE10 and SLE11) have this installed, and I also don't know what package to look for.

rpm.pbone.net shows a figlet package in OpenSUSE but not SLE, although I don't know if it indexes them.

It's the sort of trivial package I can imagine not being in an enterprise distro.

Quoted 4 lines

Which
you can read as an almost definitive NAK from me. I also can't see why you can't just exclude xen/tools/ from the Coverity scan...

Or make the banner conditional on figlet's presence.

Ian.

#6 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper

This hacked up version of figlet contributes a supprisingly large

proportion

Quoted 3 lines
Quoted 3 lines

of the Coverity issues found under xen/ (and therefore attributed against Xen)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Figlet can be found in all distros, so make use of it.

None of the systems I checked (SLE10 and SLE11) have this installed, and I also don't know what package to look for.

rpm.pbone.net shows a figlet package in OpenSUSE but not SLE, although I don't know if it indexes them.

Of course I searched the package set for something containing "figlet" in some way, so no, it's not there, also not on the SDK.

Quoted 6 lines
Quoted 4 lines

Which
you can read as an almost definitive NAK from me. I also can't see why you can't just exclude xen/tools/ from the Coverity scan...

Or make the banner conditional on figlet's presence.

Yes, perhaps. Albeit the banner is quite useful as an easily recognizable separator in multi-session logs or other lumped together stuff. I'd be more agreeable to this if the whole change wasn't just to make a tool happy...

Jan

#7 lore raw
Quoted 10 lines · Jan Beulich
Quoted 6 lines
Quoted 4 lines

Which
you can read as an almost definitive NAK from me. I also can't see why you can't just exclude xen/tools/ from the Coverity scan...

Or make the banner conditional on figlet's presence.

Yes, perhaps. Albeit the banner is quite useful as an easily recognizable separator in multi-session logs or other lumped together stuff.

Pre-generated "Xen" figlet with the version beneath in normal characters?

Quoted 2 lines

I'd be more agreeable to this if the whole
change wasn't just to make a tool happy...

This is true...

#8 lore raw

Ian Campbell writes ("Re: [PATCH] xen/build: Remove hacked up version of figlet"):

Quoted 1 line · Jan Beulich

...

Quoted 4 lines
Quoted 2 lines

I'd be more agreeable to this if the whole
change wasn't just to make a tool happy...

This is true...

No, it isn't. That's just what prompted us to look at this.

When Ian C told me offline about this embedded copy of figlet I said WTF?!

We certainly shouldn't be carrying a hacked up version of figlet in the Xen tree. If there are systems without figlet then we should make its use conditional, as suggested. Those systems' users can then
(a) install figlet by hand (b) live without figleted banners (c) get this apparently useful utility into their distro.

Ian.

#9 lore raw
Quoted 11 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH] xen/build: Remove hacked up version of figlet"):

Quoted 1 line · Jan Beulich

...

Quoted 3 lines
Quoted 2 lines

I'd be more agreeable to this if the whole
change wasn't just to make a tool happy...

This is true...

No, it isn't. That's just what prompted us to look at this.

When Ian C told me offline about this embedded copy of figlet I said WTF?!

Quoted 7 lines

We certainly shouldn't be carrying a hacked up version of figlet in the Xen tree. If there are systems without figlet then we should make its use conditional, as suggested. Those systems' users can then
(a) install figlet by hand (b) live without figleted banners (c) get this apparently useful utility into their distro.

Ian.

Coverity aside, we really shouldn't have a hacked up version of figlet here.

How about this (just the makefile changes to safe sending a huge patch again)? It causes a lack of figlet in the build environment not to be fatal.

~Andrew

-----8<-----

xen/Makefile +1 -3
index 597972d..1ea2717 100644
@@ -86,7 +86,7 @@ _clean: delete-unfresh-files
        $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
        rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET)-syms *~ core
        rm -f include/asm-*/asm-offsets.h
-       [ -d tools/figlet ] && rm -f .banner*
+       rm -f .banner
 
 .PHONY: _distclean
 _distclean: clean
@@ -114,10 +114,12 @@ delete-unfresh-files:
        fi
 
 .banner: Makefile
-       $(MAKE) -C tools
-       @tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION)

2>$@2 >$@1

-       @cat $@1 $@2 >$@
-       @rm -f $@1 $@2
+       @if which figlet >/dev/null 2>&1 ; then \

+ echo " Xen $(XEN_FULLVERSION)" | figlet -f tools/xen.flf

Quoted 1 line

[email protected]; \

+ else \
+ echo " Xen $(XEN_FULLVERSION)" > [email protected]; \
+ fi
+ @mv -f [email protected] $@

 # compile.h contains dynamic build info. Rebuilt on every 'make'
invocation.
 include/xen/compile.h: include/xen/compile.h.in .banner
@@ -132,8 +134,8 @@ include/xen/compile.h: include/xen/compile.h.in .banner
            -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
            -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) ||
echo "unavailable")!g' \
            < include/xen/compile.h.in > [email protected]
-       @grep \" .banner >> [email protected]
-       @grep -v \" .banner
+       @cat .banner
+       @$(PYTHON) tools/fig-to-oct.py < .banner >> [email protected]
        @mv -f [email protected] $@

include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s

#10 lore raw

Andrew Cooper writes ("Re: [PATCH] xen/build: Remove hacked up version of figlet"):

Quoted 2 lines

How about this (just the makefile changes to safe sending a huge patch again)? It causes a lack of figlet in the build environment not to be fatal.

This seems like a good approach to me.

We should put something in the build docs.

Ian.