[xz] profile.d: colorize interactive x*zgrep output

Pavel Raiskup praiskup at fedoraproject.org
Tue Aug 26 08:14:46 UTC 2014


commit 9907793ad89ae939e458a7f323aa9b12f87429e3
Author: Pavel Raiskup <praiskup at redhat.com>
Date:   Tue Aug 26 10:12:07 2014 +0200

    profile.d: colorize interactive x*zgrep output
    
    .. when grep output is colored also.  This commit can be done
    thanks to the fix from rhbz#1034631.
    
    Version: 5.1.2-15alpha
    Resolves: #1034846

 colorxzgrep.csh |    5 +++++
 colorxzgrep.sh  |    4 ++++
 xz.spec         |   15 ++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/colorxzgrep.csh b/colorxzgrep.csh
new file mode 100644
index 0000000..a3964dc
--- /dev/null
+++ b/colorxzgrep.csh
@@ -0,0 +1,5 @@
+/usr/libexec/grepconf.sh -c
+if ( $status == 1 ) exit
+alias xzgrep 'xzgrep --color=auto'
+alias xzfgrep 'xzfgrep --color=auto'
+alias xzegrep 'xzegrep --color=auto'
diff --git a/colorxzgrep.sh b/colorxzgrep.sh
new file mode 100644
index 0000000..4a91d70
--- /dev/null
+++ b/colorxzgrep.sh
@@ -0,0 +1,4 @@
+/usr/libexec/grepconf.sh -c || return
+alias xzgrep='xzgrep --color=auto' 2>/dev/null
+alias xzegrep='xzegrep --color=auto' 2>/dev/null
+alias xzfgrep='xzfgrep --color=auto' 2>/dev/null
diff --git a/xz.spec b/xz.spec
index b2878d0..0d2f7cf 100644
--- a/xz.spec
+++ b/xz.spec
@@ -3,13 +3,17 @@
 Summary:	LZMA compression utilities
 Name:		xz
 Version:	5.1.2
-Release:	14alpha%{?dist}
+Release:	15alpha%{?dist}
 License:	LGPLv2+
 Group:		Applications/File
 # official upstream release
 Source0:	http://tukaani.org/%{name}/%{name}-%{version}alpha.tar.gz
 # source created as "make dist" in checked out GIT tree
 Source1:	%{compat_ver}.20100401git.tar.bz2
+
+Source100:	colorxzgrep.sh
+Source101:	colorxzgrep.csh
+
 URL:		http://tukaani.org/%{name}/
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:	%{name}-libs%{?_isa} = %{version}-%{release}
@@ -134,6 +138,11 @@ rm -rf %{buildroot}%{_docdir}/%{name}
 rm -rf %{buildroot}%{_datadir}/locale
 cp -r %{compat_ver}/src/liblzma/.libs/liblzma.so.0* %{buildroot}%{_libdir}
 
+%global profiledir %{_sysconfdir}/profile.d
+mkdir -p %{buildroot}%{profiledir}
+install -p -m 644 %{SOURCE100} %{buildroot}%{profiledir}
+install -p -m 644 %{SOURCE101} %{buildroot}%{profiledir}
+
 %check
 LD_LIBRARY_PATH=$PWD/src/liblzma/.libs make check
 
@@ -155,6 +164,7 @@ rm -rf %{buildroot}
 %doc AUTHORS NEWS README THANKS TODO
 %{_bindir}/*xz*
 %{_mandir}/man1/*xz*
+%{profiledir}/*
 
 %files libs
 %defattr(-,root,root,-)
@@ -188,6 +198,9 @@ rm -rf %{buildroot}
 %{_mandir}/man1/*lz*
 
 %changelog
+* Tue Aug 26 2014 Pavel Raiskup <praiskup at redhat.com> - 5.1.2-15alpha
+- xz*grep's output is colored iff grep's is (#1034846)
+
 * Mon Aug 18 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.1.2-14alpha
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list