Accepting request 533694 from GNOME:Factory

- Drop obsolete mime-info-to-mime (boo#1062631). (forwarded request 533405 from sbrabec)

OBS-URL: https://build.opensuse.org/request/show/533694
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/shared-mime-info?expand=0&rev=53
This commit is contained in:
Dominique Leuenberger 2017-10-20 14:12:51 +00:00 committed by Git OBS Bridge
commit f3ead68463
3 changed files with 7 additions and 269 deletions

View File

@ -1,261 +0,0 @@
#! /usr/bin/perl
# mime-info-to-mime
# Script to help with conversion from mime-info to shared-mime-info.
#
# Conversion for simple description is automatic and correct, for
# complicated or buggy descriptions, manual check is required (and
# convertor returns error code 1).
#
# Call it without arguments to perform conversion of all files in your
# system (previously installed files will not be overwritten) or use
# DESTDIR variable, if you want to create package.
#
# (c) 2004 SuSE CR
# Author: Stanislav Brabec <sbrabec@suse.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
if ( $ENV{"DESTDIR"} eq "" && $ARGV[0] ne "--force" ) {
print "System-wide \"$0\" is disabled. It may create bogus definitions!\n";
print "Use \"$0 --force\" to force it or set DESTDIR.\n";
exit 1;
}
# directory with mime-info
$mimeinfodir=$ENV{"DESTDIR"} . "/usr/share/mime-info";
# directory with shared-mime-info
$sharedmimedir=$ENV{"DESTDIR"} . "/usr/share/mime/packages";
$rc=0;
system "mkdir -p $sharedmimedir ; rm -v 2>/dev/null \$(fgrep 2>/dev/null -l \"generated by mime-info-to-mime\" $sharedmimedir/*.xml)";
foreach $mimefile (glob("$mimeinfodir/*.mime")) {
$mimename = $mimefile;
$mimename=substr($mimename, length($mimeinfodir)+1, length($mimename)-length($mimeinfodir)-6);
if (-e "$sharedmimedir/$mimename.xml")
{
print "WARNING: File $sharedmimedir/$mimename.xml already exists. No conversion.\n";
next;
}
# Maybe uncomment in future, but now gnome-vfs.xml is 4 times longer than freedesktop.org.xml.
# GNOME 2
# if ( $mimename =~ "gnome-vfs" )
# {
# print "INFO: Not creating gnome-vfs.xml. Data types should be present in freedesktop.org.xml.\n";
# next;
# }
# GNOME 1.4
# if ( $mimename =~ "gnome" )
# {
# print "INFO: Not creating gnome.xml. Data types should be present in freedesktop.org.xml.\n";
# next;
# }
open($xml, ">$sharedmimedir/$mimename.xml");
print $xml "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print $xml "<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\n";
print $xml "<!-- generated by mime-info-to-mime (Remove this line to prevent overwriting!) -->\n";
open($mime, "<$mimefile");
$lineno=0;
while ( <$mime> )
{
$lineno++;
$line = $_;
if ($line =~ /^[^ \t]+\/[^ \t]+/)
{
chomp $line;
$mime_type=$line;
}
else
{
if ($line =~ /^[ \t]/)
{
if ($line =~ /^[ \t]+ext:[ \t]?/)
{
$line =~ s/^[ \t]+ext:[ \t]?// ;
chomp $line;
foreach $ext (split " ", $line)
{
$xmlstring{$mime_type}=$xmlstring{$mime_type} . " <glob pattern=\"*.$ext\" />\n";
}
}
else
{
if ($line =~ /^[ \t]+ext,[0-9]+:[ \t]?/)
{
$line =~ s/^[ \t]+ext,[0-9]+:[ \t]?// ;
chomp $line;
print "WARNING in $mimename.mime $lineno: priority field ignored: $line\n";
foreach $ext (split " ", $line)
{
$xmlstring{$mime_type}=$xmlstring{$mime_type} . " <glob pattern=\"*.$ext\" />\n";
}
}
else
{
if ($line =~ /^[ \t]+regex:[ \t]?/)
{
$line =~ s/^[ \t]+regex:[ \t]?// ;
chomp $line;
print "ERROR in $mimename.mime $lineno: regex is not supported, FIXME(regex) created. Edit file manually.\n";
$rc=1;
$xmlstring{$mime_type}=$xmlstring{$mime_type} . " <glob pattern=\"FIXME(regex) $line\" />\n";
}
else
{
if ($line =~ /^[ \t]+regex,[0-9]+:[ \t]?/)
{
$line =~ s/^[ \t]+regex,[0-9]+:[ \t]?// ;
chomp $line;
print "WARNING in $mimename.mime $lineno: priority field ignored: $line\n";
print "ERROR in $mimename.mime $lineno: regex is not supported, FIXME(regex) created. Edit file manually.\n";
$rc=1;
$xmlstring{$mime_type}=$xmlstring{$mime_type} . " <glob pattern=\"FIXME(regex) $line\" />\n";
}
else
{
print "ERROR in $mimename.mime $lineno: unknown line format: $line\n";
$rc=1;
}
}
}
}
}
else
{
if ($line =~ /^$/)
{
$mime_type="FIXME";
}
else
{
chomp $line;
if ($line =~ /^#/ )
{
$line =~ s/^#*[ \t]*// ;
print $xml "<!-- $line -->\n";
}
else
{
print "ERROR in $mimename.mime $lineno: unknown line: $line\n";
$rc=1;
}
}
}
}
}
close($mime);
if (-e "$mimeinfodir/$mimename.keys")
{
open($keys, "<$mimeinfodir/$mimename.keys");
$lineno=0;
while ( <$keys> )
{
$lineno++;
$line = $_;
if ($line =~ /^[^ \t]+\/[^ \t]+/)
{
chomp $line;
$mime_type=$line;
}
else
{
if ($line =~ /^[ \t]/)
{
chomp $line;
$line =~ s/^[ \t]*// ;
if ($line =~ /^\[[^=]+\][^=]+=/)
{
$lang=$line;
$lang =~ s/^\[([^=]+)\][^=]+=.*$/\1/ ;
$item=$line;
$item =~ s/^\[[^=]+\]([^=]+)=.*$/\1/ ;
$value=$line;
$value =~ s/^\[[^=]+\][^=]+=(.*)$/\1/ ;
}
else
{
if ($line =~ /^[^=]+=/)
{
$item=$line;
$item =~ s/^([^=]+)=.*$/\1/ ;
$value=$line;
$value =~ s/^[^=]+=(.*)$/\1/ ;
$lang="";
}
else
{
print "ERROR in $mimename.keys $lineno: unknown line format: $line\n";
$rc=1;
}
}
if ($item =~ /^description$/)
{
if ($lang)
{
$xmlstring_c{$mime_type}=$xmlstring_c{$mime_type} . " <comment xml:lang=\"$lang\">$value</comment>\n";
}
else
{
$xmlstring_c{$mime_type}=$xmlstring_c{$mime_type} . " <comment>$value</comment>\n";
}
}
}
else
{
if ($line =~ /^$/)
{
$mime_type="FIXME";
}
else
{
chomp $line;
if ($line =~ /^#/ )
{
$line =~ s/^#*[ \t]*// ;
print $xml "<!-- $line -->\n";
}
else
{
print "ERROR in $mimename.keys $lineno: unknown line: $line\n";
$rc=1;
}
}
}
}
}
close($keys);
}
foreach $mime_type (keys %xmlstring) {
print $xml " <mime-type type=\"$mime_type\">\n";
print $xml $xmlstring_c{$mime_type};
print $xml $xmlstring{$mime_type};
print $xml " </mime-type>\n";
}
print $xml "</mime-info>\n";
close($xml);
undef %xmlstring;
undef %xmlstring_c;
}
exit $rc;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Oct 11 14:14:36 CEST 2017 - sbrabec@suse.com
- Drop obsolete mime-info-to-mime (boo#1062631).
-------------------------------------------------------------------
Mon Sep 18 11:51:57 UTC 2017 - aplazas@suse.com

View File

@ -24,18 +24,13 @@ Summary: Shared MIME Database
License: GPL-2.0+
Group: System/X11/Utilities
Source: http://people.freedesktop.org/~hadess/%{name}-%{version}.tar.xz
Source1: mime-info-to-mime
Source2: macros.shared-mime-info
Source1: macros.shared-mime-info
BuildRequires: glib2-devel
BuildRequires: intltool
BuildRequires: libxml2-devel
# needed for xmllint
BuildRequires: libxml2-tools
BuildRequires: translation-update-upstream
# needed by mime-info-to-mime:
Requires: /bin/mkdir
Requires: /bin/rm
Requires: /usr/bin/fgrep
# libgio-2_0-0 Requires: shared-mime-info, but this can't exist yet. We explicitly ignore this dependency here.
#!BuildIgnore: shared-mime-info
# needed by update-mime-database
@ -65,10 +60,9 @@ make
%install
%makeinstall
install %{S:1} $RPM_BUILD_ROOT%{_bindir}/
%find_lang %{name} %{?no_lang_C}
# Install rpm macros
install -D -m644 %{S:2} %{buildroot}%{_sysconfdir}/rpm/macros.shared-mime-info
install -D -m644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.shared-mime-info
%check
make check