rpms/nss-mdns/devel nss-mdns.spec,1.4,1.5

Štěpán Kasal kasal at fedoraproject.org
Tue Sep 30 14:02:03 UTC 2008


Author: kasal

Update of /cvs/extras/rpms/nss-mdns/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27835

Modified Files:
	nss-mdns.spec 
Log Message:
- use sed instead of perl in scriptlets (#462996)
- consequently, removed the Requires(..): perl
- removed the reqires for things that are granted
- a better BuildRoot


Index: nss-mdns.spec
===================================================================
RCS file: /cvs/extras/rpms/nss-mdns/devel/nss-mdns.spec,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- nss-mdns.spec	11 Aug 2008 20:24:25 -0000	1.4
+++ nss-mdns.spec	30 Sep 2008 14:01:32 -0000	1.5
@@ -1,19 +1,12 @@
 Summary: glibc plugin for .local name resolution
 Name: nss-mdns
 Version: 0.10
-Release: 5%{?dist}
+Release: 6%{?dist}
 License: LGPLv2+
 URL: http://0pointer.de/lennart/projects/nss-mdns/
 Group: System Environment/Libraries
 Source: http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot 
-BuildRequires: glibc-devel
-Requires(post): /bin/sh
-Requires(preun): /bin/sh
-Requires(post): perl
-Requires(preun): perl
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 Requires: avahi
  
 %description
@@ -44,48 +37,19 @@
 /sbin/ldconfig
 # Perl-fu to add mdns4_minimal to the hosts line of /etc/nsswitch.conf
 if [ -f /etc/nsswitch.conf ] ; then
-	perl -ibak -pe '
-		sub insert {
-			my @bits = split(" ", shift);
-		
-			if (grep { $_ eq "mdns4_minimal" || $_ eq "mdns4"
-				|| $_ eq "mdns6_minimal" || $_ eq "mdns6"
-				|| $_ eq "mdns_minimal" || $_ eq "mdns" } @bits) {
-				return join " ", @bits;
-			}
-			
-			return join " ", map {
-				$_ eq "dns" ? ("mdns4_minimal", "[NOTFOUND=return]", $_) : $_
-			} @bits;
-		}
-
-		s/^(hosts:\s+)(.*)$/$1.insert($2)/e;
-	' /etc/nsswitch.conf
+	sed -i.bak '
+		/^hosts:/ !b
+		/\<mdns\(4\|6\)\?\(_minimal\)\?\>/ b
+		s/\([[:blank:]]\+\)dns\>/\1mdns4_minimal [NOTFOUND=return] dns/g
+		' /etc/nsswitch.conf
 fi
 
 %preun
-# Perl-fu to remove mdns4_minimal from the hosts line of /etc/nsswitch.conf
+# sed-fu to remove mdns4_minimal from the hosts line of /etc/nsswitch.conf
 if [ "$1" -eq 0 -a -f /etc/nsswitch.conf ] ; then
-	perl -ibak -pe '
-		my @remove = (
-			"mdns4_minimal [NOTFOUND=return]",
-			"mdns4_minimal",
-			"mdns4",
-			"mdns6_minimal [NOTFOUND=return]",
-			"mdns6_minimal",
-			"mdns6",
-			"mdns_minimal [NOTFOUND=return]",
-			"mdns_minimal",
-			"mdns",
-		);
-		sub remove {
-			my $s = shift;
-			foreach my $bit (@remove) {
-				$s =~ s/\s+\Q$bit\E//g;
-			}
-			return $s;
-		}
-		s/^(hosts:\s+)(.*)$/$1.remove($2)/e;
+	sed -i.bak '
+		/^hosts:/ !b
+		s/[[:blank:]]\+mdns\(4\|6\)\?\(_minimal\( \[NOTFOUND=return\]\)\?\)\?//g
 	' /etc/nsswitch.conf
 fi
 
@@ -97,6 +61,15 @@
 /%{_lib}/*
 
 %changelog
+* Tue Sep 30 2008 Stepan Kasal <skasal at redhat.com> - 0.10-6
+- use sed instead of perl in %%post and %%preun (#462996),
+  fixing two bugs in the scriptlets:
+  1) the backup file shall be nsswitch.conf.bak, not nsswitch.confbak
+  2) the first element after host: shall be subject to removal, too
+- consequently, removed the Requires(..): perl
+- removed the reqires for things that are granted
+- a better BuildRoot
+
 * Mon Aug 11 2008 Tom "spot" Callaway <tcallawa at redhat.com> - 0.10-5
 - fix license tag
 




More information about the fedora-extras-commits mailing list