Hello community, here is the log from the commit of package perl-Linux-DesktopFiles for openSUSE:Factory checked in at 2017-10-24 22:24:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Linux-DesktopFiles (Old) and /work/SRC/openSUSE:Factory/.perl-Linux-DesktopFiles.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Linux-DesktopFiles" Tue Oct 24 22:24:28 2017 rev:4 rq:536225 version:0.25 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Linux-DesktopFiles/perl-Linux-DesktopFiles.changes 2017-10-23 16:52:36.006627148 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Linux-DesktopFiles.new/perl-Linux-DesktopFiles.changes 2017-10-24 22:24:30.977220984 +0200 @@ -1,0 +2,10 @@ +Mon Oct 23 05:29:19 UTC 2017 - co...@suse.com + +- updated to 0.25 + see /usr/share/doc/packages/perl-Linux-DesktopFiles/Changes + + 0.25 2017-10-22 + - `parse_desktop_file()` and `parse_desktop_files()` are now context-sensitive, returning a key-value list or a HASH reference, depending on the context. + - Documentation improvements. + +------------------------------------------------------------------- Old: ---- Linux-DesktopFiles-0.24.tar.gz New: ---- Linux-DesktopFiles-0.25.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Linux-DesktopFiles.spec ++++++ --- /var/tmp/diff_new_pack.x18pBX/_old 2017-10-24 22:24:31.569193311 +0200 +++ /var/tmp/diff_new_pack.x18pBX/_new 2017-10-24 22:24:31.573193124 +0200 @@ -17,7 +17,7 @@ Name: perl-Linux-DesktopFiles -Version: 0.24 +Version: 0.25 Release: 0 %define cpan_name Linux-DesktopFiles Summary: Fast parsing of the Linux desktop files ++++++ Linux-DesktopFiles-0.24.tar.gz -> Linux-DesktopFiles-0.25.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Linux-DesktopFiles-0.24/Changes new/Linux-DesktopFiles-0.25/Changes --- old/Linux-DesktopFiles-0.24/Changes 2017-10-21 18:39:47.000000000 +0200 +++ new/Linux-DesktopFiles-0.25/Changes 2017-10-22 09:57:29.000000000 +0200 @@ -1,5 +1,9 @@ Revision history for Perl extension Linux::DesktopFiles. +0.25 2017-10-22 + - `parse_desktop_file()` and `parse_desktop_files()` are now context-sensitive, returning a key-value list or a HASH reference, depending on the context. + - Documentation improvements. + 0.24 2017-10-21 - When `keep_unknown_categories` is true and a given entry does not belong to any category, `parse_desktop_file` will set `Categories` to [`unknown_category_key`]. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Linux-DesktopFiles-0.24/META.json new/Linux-DesktopFiles-0.25/META.json --- old/Linux-DesktopFiles-0.24/META.json 2017-10-21 18:39:47.000000000 +0200 +++ new/Linux-DesktopFiles-0.25/META.json 2017-10-22 09:57:29.000000000 +0200 @@ -28,7 +28,7 @@ "provides" : { "Linux::DesktopFiles" : { "file" : "lib/Linux/DesktopFiles.pm", - "version" : "0.24" + "version" : "0.25" } }, "release_status" : "stable", @@ -44,6 +44,6 @@ "url" : "https://github.com/trizen/Linux-DesktopFiles" } }, - "version" : "0.24", + "version" : "0.25", "x_serialization_backend" : "JSON::PP version 2.94" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Linux-DesktopFiles-0.24/META.yml new/Linux-DesktopFiles-0.25/META.yml --- old/Linux-DesktopFiles-0.24/META.yml 2017-10-21 18:39:47.000000000 +0200 +++ new/Linux-DesktopFiles-0.25/META.yml 2017-10-22 09:57:29.000000000 +0200 @@ -15,7 +15,7 @@ provides: Linux::DesktopFiles: file: lib/Linux/DesktopFiles.pm - version: '0.24' + version: '0.25' requires: perl: '5.014' resources: @@ -23,5 +23,5 @@ homepage: https://github.com/trizen/Linux-DesktopFiles license: http://opensource.org/licenses/artistic-license-2.0.php repository: https://github.com/trizen/Linux-DesktopFiles -version: '0.24' +version: '0.25' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Linux-DesktopFiles-0.24/lib/Linux/DesktopFiles.pm new/Linux-DesktopFiles-0.25/lib/Linux/DesktopFiles.pm --- old/Linux-DesktopFiles-0.24/lib/Linux/DesktopFiles.pm 2017-10-21 18:39:47.000000000 +0200 +++ new/Linux-DesktopFiles-0.25/lib/Linux/DesktopFiles.pm 2017-10-22 09:57:29.000000000 +0200 @@ -9,7 +9,7 @@ #use strict; #use warnings; -our $VERSION = '0.24'; +our $VERSION = '0.25'; our %TRUE_VALUES = ( 'true' => 1, @@ -231,27 +231,29 @@ $info{Icon} = $icon; } - return %info; + wantarray ? (%info) : \%info; } sub parse { my ($self, $hash_ref, @desktop_files) = @_; foreach my $desktop_file (@desktop_files) { - (my %info = $self->parse_desktop_file($desktop_file)) || next; + my $entry = $self->parse_desktop_file($desktop_file) // next; # Push the entry into its belonging categories - foreach my $category (@{$info{Categories}}) { - push @{$hash_ref->{$category}}, \%info; + foreach my $category (@{$entry->{Categories}}) { + push @{$hash_ref->{$category}}, $entry; } } + + $hash_ref; } sub parse_desktop_files { my ($self) = @_; my %categories; $self->parse(\%categories, $self->get_desktop_files); - \%categories; + wantarray ? (%categories) : \%categories; } 1; @@ -306,21 +308,19 @@ '/usr/share/applications'], keys_to_keep => ["Name", "Exec", "Icon"], - categories => [ - qw( Utility - Development - Education - Game - Graphics - AudioVideo - Network - Office - Settings - System ) - ], + categories => [qw( Utility + Development + Education + Game + Graphics + AudioVideo + Network + Office + Settings + System + )], case_insensitive_cats => 0, - keep_unknown_categories => 0, unknown_category_key => 'Other', ); @@ -337,7 +337,7 @@ =item keys_to_keep => [qw(Name Exec Icon Comment ...)] -Any valid keys from the desktop files to keep in the results from C<parse_desktop_file>. The B<Categories> option is implicitly included. +Any valid keys from the desktop files to keep in the results from C<parse_desktop_file>. The B<Categories> key is implicitly included. =item categories => [qw(Graphics Network AudioVideo ...)] @@ -352,18 +352,17 @@ =item keep_unknown_categories => $bool -When an item is not part of any specified category, will be stored inside the +When an entry is not part of any specified category, it will be stored inside the unknown category, specified by B<unknown_category_key>. =item unknown_category_key => $name -Category name where to store the applications which do not belong to -any specified category. +Category name where to store the entries which do not belong to any specified category. =item case_insensitive_cats => $bool This option makes the category names case insensitive, by lowercasing and replacing -any non-alpha numeric characters with an underscore. For example, "X-XFCE" becomes "x_xfce". +any non-alphanumeric characters with an underscore. For example, C<X-XFCE> becomes C<x_xfce>. =item terminal => $command @@ -384,7 +383,7 @@ Used internally as: - sprintf($self->{terminalization_format}, $self->{terminal}, $command); + sprintf($self->{terminalization_format}, $self->{terminal}, $entry{Exec}); =back @@ -395,11 +394,13 @@ =item skip_filename_re => qr/regex/ Skip any desktop file if its file name matches the regex. + B<NOTE:> File names are from the last slash to the end. =item skip_entry => [{key => 'KeyName', re => qr/REGEX/i}, {...}] -Skip any desktop file if the value from a given key matches the specified regular expression. +Skip any desktop file if the value from a given key matches a regular expression. + The B<key> can be any valid key from the desktop files. Example: @@ -411,12 +412,12 @@ =item substitutions => [{key => 'KeyName', re => qr/REGEX/i, value => 'Value'}, {...}] -Substitute, by using a regex, in the values of the desktop files. +Substitute, by using a regex, in the returned values from desktop files. The B<key> can be any valid key from the desktop files. The B<re> can be any valid regular expression. Anything matched by the regex, will be -replaced the string stored in B<value>. +replaced with the string stored in B<value>. For global matching/substitution, set the B<global> key to a true value. @@ -435,13 +436,15 @@ =item $obj->get_desktop_files() -Get all desktop files. In list context returns a list, but in scalar context, -it returns an array reference containing the full names of the desktop files. +Returns a list with the absolute paths to all desktop files from B<desktop_files_paths>. + +In scalar context, returns an ARRAY reference. =item $obj->parse(\%hash, @desktop_files) Parse a list of desktop files into a HASH ref, where the keys of the HASH are -the categories from desktop files. +the categories from desktop files and the values are ARRAY references containing +information about each entry, as returned by C<parse_desktop_file()>. =item $obj->parse_desktop_file($desktop_file) @@ -463,13 +466,17 @@ When B<keep_unknown_categories> is true and a given entry does not belong to any category, C<parse_desktop_file> will set B<Categories> to [C<unknown_category_key>]. +Returns a HASH reference in scalar contenxt. + +When a given file cannot be parsed or its specified as I<Hidden> or I<NoDisplay>, an empty list is returned (undef in scalar context). + =item $obj->parse_desktop_files() It returns a HASH reference categorized on category names, with ARRAY references as values, each ARRAY containing a HASH reference with the keys specified in the B<keys_to_keep> option, and values from the desktop files. -The returned HASH reference might look something like this: +The returned HASH reference may look something like this: { Utility => [ {Exec => "...", Name => "..."}, {Exec => "...", Name => "..."} ], @@ -480,6 +487,8 @@ $obj->parse(\%hash, $obj->get_desktop_files); +In list contenxt, it returns a key-value list, while, in scalar context, it returns a HASH reference. + =back =head1 REPOSITORY