X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=OSX%2Fupdate-info-plist.pl;h=2b7968c320cb3b7691e1e5c464f70ee11a349cd6;hp=172996bd96d855f533a8000c3e251b174c863076;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hpb=88cfe534a698a0562e81345957a50714af1453bc diff --git a/OSX/update-info-plist.pl b/OSX/update-info-plist.pl index 172996bd..2b7968c3 100755 --- a/OSX/update-info-plist.pl +++ b/OSX/update-info-plist.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2006-2014 Jamie Zawinski +# Copyright © 2006-2016 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -27,11 +27,12 @@ use IO::Compress::Gzip qw(gzip $GzipError); my ($exec_dir, $progname) = ($0 =~ m@^(.*?)/([^/]+)$@); -my ($version) = ('$Revision: 1.38 $' =~ m/\s(\d[.\d]+)\s/s); +my ($version) = ('$Revision: 1.45 $' =~ m/\s(\d[.\d]+)\s/s); $ENV{PATH} = "/usr/local/bin:$ENV{PATH}"; # for seticon +$ENV{PATH} = "/opt/local/bin:$ENV{PATH}"; # for macports wget -my $thumbdir = $ENV{HOME} . '/www/xscreensaver/screenshots/'; +my $thumbdir = 'build/screenshots'; @@ -123,20 +124,11 @@ sub read_saver_xml($) { } -sub update_saver_xml($$) { - my ($app_dir, $vers) = @_; - my ($filename, $body, $was_compressed_p) = read_saver_xml ($app_dir); - my $obody = $body; - - return () unless defined ($filename); - - $body =~ m@]*?[ \t]_label=\"([^\"]+)\"@m || - error ("$filename: no name label"); - my $name = $1; +# This is duplicated in hacks/check-configs.pl for Android +# +sub munge_blurb($$$$) { + my ($filename, $name, $vers, $desc) = @_; - $body =~ m@<_description>(.*?)@s || - error ("$filename: no description tag"); - my $desc = $1; $desc =~ s/^([ \t]*\n)+//s; $desc =~ s/\s*$//s; @@ -144,7 +136,7 @@ sub update_saver_xml($$) { $desc =~ s@@@gs; $desc =~ s/^.* version \d[^\n]*\n//s; $desc =~ s/^From the XScreenSaver.*\n//m; - $desc =~ s@^http://www\.jwz\.org/xscreensaver.*\n@@m; + $desc =~ s@^https://www\.jwz\.org/xscreensaver.*\n@@m; $desc =~ s/\nCopyright [^ \r\n\t]+ (\d{4})(-\d{4})? (.*)\.$/\nWritten $3; $1./s; $desc =~ s/^\n+//s; @@ -153,9 +145,6 @@ sub update_saver_xml($$) { if ($desc =~ m/([<>&][^<>&\s]*)/s); error ("$filename: description contains ctl chars: $1") if ($desc =~ m/([\000-\010\013-\037])/s); - error ("$filename: description contains non-ASCII and is not UTF-8: $1") - if ($body !~ m/\Q]*?[ \t]_label=\"([^\"]+)\"@m || + error ("$filename: no name label"); + my $name = $1; + + $body =~ m@<_description>(.*?)@s || + error ("$filename: no description tag"); + my $desc = $1; + + error ("$filename: description contains non-ASCII and is not UTF-8: $1") + if ($body !~ m/\Q)(.*?)()@$1$desc1$3@s; @@ -304,11 +318,9 @@ sub set_icon($) { my ($app_dir) = @_; $app_dir =~ s@/+$@@s; - # "seticon" is from osxutils, http://osxutils.sourceforge.net/ - my $icon = ($app_dir =~ m/\.saver$/ ? 'XScreenSaver' : 'SaverRunner'); $icon = "$app_dir/../../../$icon.icns"; - my @cmd = ("seticon", "-d", $icon, $app_dir); + my @cmd = ("$app_dir/../../../seticon.pl", "-d", $icon, $app_dir); print STDERR "$progname: exec: " . join(' ', @cmd) . "\n" if ($verbose > 1); system (@cmd); @@ -320,11 +332,26 @@ sub set_thumb($) { return unless ($app_dir =~ m@\.saver/?$@s); - my @cmd = ("$exec_dir/update-thumbnail.pl", $thumbdir, $app_dir); - push @cmd, "-" . ("v" x $verbose) if ($verbose); - print STDERR "$progname: exec: " . join(' ', @cmd) . "\n" - if ($verbose > 1); - system (@cmd); + my $name = $app_dir; + $name =~ s@^.*/@@s; + $name =~ s@\..*?$@@s; + $name = lc($name); + + $name = 'rd-bomb' if ($name eq 'rdbomb'); # sigh + + if (! -f "$thumbdir/$name.png") { + system ("make", "$thumbdir/$name.png"); + my $exit = $? >> 8; + exit ($exit) if $exit; + error ("unable to download $name.png") + unless (-f "$thumbdir/$name.png"); + } + + $app_dir =~ s@/+$@@s; + $app_dir .= "/Contents/Resources"; + error ("$app_dir does not exist") unless (-d $app_dir); + + system ("cp", "-p", "$thumbdir/$name.png", "$app_dir/thumbnail.png"); my $exit = $? >> 8; exit ($exit) if $exit; } @@ -408,7 +435,7 @@ sub update($) { $copyright =~ s/\b\d{4}-(\d{4})\b/$1/; # Lose the Wikipedia URLs. - $info_str =~ s@http:.*?\b(wikipedia|mathworld)\b[^\s]+[ \t]*\n?@@gm; + $info_str =~ s@https?:.*?\b(wikipedia|mathworld)\b[^\s]+[ \t]*\n?@@gm; $info_str =~ s/(\n\n)\n+/$1/gs; $info_str =~ s/(^\s+|\s+$)//gs;