From: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 3/7] Makefile: Support compressed files for screen target
Date: Sat, 16 Apr 2016 02:59:45 +0200 [thread overview]
Message-ID: <20160416025945.70bcdd4e.alex.miller@gmx.de> (raw)
In-Reply-To: <20160416022503.1df762cb.alex.miller-Mmb7MZpHnFY@public.gmane.org>
Now, make screen supports (optional, possibly different) compression
of the sources and installed man pages. Thus, allgz/allbz2/allxz/all
targets should update correctly even when switching compression types.
Signed-off-by: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
---
The formatting of the script is a bit unusual, but I wanted to keep
it compact and I think it's still readable. Feel free to add more
line breaks to the if blocks or use longer variable names if you
don't like it.
---
Makefile | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index a14078c..8f2e25c 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,29 @@ allxz: xz all
screen:
mkdir -p not_installed
for i in man?/*; do \
- if [ $(MANDIR)/"$$i" -nt "$$i" ]; then \
- cmp -s $(MANDIR)/"$$i" "$$i" > /dev/null 2>&1; \
- if [ "$$?" != 0 ]; then mv "$$i" not_installed; fi; \
- fi; \
- done
+ if b="$${i%.bz2}" && [ "$$b".bz2 = "$$i" ]; then c1=bunzip2; \
+ elif b="$${i%.gz}" && [ "$$b".gz = "$$i" ]; then c1=gunzip; \
+ elif b="$${i%.xz}" && [ "$$b".xz = "$$i" ]; then c1=unxz; \
+ else b="$$i"; c1=; fi; \
+ b=$(MANDIR)/"$$b"; \
+ if [ "$$b" -nt "$$i" ]; then c2=; \
+ elif [ "$$b".bz2 -nt "$$i" ]; then c2=bunzip2; b="$$b.bz2"; \
+ elif [ "$$b".gz -nt "$$i" ]; then c2=gunzip; b="$$b.gz"; \
+ elif [ "$$b".xz -nt "$$i" ]; then c2=unxz; b="$$b.xz"; \
+ else continue; fi; \
+ if [ -z "$$c1$$c2" ]; then \
+ cmp -s "$$i" "$$b"; \
+ elif [ -z "$$c1" ]; then \
+ $$c2 -c "$$b" | cmp -s "$$i" -; \
+ elif [ -z "$$c2" ]; then \
+ $$c1 -c "$$i" | cmp -s - "$$b"; \
+ else \
+ [ "$$c1" = "$$c2" ] && cmp -s "$$i" "$$b" || \
+ $$c1 -c "$$i" | { $$c2 -c "$$b" | \
+ cmp -s /dev/fd/3 -; } 3<&0; \
+ fi || mv "$$i" not_installed; \
+ done; \
+ rmdir not_installed 2> /dev/null; true
uninstall remove:
find man? -mindepth 1 -maxdepth 1 -print | \
--
2.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-04-16 0:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-16 0:25 [PATCH 0/7] Improve support for compressed man pages Alexander Miller
[not found] ` <20160416022503.1df762cb.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-16 0:45 ` [PATCH 1/7] Makefile: Use better xz options Alexander Miller
2016-04-16 0:52 ` [PATCH 2/7] Makefile: Improve uninstall target for compressed man pages Alexander Miller
2016-04-16 0:59 ` Alexander Miller [this message]
2016-04-16 1:01 ` [PATCH 4/7] Makefile: Skip already compressed files in gz/bz2/xz targets Alexander Miller
2016-04-16 1:09 ` [PATCH 6/7] Makefile: Avoid compressing very small " Alexander Miller
2016-04-16 1:09 ` [PATCH 7/7] Makefile: Mention xz in the instructive comment at top Alexander Miller
2016-04-16 4:50 ` [PATCH 0/7] Improve support for compressed man pages Mike Frysinger
[not found] ` <20160416045058.GS6588-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2016-04-16 16:30 ` Alexander Miller
[not found] ` <20160416183013.352f4ba6.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-18 12:57 ` Michael Kerrisk (man-pages)
[not found] ` <5714D9D2.8050501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-18 17:10 ` Alexander Miller
[not found] ` <20160418191026.7fa8c669.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-18 18:30 ` Mike Frysinger
[not found] ` <20160418212955.498ce1dd.alex.miller@gmx.de>
[not found] ` <20160418212955.498ce1dd.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-18 19:45 ` [PATCH] Makefile: Drop compression support and screen target Alexander Miller
2016-04-18 14:49 ` [PATCH 0/7] Improve support for compressed man pages Mike Frysinger
[not found] ` <20160418144918.GK5369-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2016-04-18 15:08 ` walter harms
[not found] ` <5714F856.9090206-fPG8STNUNVg@public.gmane.org>
2016-04-18 15:12 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160416025945.70bcdd4e.alex.miller@gmx.de \
--to=alex.miller-mmb7mzphnfy@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).