[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#803790: marked as done (fakeupstream.cgi: New Google Fonts upstream)



Your message dated Fri, 17 Mar 2017 15:28:56 +0000
with message-id <E1cotoG-0005Kl-B9@moszumanska.debian.org>
and subject line qa.debian.org bug fixed in revision 3596
has caused the Debian Bug report #803790,
regarding fakeupstream.cgi: New Google Fonts upstream
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
803790: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803790
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: qa.debian.org
Severity: wishlist
Tags: patch

Hello,

the attached patch adds support for a new upstream: Google Fonts via GitHub. The `upstream_parameter` format is `google-fonts/$font_licence/$font_name`, for example `google-fonts/ofl/pompiere`.

Before explaining the patch I need to explain why this is needed and the unusual way fonts on Google Fonts are "released". To start with, fonts made available on Google Fonts lack proper release tarballs. Each font is maintained in a subdirectory that is part of a huge git repository hosted on GitHub (previously on Google Code).

These fonts lack also meaningful version numbers. Modifications are, however, almost always recorded in the `FONTLOG.txt` file that is present in most directories. In addition, not all the revisions of a certain font are available in the git history, only the latest one is assured to be available. For all these reasons the most reliable way to identify a font version is the date recorded in `FONTLOG.txt`.

The modified `fakeupstream.cgi` generates a page with a list of available versions for a given font. Unfortunately it is not possible to link these versions to release tarballs because GitHub does not generate tarballs for subdirectories, so the links lead to fictitious URLs.

I tested the generated page with uscan 2.15.9 and it can detects the current and past versions of all the fonts I tested it with.

Regards,

--
Gioele Barabucci <gioele@svario.it>
--- fakeupstream.cgi.orig	2015-11-02 13:55:28.000000000 +0000
+++ fakeupstream.cgi	2015-11-02 19:33:53.928268787 +0000
@@ -23,6 +23,8 @@
 use LWP::UserAgent;
 use JSON;
 use File::Temp qw/ tempdir /;
+use Date::Format;
+use Date::Parse;
 use Dpkg::Version;
 
 my $ca_dir = '/etc/ssl/ca-global';
@@ -735,6 +737,65 @@
 	} );
 }
 
+# http://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=google-fonts/ofl/pompiere
+elsif( $upstream_param =~ m%^google-fonts/($project_char_re+)/($project_char_re+)$% )
+{
+	my $font_licence = $1;
+	my $font_name = $2;
+
+	my $github_repo_url = "https://github.com/google/fonts/tree/master/$font_licence/$font_name";;
+	my $svn_fontlog_url = "https://github.com/google/fonts/trunk/$font_licence/$font_name/FONTLOG.txt";;
+
+	my @command = (
+		'/usr/bin/svn',
+		'cat',
+		$svn_fontlog_url
+	);
+
+	my @versions_eng;
+
+	open(my $svn_cat_fh, '-|', @command)
+		or return_error("Can't run svn cat: $!");
+	while (<$svn_cat_fh>) {
+		chomp;
+
+		# 15 July 2011 (Author) version notes
+		next unless /^([0-9]{1,2}) ([A-Za-z]+) ([0-9]{4}) /;
+
+		push @versions_eng, "$1 $2 $3"
+	}
+	close($svn_cat_fh);
+
+	return_error("no versions found for font $font_licence/$font_name")
+		if (scalar(@versions_eng) == 0);
+
+	my @versions;
+	for my $version_eng (@versions_eng) {
+		my $date = str2time($version_eng);
+		my $version = time2str("%Y%m%d", $date);
+
+		push @versions, $version;
+	}
+
+	my $result = "\n";
+	for my $version (@versions) {
+		my $release = "$font_name-$version";
+
+		$result .= $q->li( $q->a( { -href => $q->self_url . "&download=$release.zip" }, $release ) ) . "\n";
+	}
+
+	print $q->header;
+	print $q->start_html;
+	print $q->h1( "Known versions of " . $q->em( $font_name ));
+	print $q->p( "Font available at " . $q->a( { -href => "$github_repo_url" }, $github_repo_url ) );
+	print $q->start_ul;
+	print $result;
+	print $q->end_ul;
+	print $q->end_html;
+
+	exit 0;
+}
+
 my %upstream_info_per_package =
 (
 	'stopwatch' =>

--- End Message ---
--- Begin Message ---
Version: 3596

This bug was closed by Mattia Rizzolo (mattia) in SVN revision 3596.
Note that it might take some time until the qa.debian.org code has
been updated and cronjobs have picked up changed data.

Commit message:

fakeupstream.cgi: add support for Google Fonts (patch by Gioele Barabucci - Closes: #803790)

--- End Message ---

Reply to: