rpms/file/devel file-5.04-ruby-modules.patch, NONE, 1.1 file.spec, 1.117, 1.118

Daniel Novotny dnovotny at fedoraproject.org
Tue Feb 9 15:28:57 UTC 2010


Author: dnovotny

Update of /cvs/extras/rpms/file/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6427

Modified Files:
	file.spec 
Added Files:
	file-5.04-ruby-modules.patch 
Log Message:
- fix #562840 -  [PATCH] Add matches for ruby modules


file-5.04-ruby-modules.patch:
 ruby |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

--- NEW FILE file-5.04-ruby-modules.patch ---
>From eebad924e62b678a54d3af05a12da2a929f5d918 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak at v3.sk>
Date: Fri, 5 Feb 2010 13:19:48 +0100
Subject: [PATCH] Add matches for ruby modules

Similar to what's already done for Perl. Existing rules only match shebangs,
which is not useful in most cases. This was tested to yield no false
positives when run against every perl and python source file I could find
on my system (260 CPAN modules and 59 Python modules). Produces a couple
of false negatives for a couple of files from 30 Ruby gems I have
installed, but is still an improvement over existing rules. (Ruby is
used to construct DSLs quite often, it would be really tricky to match
those).
---
 magic/Magdir/ruby |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/magic/Magdir/ruby b/magic/Magdir/ruby
index 7030295..be1786c 100644
--- a/magic/Magdir/ruby
+++ b/magic/Magdir/ruby
@@ -14,3 +14,15 @@
 !:mime text/x-ruby
 0	search/1	#!\ /usr/bin/env\ ruby	Ruby script text executable
 !:mime text/x-ruby
+
+# What looks like ruby, but does not have a shebang
+# (modules and such)
+# From: Lubomir Rintel <lkundrak at v3.sk>
+0	regex		\^[\ \t]*require[\ \t]'[A-Za-z_\/]+'
+>0	regex		include\ [A-Z]|def\ [a-z]|\ do$
+>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby script text
+!:mime	text/x-ruby
+0	regex		\^[\ \t]*(class|module)[\ \t][A-Z]
+>0	regex		(modul|includ)e\ [A-Z]|def\ [a-z]
+>>0	regex		\^[\ \t]*end([\ \t]*[;#].*)?$		Ruby module source text
+!:mime	text/x-ruby
-- 
1.6.6



Index: file.spec
===================================================================
RCS file: /cvs/extras/rpms/file/devel/file.spec,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -p -r1.117 -r1.118
--- file.spec	28 Jan 2010 15:00:59 -0000	1.117
+++ file.spec	9 Feb 2010 15:28:56 -0000	1.118
@@ -5,7 +5,7 @@
 Summary: A utility for determining file types
 Name: file
 Version: 5.04
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: BSD
 Group: Applications/File
 Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@@ -14,6 +14,7 @@ Patch0: file-4.21-pybuild.patch
 Patch1: file-5.00-devdrv.patch
 Patch2: file-5.00-mdmp.patch
 Patch3: file-5.04-ulaw-segfault.patch
+Patch4: file-5.04-ruby-modules.patch
 
 Requires: file-libs = %{version}-%{release}
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -73,6 +74,8 @@ file(1) command.
 %patch2 -p1
 #fixes #533245
 %patch3 -p1
+#fixes #562840
+%patch4 -p1
 
 iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
 touch -r doc/libmagic.man doc/libmagic.man_
@@ -149,6 +152,9 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Tue Feb 09 2010 Daniel Novotny <dnovotny at redhat.com> 5.04-3
+- fix #562840 -  [PATCH] Add matches for ruby modules
+
 * Thu Jan 28 2010 Daniel Novotny <dnovotny at redhat.com> 5.04-2
 - fix #533245 -  segfaults on star.ulaw
 



More information about the scm-commits mailing list