Recent changes to this wiki:

Current changelog.
diff --git a/debian/changelog b/debian/changelog
index 87ca1b2..73c3754 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,11 @@ umegaya (0.14) UNRELEASED; urgency=low
   9a5f01b Correct for downloading data from Blends managed Git repositories.
           Closes: #731455
   e810177 Moved the source repository to collab-maint.
+  78e50f2 Depend on curl instead of recommending it.
+  a48da63 Suggest cron-apt to keep debcheckout's results up to date.
+  442e9f5 Override lintian warning umegaya: non-standard-dir-perm var/lib/umegaya/*
+  04cb261 umegaya-adm: new functions to directly manipulate the Berkeley DB.
+  3ef0bdf 09c861d f12824f umegaya-refresh-blends : correct bugs and bitrot.
 
   [ Andreas Tille ]
   f7cc82e Change default path to files for UDD bibref gatherer.

Avoid duplicates with sort -u.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index a548877..c6e3bd3 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -50,7 +50,8 @@ do
   PACKAGES=$(
     eval ${BLENDS[$BLEND-pack]} |
     grep-dctrl -s Recommends,Suggests - |
-    sed -e 's/,//g' -e 's/|//g' -e 's/Recommends://g' -e 's/Suggests://g' )
+    sed -e 's/,//g' -e 's/|//g' -e 's/Recommends://g' -e 's/Suggests://g' |
+    sort -u )
   for PACKAGE in $PACKAGES 
   do
     [ $DEBUG ] && echo "$PACKAGE"

Use grep-dctrl instead of grep.
Simple grep does not work since packages are not one a single line anymore.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 5daeb4b..a548877 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -49,7 +49,7 @@ do
 # Refresh Umegaya for each package.
   PACKAGES=$(
     eval ${BLENDS[$BLEND-pack]} |
-    grep -e ^Recommends -e ^Suggests |
+    grep-dctrl -s Recommends,Suggests - |
     sed -e 's/,//g' -e 's/|//g' -e 's/Recommends://g' -e 's/Suggests://g' )
   for PACKAGE in $PACKAGES 
   do

Added missing tasks directory in the path.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 0034ac1..5daeb4b 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -28,7 +28,7 @@ declare -A BLENDS
 BLENDS[debichem-URLs]='for file in $(svn ls $DEBICHEM_URL/tasks) ; do svn cat $DEBICHEM_URL/tasks/$file ; done'
 BLENDS[debichem-pack]='svn cat $DEBICHEM_URL/debian/control'
 
-BLENDS[debian-med-URLs]='for file in $(svn ls $DEBIAN_MED_URL) ; do svn cat $DEBIAN_MED_URL/$file ; done'
+BLENDS[debian-med-URLs]='for file in $(svn ls $DEBIAN_MED_URL/tasks) ; do svn cat $DEBIAN_MED_URL/tasks/$file ; done'
 BLENDS[debian-med-pack]='svn cat $DEBIAN_MED_URL/debian/control'
 
 BLENDS[debian-science-URLs]='git archive --remote=$DEBIAN_SCIENCE_URL HEAD:tasks          | tar xf - --to-stdout'

Correct typo in array declaration.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 38f7aca..0034ac1 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -23,7 +23,7 @@ DEBICHEM_URL="svn://svn.debian.org/blends/projects/debichem/trunk/debichem"
 DEBIAN_MED_URL="svn://svn.debian.org/blends/projects/med/trunk/debian-med"
 DEBIAN_SCIENCE_URL="git://anonscm.debian.org/blends/projects/science.git"
 
-declare -A BLEND
+declare -A BLENDS
 
 BLENDS[debichem-URLs]='for file in $(svn ls $DEBICHEM_URL/tasks) ; do svn cat $DEBICHEM_URL/tasks/$file ; done'
 BLENDS[debichem-pack]='svn cat $DEBICHEM_URL/debian/control'

umegaya-adm: new functions to directly manipulate the Berkeley DB.
diff --git a/scripts/umegaya-adm b/scripts/umegaya-adm
index 051142c..2adfea0 100755
--- a/scripts/umegaya-adm
+++ b/scripts/umegaya-adm
@@ -66,6 +66,12 @@ tie (%stored, 'BerkeleyDB::Hash', -Filename =>  $berkeleydb, -Flags => DB_CREATE
 In combination with B<--key> or B<--package>, delete the value(s) instead of
 displaying them.
 
+=item B<--list-entries>, B<--show-entry>, B<--delete-entry>
+
+List all the entries, or show or delete one entry of the Umegaya database.
+These entries are package names joined to a Umegaya key by a colon.  Examples:
+“umegaya:Name”, “umegaya:YAML-URL”.
+
 =item B<-k>, B<--key>
 
 If set alone, C<umegaya-adm> will display all the package-values pairs for the
@@ -96,13 +102,16 @@ B<--key>, B<--package>, and B<--value>.
 
 =cut
 
-my ($delete, $package, $purge, $help, $key, $value, $verbose);
+my ($delete, $deleteEntry, $listEntries, $package, $purge, $help, $key, $showEntry, $value, $verbose);
 
-GetOptions (    'delete'      => \$delete  ,
+GetOptions (    'delete|d'    => \$delete  ,
+                'delete-entry=s'=> \$deleteEntry ,
+                'list-entries'=> \$listEntries ,
                 'package|p=s' => \$package ,
                 'purge'       => \$purge   ,
                 'help'        => \$help    ,
                 'key=s'       => \$key     ,
+                'show-entry=s'=> \$showEntry ,
                 'value|v=s'   => \$value   ,
                 'verbose'     => \$verbose );
 
@@ -112,12 +121,30 @@ if ($help) {
 }
 
 if ($purge) {
-    die "$0: --purge can not be combined with other arguments.\n" if ($delete or $package or $key or $value);
+    die "$0: --purge can not be combined with other arguments.\n" if ($delete or $listEntries or $package or $key or $value);
     untie %stored;
     unlink $berkeleydb or die "$0: could not remove $berkeleydb: $!\n";
     exit;
 }
 
+if ($listEntries) {
+    die "$0: --list-entries can not be combined with other arguments.\n" if ($delete or $package or $purge or $key or $value);
+    say join "\n", sort keys (%stored);
+    exit;
+}
+
+if ($showEntry) {
+    die "$0: --show-entries can not be combined with other arguments.\n" if ($delete or $package or $purge or $key or $value);
+    say $stored{$showEntry} // "Entry not found";
+    exit;
+}
+
+if ($deleteEntry) {
+    die "$0: --show-entries can not be combined with other arguments.\n" if ($delete or $package or $purge or $key or $value);
+    delete $stored{$deleteEntry};
+    exit;
+}
+
 if ($value)        {
     die "$0: --value option needs --package and --key to be set\n" unless ($package and $key);
     $stored{join(':', $package, $key)} = $value;

Remove check if file is writable; ‘open’ is followed by ‘die’ anyway.
This check was a false positive when the file did not exist.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index c132461..42858a1 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -171,7 +171,6 @@ sub storeFile ($$) {
     my $file         = shift;
     my $fileContents = shift;
     my $fullPath     = $store_files . '/' . packagePool($package) . '/'. $file;
-    say "Will not be able to write $fullPath: crashing soon..." unless -w "$fullPath";
     print "Writing $fullPath ... " if $debug;
     open(my $fileHandle, ">", "$fullPath")
             or die "Can not write $fullPath: $!";

Factorised code in functions.
As a side effect it fixed a bug preventing downloads when file exists.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index e542d36..c132461 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -153,40 +153,60 @@ foreach (keys (%stored)) {
 }
 say "No $key key for package ${package}." if $debug;
 
+sub packagePool ($) {
+    my $package = shift;
+    $package =~ /^(.)/; # first letter
+    return $1
+}
+
+sub getFile ($$) {
+   my $package_url = shift;
+   my $file        = shift;
+   my $command = $package_url->download_command($file);
+   say "Running “$command”)" if $debug;
+   qx($command)
+}
+
+sub storeFile ($$) {
+    my $file         = shift;
+    my $fileContents = shift;
+    my $fullPath     = $store_files . '/' . packagePool($package) . '/'. $file;
+    say "Will not be able to write $fullPath: crashing soon..." unless -w "$fullPath";
+    print "Writing $fullPath ... " if $debug;
+    open(my $fileHandle, ">", "$fullPath")
+            or die "Can not write $fullPath: $!";
+    print $fileHandle $fileContents;
+    close($fileHandle);
+    say "done." if $debug;
+}
+
+sub downloadFile ($$$) {
+    my $package_url    = shift;
+    my $package        = shift;
+    my $file           = shift;
+    storeFile( $package . '.' . $file
+             , getFile ( $package_url, $file));
+}
+
 # Refresh and return a time stamp; store files if asked.
 sub refresh {
     my $package = shift;
     say "Refreshing data for $package" if $debug;
-    my $package_url = Umegaya->new(url => $stored{"$package:YAML-URL"});
-    my $package_metadata_yaml_command = $package_url->download_command("upstream/metadata");
-    my $package_metadata_yaml = qx($package_metadata_yaml_command);
+    my $package_url = Umegaya->new( url  => $stored{"$package:YAML-URL"});
+    my $package_metadata_yaml = getFile($package_url, "upstream/metadata");
     if ( !$package_metadata_yaml ) {
-	$package_metadata_yaml_command = $package_url->download_command("upstream");
-	$package_metadata_yaml = qx($package_metadata_yaml_command);
+        $package_metadata_yaml = getFile($package_url, "upstream");
     }
     if ( !$package_metadata_yaml ) {
-	$package_metadata_yaml_command = $package_url->download_command("upstream-metadata.yaml");
-	$package_metadata_yaml = qx($package_metadata_yaml_command);
+        $package_metadata_yaml = getFile($package_url, "upstream-metadata.yaml");
     }
     if ( $store_files ) {
-	$package =~ /^(.)/; # first letter
-	my $pool = $1;
-        say "Will not be able to write $store_files/$pool/$package.upstream: crashing soon..." unless -w "$store_files/$pool/$package.upstream";
-        open(my $debian_upstream, ">", "$store_files/$pool/$package.upstream")
-            or die "Can not write $store_files/$pool/$package.upstream: $!";
-        print $debian_upstream $package_metadata_yaml;
-        close($debian_upstream);
+        storeFile($package . '.upstream', $package_metadata_yaml);
         if ( $debian_control ) {
-            die "Can not write $store_files/$pool/$package.control\n" unless -w "$store_files/$pool/$package.control";
-            print "Writing $store_files/$pool/$package.control ... " if $debug;
-            system($package_url->download_command("control") . " > $store_files/$pool/$package.control");
-            say "done." if $debug;
+            downloadFile( $package_url, $package, 'control' )
         }
         if ( $debian_copyright ) {
-            die "Can not write $store_files/$pool/$package.copyright\n" unless -w "$store_files/$pool/$package.copyright";
-            print "Writing $store_files/$pool/$package.copyright ... " if $debug;
-            system($package_url->download_command("copyright") .  " > $store_files/$pool/$package.copyright");
-            say "done." if $debug;
+            downloadFile( $package_url, $package, 'copyright' )
         }
     }
     my $package_metadata;

Stop importing “get” from LWP::Simple, because it is not used.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index a18d12a..e542d36 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -65,7 +65,6 @@ use 5.10.0;
 
 use BerkeleyDB;
 use CGI;
-use LWP::Simple qw(get);
 use Umegaya;
 use YAML::XS qw(Load Dump DumpFile);
 use YAML::AppConfig;

Suggest cron-apt to keep debcheckout's results up to date.
diff --git a/debian/control b/debian/control
index 20929cc..b22ad25 100644
--- a/debian/control
+++ b/debian/control
@@ -25,6 +25,7 @@ Depends: curl,
          ${perl:Depends},
          ${misc:Depends}
 Recommends: ${misc:Recommends}
+Suggests: cron-apt
 Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a

Mention curl.
Git-Dch: Ignore.
diff --git a/setup.mdwn b/setup.mdwn
index 652ff8e..6fbcb91 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -6,6 +6,7 @@ Programs needed
 
  - Apache
  - Berkeley DB
+ - curl
  - The following Perl modules:
    - BerkeleyDB
    - LWP

Override lintian warning umegaya: non-standard-dir-perm var/lib/umegaya/*
The permissions are ‘drwxrwsr-x www-data/www-data’ to let apache write in.
diff --git a/debian/umegaya.lintian-overrides b/debian/umegaya.lintian-overrides
index 5970f85..f3f702f 100644
--- a/debian/umegaya.lintian-overrides
+++ b/debian/umegaya.lintian-overrides
@@ -1,2 +1,4 @@
 # Umegaya is a recursive acronym.
 umegaya: description-starts-with-package-name
+# The permissions are ‘drwxrwsr-x www-data/www-data’ to let apache write in.
+umegaya: non-standard-dir-perm var/lib/umegaya/*

Depend on curl instead of recommending it.
Commands do not check whether curl is available or not.
diff --git a/debian/control b/debian/control
index cd306ec..20929cc 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,8 @@ Homepage: http://umegaya.branchable.com
 
 Package: umegaya
 Architecture: all
-Depends: devscripts,
+Depends: curl,
+         devscripts,
          libberkeleydb-perl,
          libmouse-perl,
          libyaml-libyaml-perl,
@@ -23,8 +24,7 @@ Depends: devscripts,
          subversion,
          ${perl:Depends},
          ${misc:Depends}
-Recommends: curl,
-            ${misc:Recommends}
+Recommends: ${misc:Recommends}
 Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a

Current changelog.
diff --git a/debian/changelog b/debian/changelog
index 8dde818..87ca1b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,11 +9,16 @@ umegaya (0.14) UNRELEASED; urgency=low
   152defd Transfer umegaya-guess-url's logic to Umegaya.pm, and stop
           reporting download URLs.
   9a5f01b Correct for downloading data from Blends managed Git repositories.
-    (     Closes: #731455)
+          Closes: #731455
+  e810177 Moved the source repository to collab-maint.
 
   [ Andreas Tille ]
   f7cc82e Change default path to files for UDD bibref gatherer.
 
+  [ Paul Wise ]
+  728dadc Use debian/upstream/metadata, support others for backwards
+          compatibility.
+  9dba911 Use curl instead of GET since it can fail on HTTP errors.
 
  -- Charles Plessy <plessy@debian.org>  Fri, 03 Jan 2014 21:01:55 +0900
 

Link to the UDD.
Git-Dch: Ignore
diff --git a/index.mdwn b/index.mdwn
index 8caab2c..746e5c4 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -4,13 +4,13 @@ Umegaya — MEtadata GAtherer using YAml
 Umegaya is a gatherer of meta information about the software packaged in
 Debian.  This metadata is accumlated by the package maintainer in the version
 control system containing the Debian souce package, in a file called
-[`debian/upstream/metadata`](http://dep.debian.net/deps/dep12), and it is collected by
-the Umegaya web service each time it is accessed.  The Umegaya web service then
-aggregates information about all the packages it knows, and outputs as tables
-or YAML records that can be loaded in central information hubs like the
-Ultimate Debian Database.  Optionally, Umegaya will keep a local copy if the
-files it retrieves from the VCS.  See also [[!debwiki UpstreamMetadata]] on the
-Debian wiki.
+[`debian/upstream/metadata`](http://dep.debian.net/deps/dep12), and it is
+collected by the Umegaya web service each time it is accessed.  The Umegaya web
+service then aggregates information about all the packages it knows, and
+outputs as tables or YAML records that can be loaded in central information
+hubs like the [Ultimate Debian Database](https://udd.debian.org/).  Optionally,
+Umegaya will keep a local copy if the files it retrieves from the VCS.  See
+also [[!debwiki UpstreamMetadata]] on the Debian wiki.
 
 Umegaya is distributed under the BOLA [[LICENSE]].
 

Moved the source repository to collab-maint.
Consider umegaya.branchable.com a mirror.
diff --git a/debian/control b/debian/control
index dd6d3b8..cd306ec 100644
--- a/debian/control
+++ b/debian/control
@@ -8,8 +8,8 @@ Build-Depends: debhelper (>= 9),
                perl,
                perl-doc
 Standards-Version: 3.9.4
-Vcs-Browser: http://source.umegaya.branchable.com/?p=source.git;a=tree
-Vcs-Git: git://umegaya.branchable.com/
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/umegaya.git
+Vcs-Git: git://anonscm.debian.org/collab-maint/umegaya.git
 Homepage: http://umegaya.branchable.com
 
 Package: umegaya
diff --git a/debian/copyright b/debian/copyright
index 1317159..e2216cf 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,5 +1,5 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Source: http://source.umegaya.branchable.com/?p=source.git;a=tags
+Source: git://anonscm.debian.org/collab-maint/umegaya.git
 
 Files: *
 Copyright: none claimed
diff --git a/scripts/umegaya-adm b/scripts/umegaya-adm
index d306c3e..051142c 100755
--- a/scripts/umegaya-adm
+++ b/scripts/umegaya-adm
@@ -181,6 +181,6 @@ Charles Plessy <plessy@debian.org>
 
 =head1 SOURCE
 
-http://source.umegaya.branchable.com/?p=source.git;a=blob;f=scripts/umegaya-adm
+http://anonscm.debian.org/gitweb/?p=collab-maint/umegaya.git;a=blob;f=scripts/umegaya-adm
 
 =cut

Use curl instead of GET since it can fail on HTTP errors
diff --git a/lib/Umegaya.pm b/lib/Umegaya.pm
index 8814876..574db49 100644
--- a/lib/Umegaya.pm
+++ b/lib/Umegaya.pm
@@ -17,13 +17,13 @@ sub download_command {
     # Download through gitweb for packages hosted on Alioth.
     if ($command =~ m,^git://(?:git|anonscm).debian.org,) {
         $command =~ s,^git://(?:git|anonscm).debian.org/g?i?t?/?(.*),http://anonscm.debian.org/gitweb/?p=$1;a=blob_plain;f=debian/$file;hb=HEAD,;
-        $command = qq(GET "$command");
+        $command = qq(curl --fail --silent "$command");
         return $command;
     }
     # GitHub
     if ($command =~ m,://github.com/,) {
         $command =~ m,://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$,;
-        $command = "GET https://raw.github.com/$1/$2/master/debian/$file";
+        $command = "curl --fail --silent https://raw.github.com/$1/$2/master/debian/$file";
         return $command;
     }
     # Try git archive for other git-hosted packages.

Correct the URL to the canonical umegaya gitweb
diff --git a/scripts/umegaya-adm b/scripts/umegaya-adm
index 1bfc6a5..d306c3e 100755
--- a/scripts/umegaya-adm
+++ b/scripts/umegaya-adm
@@ -181,6 +181,6 @@ Charles Plessy <plessy@debian.org>
 
 =head1 SOURCE
 
-http://anonscm.debian.org/gitweb/?p=users/plessy/umegaya.git;a=blob;f=scripts/umegaya-adm
+http://source.umegaya.branchable.com/?p=source.git;a=blob;f=scripts/umegaya-adm
 
 =cut

Use debian/upstream/metadata, support others for backwards compatibility.
Fall back on debian/upstream and debian/upstream-metadata.yaml.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index cdeafb4..a18d12a 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -23,7 +23,7 @@ curl http://localhost/umegaya/yaml/B<key>
 B<Umegaya> is a gatherer of meta information about the software packaged in
 Debian. This metadata is accumlated by the package maintainer in the version
 control system containing the Debian souce package, in a file called
-C<debian/upstream>, and it is collected by the Umegaya web service each time it
+C<debian/upstream/metadata>, and it is collected by the Umegaya web service each time it
 is accessed.  The Umegaya web service then aggregates information about all the
 packages it knows, and outputs as tables or YAML records that can be loaded in
 central information hubs like the Ultimate Debian Database.
@@ -159,8 +159,16 @@ sub refresh {
     my $package = shift;
     say "Refreshing data for $package" if $debug;
     my $package_url = Umegaya->new(url => $stored{"$package:YAML-URL"});
-    my $package_metadata_yaml_command = $package_url->download_command("upstream");
+    my $package_metadata_yaml_command = $package_url->download_command("upstream/metadata");
     my $package_metadata_yaml = qx($package_metadata_yaml_command);
+    if ( !$package_metadata_yaml ) {
+	$package_metadata_yaml_command = $package_url->download_command("upstream");
+	$package_metadata_yaml = qx($package_metadata_yaml_command);
+    }
+    if ( !$package_metadata_yaml ) {
+	$package_metadata_yaml_command = $package_url->download_command("upstream-metadata.yaml");
+	$package_metadata_yaml = qx($package_metadata_yaml_command);
+    }
     if ( $store_files ) {
 	$package =~ /^(.)/; # first letter
 	my $pool = $1;
diff --git a/conf/umegaya.conf b/conf/umegaya.conf
index a658783..0a2ef3b 100644
--- a/conf/umegaya.conf
+++ b/conf/umegaya.conf
@@ -29,7 +29,7 @@ refresh_blends: 0
 # umegaya-ddc-ping sends messages to syslog if the following is uncommented.
 #messages: syslog
 
-# Will store a copy of debian/upstream and debian/copyright if set to a location.
+# Will store a copy of debian/upstream/metadata and debian/copyright if set to a location.
 #store_files: /var/lib/umegaya/packages-metadata
 
 # URLs for Umegaya
diff --git a/debian/control b/debian/control
index bcb278b..dd6d3b8 100644
--- a/debian/control
+++ b/debian/control
@@ -29,5 +29,6 @@ Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a
  version control system containing the source package, in a file called
- debian/upstream, and collected by the web aggregator each time it is accessed.
+ debian/upstream/metadata, and collected by the web aggregator each time
+ it is accessed.
 
diff --git a/index.mdwn b/index.mdwn
index 34eecfc..8caab2c 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -4,7 +4,7 @@ Umegaya — MEtadata GAtherer using YAml
 Umegaya is a gatherer of meta information about the software packaged in
 Debian.  This metadata is accumlated by the package maintainer in the version
 control system containing the Debian souce package, in a file called
-[`debian/upstream`](http://dep.debian.net/deps/dep12), and it is collected by
+[`debian/upstream/metadata`](http://dep.debian.net/deps/dep12), and it is collected by
 the Umegaya web service each time it is accessed.  The Umegaya web service then
 aggregates information about all the packages it knows, and outputs as tables
 or YAML records that can be loaded in central information hubs like the
diff --git a/man.mdwn b/man.mdwn
index b07c414..f5e00bf 100644
--- a/man.mdwn
+++ b/man.mdwn
@@ -2,7 +2,7 @@ Umegaya's manual pages
 ======================
 
  * [[umegaya-ddc-ping.1]] — Umegaya's debian-devel-changes pinger
- * [[umegaya-guess-url.1]] — Converts a VCS URL in a URL to `debian/upstream`
+ * [[umegaya-guess-url.1]] — Converts a VCS URL in a URL to `debian/upstream/metadata`
  * [[umegaya-fields-stats.1]] — ranked list of fields from collected copyright files
  * [[umegaya-license-stats.1]] — ranked list of licenses from collected copyright files
  * [[umegaya-query.1]] — query a remote umegaya instance
diff --git a/setup.mdwn b/setup.mdwn
index 344099b..652ff8e 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -57,12 +57,12 @@ This (and below) assumes that the VCS name is the source package names.
 This is true in theory, but in practice, a safeguard for errors may be
 necessary.
 
-To determine if a package managed with Git on Alioth contains a debian/upstream file.
+To determine if a package managed with Git on Alioth contains a debian/upstream/metadata file.
 
     for repo in /git/debian-med/*.git
     do
       (cd $repo ; git ls-tree master debian/ |
-       grep 'debian/upstream$' > /dev/null && echo "$repo")
+       grep 'debian/upstream/metadata$' > /dev/null && echo "$repo")
     done | sed -e 's|/git/debian-med/||' -e 's|.git$||'
 
 
diff --git a/todo.mdwn b/todo.mdwn
index b867381..8561cfe 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -45,7 +45,7 @@ To do
  - dh_bibref ?
  - Regression tests.
  - Store YAML load errors.
- - An example debian/upstream file, that illustrates YAML syntax.
+ - An example debian/upstream/metadata file, that illustrates YAML syntax.
  - Use a proper installation script instead of debian/install.
 
  - umegaya-adm: return package list when invoked with -k and -v
@@ -64,13 +64,13 @@ To do
 
  - Integrate in the PTS.
 
- - Detect all source packages that contain a debian/upstream file, for instance using
-   apt-file's "-a source" option (see "#632254").
+ - Detect all source packages that contain a debian/upstream/metadata file,
+   for instance using apt-file's "-a source" option (see "#632254").
 
  - Provide an index of all packages in the Umegaya database (or with
    upstream metadata in the UDD).
 
- - Accept new debian/upstream files from the public.
+ - Accept new debian/upstream/metadata files from the public.
 
  - Integrate with http://duck.debian.net/
 

One more item on the todo list.
diff --git a/todo.mdwn b/todo.mdwn
index cbd80cc..b867381 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,6 +1,11 @@
 To do
 =====
 
+ - Failures to download the debian/upstream file should trigger a refractory
+   period using YAML-REFRESH-DATE so that umegaya-refresh-blends does not
+   hammer Alioth uselessly when a large number of binary packages correspond
+   to a single source package that has no debian/upstream file.
+
  - Keep an eye on https://joinup.ec.europa.eu/asset/adms_foss/description
 
  - umegaya-refresh-blends should log warnings instead of sending them

Current changelog.
diff --git a/debian/NEWS b/debian/NEWS
index 06eb198..287ff4c 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,6 +1,9 @@
 umegaya (0.14) unstable; urgency=low
 
-  For the transition to apache 2.4, the file ‘/etc/umegaya/apache.conf’
-  was moved to ‘/etc/apache2/conf-available/umegaya.conf’.
+  For the transition to apache 2.4, the file ‘/etc/umegaya/apache.conf’ was
+  moved to ‘/etc/apache2/conf-available/umegaya.conf’.
 
- -- Charles Plessy <plessy@debian.org>  Fri, 03 Jan 2014 18:53:47 +0900
+  umegaya-guess-url does not report guessed download URLs anymore. It guesses
+  the pakcage name from the URL.
+
+ -- Charles Plessy <plessy@debian.org>  Sat, 04 Jan 2014 22:21:10 +0900
diff --git a/debian/changelog b/debian/changelog
index 696ebc6..8dde818 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,15 @@
-umegaya (0.14) UNRELEASED; urgency=medium
+umegaya (0.14) UNRELEASED; urgency=low
 
   [ Charles Plessy ]
   b4ca35b example-push-metadata: removed a space causing a syntax error.
   ff5658c ddc-ping: further restrict to subjects starting with 'Accepted'.
   91ea80c Transition to Apache 2.4.
+  e3fdc6d ebcb7ec cea94ed Transfer in a separate module the functions for
+          converting URL to download commands.
+  152defd Transfer umegaya-guess-url's logic to Umegaya.pm, and stop
+          reporting download URLs.
+  9a5f01b Correct for downloading data from Blends managed Git repositories.
+    (     Closes: #731455)
 
   [ Andreas Tille ]
   f7cc82e Change default path to files for UDD bibref gatherer.

Correct for downloading data from Blends managed Git repositories as well.
Closes: #731455
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index f0a3a95..38f7aca 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -1,10 +1,12 @@
-#!/bin/sh
+#!/bin/bash
 
 set -e
 
 # Exit if refresh_blends is null in umegaya.conf.
-[ $(grep ^refresh_blends /etc/umegaya/umegaya.conf |
-  sed -r 's/refresh_blends:\s+//') = 0 ] && exit 0
+[ ! "$(awk '/^refresh_blends/ {print $2}' /etc/umegaya/umegaya.conf)" = 1 ] && exit 0
+
+# Debug mode ?
+[ "$(awk '/^debug/ {print $2}' /etc/umegaya/umegaya.conf)" = 1 ] && DEBUG=1
 
 # Exit if curl, debcheckout, umegaya-adm, umegaya-guess-url or svn are not installed.
 # Exit code is zero as this script is intended as a cron job.
@@ -14,33 +16,44 @@ set -e
 [ -x /usr/bin/umegaya-guess-url ] || exit 0
 [ -x /usr/bin/svn ]               || exit 0
 
-# Start with debichem med and science, but later let's fetch all the
-# names from $(svn ls svn://svn.debian.org/blends/projects/)
-BLENDS='debichem debian-med debian-science'
+# Hardcode the location of the tasks files, since we are transitionning
+# from Subversion to Git.
 
-#set -x
-for BLEND in $BLENDS
-do
-  BLEND_URL=$(debcheckout -d $BLEND | grep url | cut -f2)
+DEBICHEM_URL="svn://svn.debian.org/blends/projects/debichem/trunk/debichem"
+DEBIAN_MED_URL="svn://svn.debian.org/blends/projects/med/trunk/debian-med"
+DEBIAN_SCIENCE_URL="git://anonscm.debian.org/blends/projects/science.git"
 
-  # Learn VCS URL for packages not yet in Debian.
-  for TASK in $(svn ls $BLEND_URL/tasks)
-  do
-    for VCS_URL in $(svn cat $BLEND_URL/tasks/$TASK | grep 'Vcs-[SG]' | cut -f2 -d' ')
+declare -A BLEND
+
+BLENDS[debichem-URLs]='for file in $(svn ls $DEBICHEM_URL/tasks) ; do svn cat $DEBICHEM_URL/tasks/$file ; done'
+BLENDS[debichem-pack]='svn cat $DEBICHEM_URL/debian/control'
+
+BLENDS[debian-med-URLs]='for file in $(svn ls $DEBIAN_MED_URL) ; do svn cat $DEBIAN_MED_URL/$file ; done'
+BLENDS[debian-med-pack]='svn cat $DEBIAN_MED_URL/debian/control'
+
+BLENDS[debian-science-URLs]='git archive --remote=$DEBIAN_SCIENCE_URL HEAD:tasks          | tar xf - --to-stdout'
+BLENDS[debian-science-pack]='git archive --remote=$DEBIAN_SCIENCE_URL HEAD:debian control | tar xf - --to-stdout'
+
+
+for BLEND in debichem debian-med debian-science
+do
+[ $DEBUG ] && echo "Next blend: $BLEND"
+# Override the Umegaya database with the information from the tasks file.
+    for VCS_URL in $(eval ${BLENDS[$BLEND-URLs]} | awk '/^Vcs-[SG]/ {print $2}')
     do
-      PACKAGE=$(umegaya-guess-url $VCS_URL | cut -f1)
-      [ $PACKAGE ] &&
-      umegaya-adm -p $PACKAGE -k YAML-URL -v $VCS_URL
+        [ $DEBUG ] && echo "$VCS_URL"
+        PACKAGE=$(umegaya-guess-url $VCS_URL | cut -f1)
+        [ $PACKAGE ] &&
+        umegaya-adm -p $PACKAGE -k YAML-URL -v $VCS_URL
     done
-  done
-
-  # Refresh Umegaya for each package.
+# Refresh Umegaya for each package.
   PACKAGES=$(
-    svn cat $BLEND_URL/debian/control |
+    eval ${BLENDS[$BLEND-pack]} |
     grep -e ^Recommends -e ^Suggests |
     sed -e 's/,//g' -e 's/|//g' -e 's/Recommends://g' -e 's/Suggests://g' )
   for PACKAGE in $PACKAGES 
   do
+    [ $DEBUG ] && echo "$PACKAGE"
     SOURCE=$(apt-cache showsrc $PACKAGE 2> /dev/null | grep Package -m1 | awk '{print $2}')
     if [ "$SOURCE" != "" ] ; then
       # make sure a failed ping will not interupt script

Corrections for GitHub.
diff --git a/lib/Umegaya.pm b/lib/Umegaya.pm
index 777e213..8814876 100644
--- a/lib/Umegaya.pm
+++ b/lib/Umegaya.pm
@@ -21,8 +21,8 @@ sub download_command {
         return $command;
     }
     # GitHub
-    if ($command =~ m,^git://github.com/,) {
-        $command =~ m,^git://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$,;
+    if ($command =~ m,://github.com/,) {
+        $command =~ m,://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$,;
         $command = "GET https://raw.github.com/$1/$2/master/debian/$file";
         return $command;
     }
@@ -49,7 +49,8 @@ sub guess_package {
         # Other repositories
         "svn://svn.debian.org/.*/([a-z0-9\+\-\.]+)/trunk",
         "git://git.debian.org/.+/([a-z0-9\+\-\.]+).git",
-        "git://github.com/[A-Za-z0-9\+\-\.]+/([a-z0-9\+\-\.]+).git"
+        "git://anonscm.debian.org/.+/([a-z0-9\+\-\.]+).git",
+        "://github.com/[A-Za-z0-9\+\-\.]+/([a-z0-9\+\-\.]+).git"
 	) {
         return $1 if $self->url =~ m/$guess/;
     }

Error message when upstream file is not writable.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index 477d267..cdeafb4 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -164,6 +164,7 @@ sub refresh {
     if ( $store_files ) {
 	$package =~ /^(.)/; # first letter
 	my $pool = $1;
+        say "Will not be able to write $store_files/$pool/$package.upstream: crashing soon..." unless -w "$store_files/$pool/$package.upstream";
         open(my $debian_upstream, ">", "$store_files/$pool/$package.upstream")
             or die "Can not write $store_files/$pool/$package.upstream: $!";
         print $debian_upstream $package_metadata_yaml;

Transfer umegaya-guess-url's logic to Umegaya.pm. Stop reporting download URLs.
diff --git a/lib/Umegaya.pm b/lib/Umegaya.pm
index 3719216..777e213 100644
--- a/lib/Umegaya.pm
+++ b/lib/Umegaya.pm
@@ -20,6 +20,12 @@ sub download_command {
         $command = qq(GET "$command");
         return $command;
     }
+    # GitHub
+    if ($command =~ m,^git://github.com/,) {
+        $command =~ m,^git://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$,;
+        $command = "GET https://raw.github.com/$1/$2/master/debian/$file";
+        return $command;
+    }
     # Try git archive for other git-hosted packages.
     if ($command =~ /^git/) {
         $command = "git archive --remote=$command HEAD:debian $file | tar --extract --file - --to-stdout";
@@ -28,4 +34,26 @@ sub download_command {
     die "Could not guess command for " . $self->url;
 }
 
+sub guess_package {
+    my $self = shift;
+    foreach my $guess (
+        # Debian Med
+        "svn://svn.debian.org/debian-med/trunk/packages.*/([a-z0-9\+\-\.]+)/trunk",
+        # Debichem
+        "svn://svn.debian.org/s?v?n?/?debichem/unstable/([a-z0-9\+\-\.]+)/",
+        "svn://svn.debian.org/s?v?n?/?debichem/experimental/([a-z0-9\+\-\.]+)/",
+        "svn://svn.debian.org/s?v?n?/?debichem/wnpp/([a-z0-9\+\-\.]+)/",
+        # Debian Science
+        "svn://svn.debian.org/s?v?n?/?debian-science/packages/R/([a-z0-9\+\-\.]+)/",
+        "svn://svn.debian.org/s?v?n?/?debian-science/packages/([a-z0-9\+\-\.]+)/",
+        # Other repositories
+        "svn://svn.debian.org/.*/([a-z0-9\+\-\.]+)/trunk",
+        "git://git.debian.org/.+/([a-z0-9\+\-\.]+).git",
+        "git://github.com/[A-Za-z0-9\+\-\.]+/([a-z0-9\+\-\.]+).git"
+	) {
+        return $1 if $self->url =~ m/$guess/;
+    }
+    return undef;
+}
+
 1;
diff --git a/man/umegaya-guess-url.1.mdwn b/man/umegaya-guess-url.1.mdwn
index 33eec2e..d55b1c0 100644
--- a/man/umegaya-guess-url.1.mdwn
+++ b/man/umegaya-guess-url.1.mdwn
@@ -1,10 +1,10 @@
 % UMEGAYA-GUESS-URL(1) Umegaya User Manual
 % Charles Plessy
-% April 8, 2012
+% January 4, 2014
 
 # NAME
 
-umegaya-guess-url - Converts a VCS URL in a URL to "debian/upstream"
+umegaya-guess-url - Guesses a package name from a VCS URL.
 
 # SYNOPSIS
 
@@ -14,23 +14,8 @@ umegaya-guess-url VCS_URL
 
 VCS (version control system) URLs indicate where to clone or check out
 anonymously source packages.  `umegaya-guess-url` attempts to guess the package
-name and convert the VCS URL in either a Subversion URL that can be used by
-`svn cat`, or in a HTTP URL that can be used to retrieve `debian/upstream` via
-Gitweb.
-
-It recoginses VCS URLs from the following Debian Pure Blends.
-
-  svn://svn.debian.org/debian-med/trunk/packages/+?/([a-z0-9\+\-\.]+)/trunk
-  git://git.debian.org/debian-med/([a-z0-9\+\-\.]+).git
- 
-  svn://svn.debian.org/s?v?n?/?debichem/unstable/([a-z0-9\+\-\.]+)/
-  svn://svn.debian.org/s?v?n?/?debichem/experimental/([a-z0-9\+\-\.]+)/
-  svn://svn.debian.org/s?v?n?/?debichem/wnpp/([a-z0-9\+\-\.]+)/
-  git://git.debian.org/g?i?t?/?debichem/packages/([a-z0-9\+\-\.]+).git
-
-  svn://svn.debian.org/s?v?n?/?debian-science/packages/R/([a-z0-9\+\-\.]+)/
-  svn://svn.debian.org/s?v?n?/?debian-science/packages/([a-z0-9\+\-\.]+)/
-  git://git.debian.org/g?i?t?/?debian-science/packages/([a-z0-9\+\-\.]+).git
+name when only this URL is known.  This is useful when harvesting VCS URLs from
+the tasks files of Debian Pure Blends.
 
 # RETURNS
 
@@ -38,8 +23,8 @@ A package name, followed by a tabulation, followed by an URL.
 
 # EXAMPLE
 
-  $ ./scripts/umegaya-guess-url $(debcheckout -d emboss | grep url | cut -f2)
-  emboss	http://git.debian.org/?p=debian-med/emboss.git;a=blob_plain;f=debian/upstream;hb=HEAD
+    $ umegaya-guess-url $(debcheckout -d emboss | grep url | cut -f2)
+    emboss
 
 # SEE ALSO
 
@@ -47,7 +32,7 @@ A package name, followed by a tabulation, followed by an URL.
 
 # SOURCE
 
-http://git.debian.org/?p=users/plessy/umegaya.git
+http://umegaya.branchable.com/
 
 # LIMITATIONS
 
diff --git a/scripts/umegaya-guess-url b/scripts/umegaya-guess-url
index b9fc0b4..87c0fb6 100755
--- a/scripts/umegaya-guess-url
+++ b/scripts/umegaya-guess-url
@@ -5,71 +5,18 @@ use warnings;
 
 use 5.10.0;
 
+use Umegaya;
+
 my $package_url = shift;
-my $package;
-chomp $package_url;
-given ($package_url) {
-  when (undef) {
+
+unless (defined($package_url)) {
     die "Usage: umegaya-guess-url Vcs-URL\n";
-  }
-  when (/^svn/) {
-    # Debian Med
-    if (m|debian-med/trunk/packages|) {
-        if (m|svn://svn.debian.org/debian-med/trunk/packages.*/([a-z0-9\+\-\.]+)/trunk| ) {
-            $package = $1;
-        } else {
-            die <<"ERROR_MESSAGE"
-Could not parse « $package_url ».
-The package is located in Debian Med’s Subversion repository according to its
-VCS URL, but it does not point at a trunk directory as it should. See the
-following page for more information.
-http://debian-med.alioth.debian.org/docs/policy.html#svn-repository-structure
-ERROR_MESSAGE
-        }
-    }
-    # Debichem
-    elsif (m|svn://svn.debian.org/s?v?n?/?debichem/unstable/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debichem/experimental/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debichem/wnpp/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
-    }
-    # Debian Science
-    elsif (m|svn://svn.debian.org/s?v?n?/?debian-science/packages/R/([a-z0-9\+\-\.]+)/| ) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debian-science/packages/([a-z0-9\+\-\.]+)/| ) {
-      $package = $1;
-    }
-    # Other repositories
-    elsif (m|svn://svn.debian.org/.*/([a-z0-9\+\-\.]+)/trunk| ) {
-      $package = $1;
-    }
-    else {
-      die "Could not detect package name for $package_url\n";
-    }
-    $package_url .= "debian/upstream";
-  }
-  when (/^git/) {
-    if    (m|git://git.debian.org/.+/([a-z0-9\+\-\.]+).git|) {
-      $package = $1;
-      $package_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/upstream;hb=HEAD|;
-    }
-    # GitHub (master branch only)
-    elsif (m|git://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$|) {
-       $package = $2;
-       $package_url = "https://raw.github.com/$1/$package/master/debian/upstream"
-    }
-    else {
-      die "Could not detect package name for $package_url\n";
-    }
-  }
-  default {
-    die "Only Subversion and Git URLs are supported"
-  }
 }
 
-say "$package\t$package_url";
+my $url = Umegaya->new(url => $package_url);
+
+unless (defined($url->guess_package)) {
+    die "Could not detect package name for $package_url\n";
+}
+
+say $url->guess_package;

Install the Umegaya library.
diff --git a/debian/install b/debian/install
index d7f9926..65e4478 100644
--- a/debian/install
+++ b/debian/install
@@ -1,3 +1,5 @@
+apache2/error-modrewrite/index.html	usr/share/umegaya/htdocs/error-modrewrite
+lib/Umegaya.pm			usr/share/perl5
 cgi-bin/umegaya 		usr/lib/cgi-bin
 conf/robots.txt			etc/umegaya
 conf/umegaya.conf		etc/umegaya
@@ -8,4 +10,3 @@ scripts/umegaya-fields-stats	etc/cron.daily
 scripts/umegaya-license-stats	etc/cron.daily
 scripts/umegaya-refresh-blends	etc/cron.daily
 scripts/umegaya-self-clean	etc/cron.daily
-apache2/error-modrewrite/index.html	usr/share/umegaya/htdocs/error-modrewrite

Update requirements.
diff --git a/setup.mdwn b/setup.mdwn
index 7533a76..344099b 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -7,18 +7,17 @@ Programs needed
  - Apache
  - Berkeley DB
  - The following Perl modules:
+   - BerkeleyDB
    - LWP
-   - YAML
+   - Mouse
+   - YAML::XS
    - YAML::Appconfig
 
-YAML::Appconfig is ageing and generates deprecation warnings with recent
-versions of Perl, but this has been corrected in Debian's 0.16-2 package.
-
 Configuration
 -------------
 
- - Set up an Apache virtual host using the `apache.conf` file in
-   `/etc/umegaya/`.
+ - Set up an Apache virtual host using the `umegaya.conf` file in
+   `/etc/apache2/conf-available/`.
  - Set up a directory where Apache can write the `umegaya.db` Berkeley DB
    and optionally save a copy of the upstream, copyright and control files
    in the `packages-metatata` pool (by default in `/var/lib/umegaya`).

Download through gitweb when packages are hosted on Alioth.
diff --git a/lib/Umegaya.pm b/lib/Umegaya.pm
index 4f7893c..3719216 100644
--- a/lib/Umegaya.pm
+++ b/lib/Umegaya.pm
@@ -7,12 +7,20 @@ has 'url' => (is => 'rw', isa => 'Str');
 sub download_command {
     my $self = shift;
     my $file = shift;
-    my $command = $self->url;
+    my $command = $self->url; # Starting with the URL, build a command.
+    # Use svn cat for packages hosted in Subversion.
     if ($command =~ /^svn/) {
         $command .= '/' unless $command =~ m(/$);
         $command = "svn cat ${command}debian/$file";
         return $command;
     }
+    # Download through gitweb for packages hosted on Alioth.
+    if ($command =~ m,^git://(?:git|anonscm).debian.org,) {
+        $command =~ s,^git://(?:git|anonscm).debian.org/g?i?t?/?(.*),http://anonscm.debian.org/gitweb/?p=$1;a=blob_plain;f=debian/$file;hb=HEAD,;
+        $command = qq(GET "$command");
+        return $command;
+    }
+    # Try git archive for other git-hosted packages.
     if ($command =~ /^git/) {
         $command = "git archive --remote=$command HEAD:debian $file | tar --extract --file - --to-stdout";
         return $command;

Transfer in a separate module the functions for converting URL to download commands.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index 174b49e..477d267 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -66,6 +66,7 @@ use 5.10.0;
 use BerkeleyDB;
 use CGI;
 use LWP::Simple qw(get);
+use Umegaya;
 use YAML::XS qw(Load Dump DumpFile);
 use YAML::AppConfig;
 
@@ -128,7 +129,7 @@ if ($table | $yaml) {
     exit;
 }
 
-# The URL of the 'upstream' file is never refreshed.
+# The URL of the package's repository is never refreshed.
 unless (defined ($stored{"$package:YAML-URL"})) {
     $stored{"$package:YAML-URL"} = qx(debcheckout -d $package | grep url | cut -f2) || "NA";
     chomp $stored{"$package:YAML-URL"};
@@ -137,10 +138,10 @@ unless (defined ($stored{"$package:YAML-URL"})) {
 # Refrain to refresh if the last update is still fresh, to avoid loading Alioth.
 if (defined ($stored{"$package:YAML-REFRESH-DATE"})) {
     say "Not updated since:", time - $stored{"$package:YAML-REFRESH-DATE"} if $debug;
-    $stored{"$package:YAML-REFRESH-DATE"} = refresh_from_url($stored{"$package:YAML-URL"}) if time - $stored{"$package:YAML-REFRESH-DATE"} > $delay;
+    $stored{"$package:YAML-REFRESH-DATE"} = refresh($package) if time - $stored{"$package:YAML-REFRESH-DATE"} > $delay;
 } else {
     say "$package is not yet in the database, trying to pull its metadata…" if $debug;
-    $stored{"$package:YAML-REFRESH-DATE"} = refresh_from_url($stored{"$package:YAML-URL"})
+    $stored{"$package:YAML-REFRESH-DATE"} = refresh($package)
 }
 
 # Output for http://localhost/umegaya/package/key URL.
@@ -153,44 +154,31 @@ foreach (keys (%stored)) {
 }
 say "No $key key for package ${package}." if $debug;
 
-# Reconstructs an URL to the a target file in the Debian directory.
-# For Git repositories on Alioth, it relies on the Gitweb interface.
-sub guess_file_url {
-    my $file_url = shift;
-    my $file_to_download = shift;
-    if ($file_url =~ /^svn/) {
-        $file_url .= '/' unless $file_url =~ m(/$);
-        $file_url .= "debian/$file_to_download";
-    }
-    $file_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/$file_to_download;hb=HEAD| if $file_url =~ /^git/;
-    say "Will retreive $file_url for debian/$file_to_download." if $debug;
-    return $file_url;
-}
-
 # Refresh and return a time stamp; store files if asked.
-sub refresh_from_url {
-    my $package_url = shift;
-    say "Refreshing data from $package_url" if $debug;
-    my $debian_upstream_url = guess_file_url($package_url, "upstream");
-    my $package_metadata_yaml;
-    $package_metadata_yaml = svn_export($debian_upstream_url) if $debian_upstream_url =~ /^svn/;
-    $package_metadata_yaml = get($debian_upstream_url ) if $debian_upstream_url =~ /^http/;
+sub refresh {
+    my $package = shift;
+    say "Refreshing data for $package" if $debug;
+    my $package_url = Umegaya->new(url => $stored{"$package:YAML-URL"});
+    my $package_metadata_yaml_command = $package_url->download_command("upstream");
+    my $package_metadata_yaml = qx($package_metadata_yaml_command);
     if ( $store_files ) {
-	$package =~ /^(.)/;
+	$package =~ /^(.)/; # first letter
 	my $pool = $1;
-        open(my $debian_upstream, ">", "$store_files/$pool/${package}.upstream")
-            or die "Can not write $store_files/$pool/${package}.upstream: $!";
+        open(my $debian_upstream, ">", "$store_files/$pool/$package.upstream")
+            or die "Can not write $store_files/$pool/$package.upstream: $!";
         print $debian_upstream $package_metadata_yaml;
         close($debian_upstream);
         if ( $debian_control ) {
-            my $debian_control_url = guess_file_url($package_url, "control");
-            system(qq(svn cat "$debian_control_url" > $store_files/$pool/${package}.control)) if $debian_control_url =~ /^svn/;
-            system(qq(GET "$debian_control_url" > $store_files/$pool/${package}.control)) if $debian_control_url =~ /^http/;
+            die "Can not write $store_files/$pool/$package.control\n" unless -w "$store_files/$pool/$package.control";
+            print "Writing $store_files/$pool/$package.control ... " if $debug;
+            system($package_url->download_command("control") . " > $store_files/$pool/$package.control");
+            say "done." if $debug;
         }
         if ( $debian_copyright ) {
-            my $debian_copyright_url = guess_file_url($package_url, "copyright");
-            system(qq(svn cat "$debian_copyright_url" > $store_files/$pool/${package}.copyright)) if $debian_copyright_url =~ /^svn/;
-            system(qq(GET "$debian_copyright_url" > $store_files/$pool/${package}.copyright)) if $debian_copyright_url =~ /^http/;
+            die "Can not write $store_files/$pool/$package.copyright\n" unless -w "$store_files/$pool/$package.copyright";
+            print "Writing $store_files/$pool/$package.copyright ... " if $debug;
+            system($package_url->download_command("copyright") .  " > $store_files/$pool/$package.copyright");
+            say "done." if $debug;
         }
     }
     my $package_metadata;
@@ -235,9 +223,3 @@ sub refresh_from_url {
     $stored{"${package}:YAML-ALL"} = $package_metadata_yaml;
     return time;
 }
-
-# For the moment only SVN is supported.
-sub svn_export {
-    my $url = shift;
-    return qx(svn cat $url);
-}
diff --git a/debian/control b/debian/control
index 58a4e56..bcb278b 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Package: umegaya
 Architecture: all
 Depends: devscripts,
          libberkeleydb-perl,
+         libmouse-perl,
          libyaml-libyaml-perl,
          libyaml-appconfig-perl,
          libwww-perl,
diff --git a/lib/Umegaya.pm b/lib/Umegaya.pm
new file mode 100644
index 0000000..4f7893c
--- /dev/null
+++ b/lib/Umegaya.pm
@@ -0,0 +1,23 @@
+package Umegaya;
+
+use Mouse;
+
+has 'url' => (is => 'rw', isa => 'Str');
+
+sub download_command {
+    my $self = shift;
+    my $file = shift;
+    my $command = $self->url;
+    if ($command =~ /^svn/) {
+        $command .= '/' unless $command =~ m(/$);
+        $command = "svn cat ${command}debian/$file";
+        return $command;
+    }
+    if ($command =~ /^git/) {
+        $command = "git archive --remote=$command HEAD:debian $file | tar --extract --file - --to-stdout";
+        return $command;
+    }
+    die "Could not guess command for " . $self->url;
+}
+
+1;

Changelog entry.
diff --git a/debian/changelog b/debian/changelog
index eaf95f4..696ebc6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+umegaya (0.14) UNRELEASED; urgency=medium
+
+  [ Charles Plessy ]
+  b4ca35b example-push-metadata: removed a space causing a syntax error.
+  ff5658c ddc-ping: further restrict to subjects starting with 'Accepted'.
+  91ea80c Transition to Apache 2.4.
+
+  [ Andreas Tille ]
+  f7cc82e Change default path to files for UDD bibref gatherer.
+
+
+ -- Charles Plessy <plessy@debian.org>  Fri, 03 Jan 2014 21:01:55 +0900
+
 umegaya (0.13) unstable; urgency=low
 
   06dbcdc Hosting the source code on Branchable.

Transition to Apache 2.4.
- Use dh_apache2.
- Move configuration file.
- Add error page asking to enable mod_rewrite.
diff --git a/apache2/error-modrewrite/index.html b/apache2/error-modrewrite/index.html
new file mode 100644
index 0000000..22c76c6
--- /dev/null
+++ b/apache2/error-modrewrite/index.html
@@ -0,0 +1,5 @@
+<h1>Please enable Apache's rewrite module.</h1>
+
+<p>On Debian systems, this is done with the following command.</p>
+
+</p><code>sudo a2enmod rewrite</code></p>
diff --git a/apache2/umegaya.conf b/apache2/umegaya.conf
new file mode 100644
index 0000000..389a7af
--- /dev/null
+++ b/apache2/umegaya.conf
@@ -0,0 +1,23 @@
+Alias /umegaya/fields-stats /var/lib/umegaya/fields-stats
+Alias /umegaya/license-stats /var/lib/umegaya/license-stats
+<IfModule !rewrite_module>
+    Alias /umegaya /usr/share/umegaya/htdocs/error-modrewrite
+</IfModule>
+Alias /umegaya /usr/share/umegaya/htdocs
+
+<Directory /usr/share/umegaya/htdocs>
+    Options +FollowSymLinks
+    <IfModule rewrite_module>
+        RewriteEngine on
+        RewriteRule ^$ /cgi-bin/umegaya?help=1
+        RewriteRule ^table/([\w_\-]+)$ /cgi-bin/umegaya?table=1;key=$1 [B]
+        RewriteRule ^yaml/([\w_\-]+)$ /cgi-bin/umegaya?yaml=1;key=$1 [B]
+        RewriteRule ^([a-z0-9\.\-\+]+)/([\w_\-]+)$ /cgi-bin/umegaya?package=$1;key=$2 [B]
+    </IfModule>
+</Directory>
+
+#<VirtualHost *:80>
+#    ServerName umegaya.example.com
+#    ServerAdmin umegaya@example.com
+#    DocumentRoot /usr/share/umegaya/htdocs
+#</VirtualHost>
diff --git a/conf/apache.conf b/conf/apache.conf
deleted file mode 100644
index cd20afa..0000000
--- a/conf/apache.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-Alias /umegaya/fields-stats /var/lib/umegaya/fields-stats
-Alias /umegaya/license-stats /var/lib/umegaya/license-stats
-Alias /umegaya /usr/share/umegaya/htdocs
-
-<Directory /usr/share/umegaya/htdocs>
-    Options +FollowSymLinks
-    RewriteEngine on
-    RewriteRule ^$ /cgi-bin/umegaya?help=1
-    RewriteRule ^table/([\w_\-]+)$ /cgi-bin/umegaya?table=1;key=$1 [B]
-    RewriteRule ^yaml/([\w_\-]+)$ /cgi-bin/umegaya?yaml=1;key=$1 [B]
-    RewriteRule ^([a-z0-9\.\-\+]+)/([\w_\-]+)$ /cgi-bin/umegaya?package=$1;key=$2 [B]
-</Directory>
-
-#<VirtualHost *:80>
-#    ServerName umegaya.example.com
-#    ServerAdmin umegaya@example.com
-#    DocumentRoot /usr/share/umegaya/htdocs
-#</VirtualHost>
diff --git a/debian/NEWS b/debian/NEWS
new file mode 100644
index 0000000..06eb198
--- /dev/null
+++ b/debian/NEWS
@@ -0,0 +1,6 @@
+umegaya (0.14) unstable; urgency=low
+
+  For the transition to apache 2.4, the file ‘/etc/umegaya/apache.conf’
+  was moved to ‘/etc/apache2/conf-available/umegaya.conf’.
+
+ -- Charles Plessy <plessy@debian.org>  Fri, 03 Jan 2014 18:53:47 +0900
diff --git a/debian/apache2 b/debian/apache2
new file mode 100644
index 0000000..c2f2b78
--- /dev/null
+++ b/debian/apache2
@@ -0,0 +1 @@
+conf apache2/umegaya.conf
diff --git a/debian/control b/debian/control
index d1735ba..58a4e56 100644
--- a/debian/control
+++ b/debian/control
@@ -3,6 +3,7 @@ Maintainer: Charles Plessy <plessy@debian.org>
 Section: database
 Priority: optional
 Build-Depends: debhelper (>= 9),
+               dh-apache2,
                pandoc,
                perl,
                perl-doc
@@ -21,7 +22,8 @@ Depends: devscripts,
          subversion,
          ${perl:Depends},
          ${misc:Depends}
-Recommends: curl
+Recommends: curl,
+            ${misc:Recommends}
 Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a
diff --git a/debian/install b/debian/install
index e38489f..d7f9926 100644
--- a/debian/install
+++ b/debian/install
@@ -1,5 +1,4 @@
 cgi-bin/umegaya 		usr/lib/cgi-bin
-conf/apache.conf		etc/umegaya
 conf/robots.txt			etc/umegaya
 conf/umegaya.conf		etc/umegaya
 scripts/umegaya-adm		usr/bin
@@ -9,3 +8,4 @@ scripts/umegaya-fields-stats	etc/cron.daily
 scripts/umegaya-license-stats	etc/cron.daily
 scripts/umegaya-refresh-blends	etc/cron.daily
 scripts/umegaya-self-clean	etc/cron.daily
+apache2/error-modrewrite/index.html	usr/share/umegaya/htdocs/error-modrewrite
diff --git a/debian/links b/debian/links
index 2796233..16aff2b 100644
--- a/debian/links
+++ b/debian/links
@@ -1,2 +1 @@
 /etc/umegaya/robots.txt		/usr/share/umegaya/htdocs/robots.txt
-/etc/umegaya/apache.conf	/etc/apache2/conf.d/umegaya
diff --git a/debian/maintscript b/debian/maintscript
new file mode 100644
index 0000000..62dfe6e
--- /dev/null
+++ b/debian/maintscript
@@ -0,0 +1 @@
+mv_conffile /etc/umegaya/apache.conf /etc/apache2/conf-available/umegaya.conf
diff --git a/debian/postinst b/debian/postinst
deleted file mode 100644
index 358f326..0000000
--- a/debian/postinst
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# postinst script for umegaya
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <postinst> `abort-remove'
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-case "$1" in
-    configure)
-        if [ -x /etc/init.d/apache2 ]
-        then
-            if which /usr/sbin/invoke-rc.d >/dev/null 2>&1
-            then
-                invoke-rc.d apache2 reload || true
-            else
-                /etc/init.d/apache2 reload || true
-            fi
-        fi
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/rules b/debian/rules
index 329a85a..d09056c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 export DH_VERBOSE=1
 
 %:
-	dh $@
+	dh $@ --with apache2
 
 override_dh_auto_build:
 	perldoc -o nroff cgi-bin/umegaya               > man/umegaya.1

Link to DEP 12.
diff --git a/index.mdwn b/index.mdwn
index 2daa882..34eecfc 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -4,12 +4,13 @@ Umegaya — MEtadata GAtherer using YAml
 Umegaya is a gatherer of meta information about the software packaged in
 Debian.  This metadata is accumlated by the package maintainer in the version
 control system containing the Debian souce package, in a file called
-<code>debian/upstream</code>, and it is collected by the Umegaya web service
-each time it is accessed.  The Umegaya web service then aggregates information
-about all the packages it knows, and outputs as tables or YAML records that can
-be loaded in central information hubs like the Ultimate Debian Database.
-Optionally, Umegaya will keep a local copy if the files it retrieves from the
-VCS.  See also [[!debwiki UpstreamMetadata]] on the Debian wiki.
+[`debian/upstream`](http://dep.debian.net/deps/dep12), and it is collected by
+the Umegaya web service each time it is accessed.  The Umegaya web service then
+aggregates information about all the packages it knows, and outputs as tables
+or YAML records that can be loaded in central information hubs like the
+Ultimate Debian Database.  Optionally, Umegaya will keep a local copy if the
+files it retrieves from the VCS.  See also [[!debwiki UpstreamMetadata]] on the
+Debian wiki.
 
 Umegaya is distributed under the BOLA [[LICENSE]].
 

Since blends sentinel will be moved from alioth to blends.debian.org also on blends.debian.net the path will be moved from the gforge dir to the new location. Just provide a sensible default here.
diff --git a/conf/umegaya.conf b/conf/umegaya.conf
index bcbb0c2..a658783 100644
--- a/conf/umegaya.conf
+++ b/conf/umegaya.conf
@@ -38,4 +38,4 @@ local_url: http://localhost/umegaya
 ping_url: http://localhost/umegaya
 
 # Archive with upstream files for UDD bibref gatherer
-#archive_for_bibref_gatherer: /var/lib/gforge/chroot/home/groups/blends/htdocs/packages-metadata/packages-metadata.tar.bz2
+#archive_for_bibref_gatherer: /srv/blends.debian.org/www/packages-metadata/packages-metadata.tar.bz2

More things to do.
diff --git a/todo.mdwn b/todo.mdwn
index 027b235..cbd80cc 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -24,7 +24,7 @@ To do
    not package names.
  - Do not create empty file if contents were not retrieved.
  - Check if there is no buggy package names with spaces in the berkeley DB.
- - Do not create 404 Gitweb files.
+ - Do not create 404 Gitweb files nor '500 read timeout' files.
 
  - See the example file 'example-push-metadata' on how to clean a package-metadata
    repository before pushing
@@ -68,3 +68,5 @@ To do
  - Accept new debian/upstream files from the public.
 
  - Integrate with http://duck.debian.net/
+
+ - Report better errors when a package does not contain upstream medatdata.

Mention the write permissions of `packages-metadata` in the setup instructions.
diff --git a/setup.mdwn b/setup.mdwn
index 6e921b8..7533a76 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -19,8 +19,9 @@ Configuration
 
  - Set up an Apache virtual host using the `apache.conf` file in
    `/etc/umegaya/`.
- - Set up a directory where apache can write the `umegaya.db` Berkeley DB.  By
-   default it is `/var/lib/umegaya`.
+ - Set up a directory where Apache can write the `umegaya.db` Berkeley DB
+   and optionally save a copy of the upstream, copyright and control files
+   in the `packages-metatata` pool (by default in `/var/lib/umegaya`).
  - Make sure that the Umegaya administrator has also write access to the
    directory.
  - Umegaya finds the package's VCS using the `debcheckout` command of the
diff --git a/todo.mdwn b/todo.mdwn
index e197c97..027b235 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,9 +1,6 @@
 To do
 =====
 
- - Problem: make sure that Apache as the write permission on the pool.  This
-   will not be if a user creates a file with a usual umask.
-
  - Keep an eye on https://joinup.ec.europa.eu/asset/adms_foss/description
 
  - umegaya-refresh-blends should log warnings instead of sending them

ddc-ping: further restrict to subjects starting with 'Accepted'.
diff --git a/scripts/umegaya-ddc-ping b/scripts/umegaya-ddc-ping
index ae11566..3d714a1 100755
--- a/scripts/umegaya-ddc-ping
+++ b/scripts/umegaya-ddc-ping
@@ -5,7 +5,7 @@
 # trigger a ping for the corresponding package in an Umegaya instance.
 
 URL=$(awk '/^ping_url:/ {print $2 ; nextfile}' /etc/umegaya/umegaya.conf)
-PACKAGE=$(grep ^Subject -m1 | awk '{print $3}')
+PACKAGE=$(grep ^Subject -m1 | awk '/Subject: Accepted/ {print $3}')
 MESSAGES=$(awk '/^messages:/ {print $2 ; nextfile}' /etc/umegaya/umegaya.conf)
 
 if [ "$PACKAGE" != '' ] ; then

example-push-metadata: removed a space causing a syntax error.
diff --git a/scripts/example-push-metadata b/scripts/example-push-metadata
index 8ad1b59..64edb5d 100644
--- a/scripts/example-push-metadata
+++ b/scripts/example-push-metadata
@@ -14,7 +14,7 @@
 
 POOL=/var/lib/umegaya/packages-metadata/
 
-STAMP= ${TMPDIR-/tmp}/umegaya-timestamp
+STAMP=${TMPDIR-/tmp}/umegaya-timestamp
 
 rm -f $STAMP
 touch $STAMP

Mention cron-apt.
diff --git a/setup.mdwn b/setup.mdwn
index d5852e1..6e921b8 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -25,7 +25,8 @@ Configuration
    directory.
  - Umegaya finds the package's VCS using the `debcheckout` command of the
    devscripts package, so a `deb-src` line tracking Sid is necessary for a full
-   coverage.
+   coverage.  The [[!debpkg cron-apt]] package is useful to keep the apt cache
+   up to date.
 
 Triggering
 ----------

umegaya (0.13) unstable; urgency=low
06dbcdc Hosting the source code on Branchable.
2c14a12 Normalised debian/control with 'cme fix dpkg-control'.
5586d64 Conforms to Policy 3.9.4.
bf975bf Distribute the index, setup and todo files as documentation.
d482ec0 umegaya-fields-stats: ranked list of fields from copyright files
-- Charles Plessy <plessy@debian.org> Sat, 13 Apr 2013 19:27:36 +0900
diff --git a/debian/changelog b/debian/changelog
index 4cc8512..eaf95f4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+umegaya (0.13) unstable; urgency=low
+
+  06dbcdc Hosting the source code on Branchable.
+  2c14a12 Normalised debian/control with 'cme fix dpkg-control'.
+  5586d64 Conforms to Policy 3.9.4.
+  bf975bf Distribute the index, setup and todo files as documentation.
+  d482ec0 umegaya-fields-stats: ranked list of fields from copyright files
+
+ -- Charles Plessy <plessy@debian.org>  Sat, 13 Apr 2013 19:27:36 +0900
+
 umegaya (0.12) unstable; urgency=low
 
   2293ecd umegaya-query: a tool to avoid typing the long default URL.

Corrected a typo.
diff --git a/debian/install b/debian/install
index cabc8e8..e38489f 100644
--- a/debian/install
+++ b/debian/install
@@ -1,7 +1,7 @@
 cgi-bin/umegaya 		usr/lib/cgi-bin
 conf/apache.conf		etc/umegaya
 conf/robots.txt			etc/umegaya
-conv/umegaya.conf		etc/umegaya
+conf/umegaya.conf		etc/umegaya
 scripts/umegaya-adm		usr/bin
 scripts/umegaya-guess-url	usr/bin
 scripts/umegaya-ddc-ping	usr/bin

umegaya-fields-stats: ranked list of fields from collected copyright files
diff --git a/conf/apache.conf b/conf/apache.conf
index d14d42a..cd20afa 100644
--- a/conf/apache.conf
+++ b/conf/apache.conf
@@ -1,3 +1,4 @@
+Alias /umegaya/fields-stats /var/lib/umegaya/fields-stats
 Alias /umegaya/license-stats /var/lib/umegaya/license-stats
 Alias /umegaya /usr/share/umegaya/htdocs
 
diff --git a/debian/install b/debian/install
index 46188e7..cabc8e8 100644
--- a/debian/install
+++ b/debian/install
@@ -5,6 +5,7 @@ conv/umegaya.conf		etc/umegaya
 scripts/umegaya-adm		usr/bin
 scripts/umegaya-guess-url	usr/bin
 scripts/umegaya-ddc-ping	usr/bin
+scripts/umegaya-fields-stats	etc/cron.daily
 scripts/umegaya-license-stats	etc/cron.daily
 scripts/umegaya-refresh-blends	etc/cron.daily
 scripts/umegaya-self-clean	etc/cron.daily
diff --git a/man.mdwn b/man.mdwn
index b44e959..b07c414 100644
--- a/man.mdwn
+++ b/man.mdwn
@@ -3,5 +3,6 @@ Umegaya's manual pages
 
  * [[umegaya-ddc-ping.1]] — Umegaya's debian-devel-changes pinger
  * [[umegaya-guess-url.1]] — Converts a VCS URL in a URL to `debian/upstream`
+ * [[umegaya-fields-stats.1]] — ranked list of fields from collected copyright files
  * [[umegaya-license-stats.1]] — ranked list of licenses from collected copyright files
  * [[umegaya-query.1]] — query a remote umegaya instance
diff --git a/man/umegaya-fields-stats.1.mdwn b/man/umegaya-fields-stats.1.mdwn
new file mode 100644
index 0000000..f2775f8
--- /dev/null
+++ b/man/umegaya-fields-stats.1.mdwn
@@ -0,0 +1,18 @@
+% UMEGAYA-FIELDS-STATS(1) Umegaya User Manual
+% Charles Plessy
+% April 13, 2013
+
+# NAME
+
+umegaya-fields-stats - ranked list of fields from collected copyright files
+
+# SYNOPSIS
+
+umegaya-fields-stats
+
+# DESCRIPTION
+
+Parses all the machine-readable Debian copyright files collected in the
+repository `/var/lib/umegaya/packages-metadata`, and produces a list of
+fields ranked by their frequency, reporting the number of files where the
+fields has been found.
diff --git a/scripts/umegaya-fields-stats b/scripts/umegaya-fields-stats
new file mode 100755
index 0000000..dc34bae
--- /dev/null
+++ b/scripts/umegaya-fields-stats
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+# Exit if umegaya-adm is not installed.
+# Exit code is zero as this script is intended as a cron job.
+[ -x /usr/bin/umegaya-adm ]       || exit 0
+
+TMPFILE=$(mktemp -t umegaya-fields-stats.XXXXXXXXXX)
+
+for file in $(grep -rl '^Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/$' /var/lib/umegaya/packages-metadata/*/*.copyright )
+do
+  grep --only-matching --perl-regexp '^[^\s:]*'  $file |
+  sort --ignore-case --unique
+done |
+  sort --ignore-case |
+  uniq --ignore-case --count |
+  sort --reverse --numeric-sort > $TMPFILE
+
+TMPFILE_USER=$(stat  --format %u /var/lib/umegaya/)
+TMPFILE_GROUP=$(stat --format %g /var/lib/umegaya/)
+
+if [ $(whoami) = "root" ]
+then
+  chown $TMPFILE_USER:$TMPFILE_GROUP $TMPFILE
+  chmod 664 $TMPFILE
+fi
+
+cp $TMPFILE /var/lib/umegaya/fields-stats
+rm $TMPFILE

Cosmetic changes.
diff --git a/setup.mdwn b/setup.mdwn
index a7a24b5..d5852e1 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -85,23 +85,23 @@ _db_dir_ (--force).  Commit from time to time.
 
 [svn-ssh-tricks]: http://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshtricks
 
+
 Notes about YAML
 ----------------
 
-  # Invalid
-  foo: bar:
-  
-  # Valid
-  foo: "bar:"
-  
-  # Also valid
-  foo: >
-   bar:
-  
-  Also valid
-  foo: |
-   bar:
-
+    # Invalid
+    foo: bar:
+    
+    # Valid
+    foo: "bar:"
+    
+    # Also valid
+    foo: >
+     bar:
+    
+    Also valid
+    foo: |
+     bar:
 
 The difference between | and > is roughly the same as between the multi-line
 and folded fields in Debian control files.

license-stats: only change file owner when run by superuser.
diff --git a/scripts/umegaya-license-stats b/scripts/umegaya-license-stats
index a90fa31..a02558e 100755
--- a/scripts/umegaya-license-stats
+++ b/scripts/umegaya-license-stats
@@ -21,6 +21,11 @@ done |
 TMPFILE_USER=$(stat  --format %u /var/lib/umegaya/)
 TMPFILE_GROUP=$(stat --format %g /var/lib/umegaya/)
 
-chown $TMPFILE_USER:$TMPFILE_GROUP $TMPFILE
-chmod 664 $TMPFILE
-mv $TMPFILE /var/lib/umegaya/license-stats
+if [ $(whoami) = "root" ]
+then
+  chown $TMPFILE_USER:$TMPFILE_GROUP $TMPFILE
+  chmod 664 $TMPFILE
+fi
+
+cp $TMPFILE /var/lib/umegaya/license-stats
+rm $TMPFILE

Distribute the index, setup and todo files as documentation.
diff --git a/debian/docs b/debian/docs
index d4f64a9..9a7b422 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1 +1,4 @@
 scripts/example-push-metadata
+index.mdwn
+setup.mdwn
+todo.mdwn

Point to the Git tags in Debian copyright file.
diff --git a/debian/copyright b/debian/copyright
index 9df5119..1317159 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,5 +1,5 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Source: git://git.debian.org/users/plessy/umegaya.git
+Source: http://source.umegaya.branchable.com/?p=source.git;a=tags
 
 Files: *
 Copyright: none claimed

Point VCS URLs to Branchable.
diff --git a/debian/control b/debian/control
index 65087be..d1735ba 100644
--- a/debian/control
+++ b/debian/control
@@ -7,8 +7,8 @@ Build-Depends: debhelper (>= 9),
                perl,
                perl-doc
 Standards-Version: 3.9.4
-Vcs-Browser: http://git.debian.org/?p=users/plessy/umegaya.git
-Vcs-Git: git://git.debian.org/users/plessy/umegaya.git
+Vcs-Browser: http://source.umegaya.branchable.com/?p=source.git;a=tree
+Vcs-Git: git://umegaya.branchable.com/
 Homepage: http://umegaya.branchable.com
 
 Package: umegaya

Conforms to Policy 3.9.4.
diff --git a/debian/control b/debian/control
index b7da3ed..65087be 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9),
                pandoc,
                perl,
                perl-doc
-Standards-Version: 3.9.3
+Standards-Version: 3.9.4
 Vcs-Browser: http://git.debian.org/?p=users/plessy/umegaya.git
 Vcs-Git: git://git.debian.org/users/plessy/umegaya.git
 Homepage: http://umegaya.branchable.com

Normalised debian/control with 'cme fix dpkg-control'.
diff --git a/debian/control b/debian/control
index de30629..b7da3ed 100644
--- a/debian/control
+++ b/debian/control
@@ -1,21 +1,30 @@
 Source: umegaya
+Maintainer: Charles Plessy <plessy@debian.org>
 Section: database
 Priority: optional
-Maintainer: Charles Plessy <plessy@debian.org>
-Build-Depends: debhelper (>= 9), pandoc, perl, perl-doc
+Build-Depends: debhelper (>= 9),
+               pandoc,
+               perl,
+               perl-doc
 Standards-Version: 3.9.3
-Homepage: http://umegaya.branchable.com
 Vcs-Browser: http://git.debian.org/?p=users/plessy/umegaya.git
 Vcs-Git: git://git.debian.org/users/plessy/umegaya.git
+Homepage: http://umegaya.branchable.com
 
 Package: umegaya
 Architecture: all
-Depends: devscripts, libberkeleydb-perl, libyaml-libyaml-perl,
- libyaml-appconfig-perl, libwww-perl, subversion, ${perl:Depends},
- ${misc:Depends}
+Depends: devscripts,
+         libberkeleydb-perl,
+         libyaml-libyaml-perl,
+         libyaml-appconfig-perl,
+         libwww-perl,
+         subversion,
+         ${perl:Depends},
+         ${misc:Depends}
 Recommends: curl
 Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a
  version control system containing the source package, in a file called
  debian/upstream, and collected by the web aggregator each time it is accessed.
+

Link to the Branchable site.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index bb9bacf..174b49e 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -47,7 +47,7 @@ umegaya-adm(1)
 
 =head1 SOURCE
 
-http://git.debian.org/?p=users/plessy/umegaya.git
+http://umegaya.branchable.com/
 
 =head1 LIMITATIONS
 

Keep the command used to check out the packages-metadata repository.
diff --git a/scripts/example-push-metadata b/scripts/example-push-metadata
index 1fa3eee..8ad1b59 100644
--- a/scripts/example-push-metadata
+++ b/scripts/example-push-metadata
@@ -2,6 +2,10 @@
 #
 # This is the script used on blends.debian.net to push the collected files to
 # the packages-metadata directory of the Subversion repositry 'collab-qa'.
+#
+# The repostitory has been checked out with the following command.
+#
+# SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn checkout --force svn+ssh://svn.debian.org/svn/collab-qa/packages-metadata/
 # 
 # It is ugly and has many shortcomings.  All the find commands should
 # disappear.

Refreshing instructions.
diff --git a/setup.mdwn b/setup.mdwn
index 77b5c5a..a7a24b5 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -17,13 +17,15 @@ versions of Perl, but this has been corrected in Debian's 0.16-2 package.
 Configuration
 -------------
 
- - Set up an Apache virtual host using the apache.conf file as an example.
- - Set up a directory where apache can write the Berkeleydb.
+ - Set up an Apache virtual host using the `apache.conf` file in
+   `/etc/umegaya/`.
+ - Set up a directory where apache can write the `umegaya.db` Berkeley DB.  By
+   default it is `/var/lib/umegaya`.
  - Make sure that the Umegaya administrator has also write access to the
    directory.
- - Umegaya finds the package's VCS using the <code>debcheckout</code> of
-   the devscripts command, so a <code>deb-src</code> line tracking Sid
-   is necessary for a full coverage.
+ - Umegaya finds the package's VCS using the `debcheckout` command of the
+   devscripts package, so a `deb-src` line tracking Sid is necessary for a full
+   coverage.
 
 Triggering
 ----------
@@ -32,9 +34,9 @@ Umegaya is a passive system, that refreshes itself only when accessed.  It
 can be kept up to date by systems that will access it when some resources
 are refreshed, for intance commit hooks.
 
-To refreshe Umegaya for each package that has been uploaded to Debian,
+To refresh Umegaya for each package that has been uploaded to Debian,
 subscribe to the [debian-devel-changes][] mailing list and pipe its messages to
-umegaya-ddc-ping.
+umegaya-ddc-ping(1).
 
 [debian-devel-changes]:	http://lists.debian.org/debian-devel-changes
 
@@ -43,7 +45,7 @@ instance, the script `umegaya-refresh-blends(1)` refreshes Umegaya for all
 packages in Debian Pure Blends.  It is called by a daily cron job and can be
 must be activated through the refresh_blends parameter in `/etc/umegaya/umegaya.conf`.
 
-`umegaya-refresh-blends` tries to guess the VCS URL packages that are not know
+`umegaya-refresh-blends(1)` tries to guess the VCS URL packages that are not know
 of debcheckout, using the layout policy of the blends.
 
 The list of packages recommended by each blend overlap.  To avoid unnecessary
@@ -56,11 +58,11 @@ necessary.
 
 To determine if a package managed with Git on Alioth contains a debian/upstream file.
 
-  for repo in /git/debian-med/*.git
-  do
-    (cd $repo ; git ls-tree master debian/ |
-     grep 'debian/upstream$' > /dev/null && echo "$repo")
-  done | sed -e 's|/git/debian-med/||' -e 's|.git$||'
+    for repo in /git/debian-med/*.git
+    do
+      (cd $repo ; git ls-tree master debian/ |
+       grep 'debian/upstream$' > /dev/null && echo "$repo")
+    done | sed -e 's|/git/debian-med/||' -e 's|.git$||'
 
 
 Accumulating the files on the local disk
@@ -70,9 +72,10 @@ Via the _store_files_ and _debian_control_ and _debian_copyright_ options,
 umegaya can keep a local copy of the upstream, control and copyright files of
 the packages, in the _db_dir_ directory.
 
-The Debian package provides a pooled directory structure in _/var/lib/umegaya_,
+The Debian package provides a pooled directory structure in `/var/lib/umegaya`,
 but it needs to be created if another path is chosen.
 
+
 Pushing these files to a remote Subversion server
 -------------------------------------------------
 

List Umegaya's manual pages.
diff --git a/man.mdwn b/man.mdwn
new file mode 100644
index 0000000..b44e959
--- /dev/null
+++ b/man.mdwn
@@ -0,0 +1,7 @@
+Umegaya's manual pages
+======================
+
+ * [[umegaya-ddc-ping.1]] — Umegaya's debian-devel-changes pinger
+ * [[umegaya-guess-url.1]] — Converts a VCS URL in a URL to `debian/upstream`
+ * [[umegaya-license-stats.1]] — ranked list of licenses from collected copyright files
+ * [[umegaya-query.1]] — query a remote umegaya instance

Link to the man pages.
diff --git a/index.mdwn b/index.mdwn
index 768de6c..2daa882 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -13,5 +13,5 @@ VCS.  See also [[!debwiki UpstreamMetadata]] on the Debian wiki.
 
 Umegaya is distributed under the BOLA [[LICENSE]].
 
-See the [[setup]] page for more documentation, the [[todo]] list, and
-of course the [source code](http://source.umegaya.branchable.com/?p=source.git;a=tree).
+See the [[setup]] and [[man]] pages for more documentation, the [[todo]] list,
+and of course the [source code](http://source.umegaya.branchable.com/?p=source.git;a=tree).

Link to the source code.
diff --git a/index.mdwn b/index.mdwn
index 6640f10..768de6c 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -13,4 +13,5 @@ VCS.  See also [[!debwiki UpstreamMetadata]] on the Debian wiki.
 
 Umegaya is distributed under the BOLA [[LICENSE]].
 
-See the [[setup]] page for more documentation, and also the [[todo]] list.
+See the [[setup]] page for more documentation, the [[todo]] list, and
+of course the [source code](http://source.umegaya.branchable.com/?p=source.git;a=tree).

Link to todo page.
diff --git a/index.mdwn b/index.mdwn
index 57971d5..6640f10 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -13,4 +13,4 @@ VCS.  See also [[!debwiki UpstreamMetadata]] on the Debian wiki.
 
 Umegaya is distributed under the BOLA [[LICENSE]].
 
-See the [[setup]] for more documentation.
+See the [[setup]] page for more documentation, and also the [[todo]] list.

Hosting the source code on Branchable.
diff --git a/debian/control b/debian/control
index 154bb9d..de30629 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Charles Plessy <plessy@debian.org>
 Build-Depends: debhelper (>= 9), pandoc, perl, perl-doc
 Standards-Version: 3.9.3
-Homepage: http://upstream-metadata.debian.net/
+Homepage: http://umegaya.branchable.com
 Vcs-Browser: http://git.debian.org/?p=users/plessy/umegaya.git
 Vcs-Git: git://git.debian.org/users/plessy/umegaya.git
 
diff --git a/debian/upstream b/debian/upstream
index 8e12d1c..a8dbaae 100644
--- a/debian/upstream
+++ b/debian/upstream
@@ -1,4 +1,4 @@
 Archive: Alioth
 Contact: Charles Plessy <plessy@debian.org>
 Name: Umegaya
-Homepage: http://upstream-metadata.debian.net
+Homepage: http://umegaya.branchable.com
diff --git a/index.mdwn b/index.mdwn
new file mode 100644
index 0000000..57971d5
--- /dev/null
+++ b/index.mdwn
@@ -0,0 +1,16 @@
+Umegaya — MEtadata GAtherer using YAml
+======================================
+
+Umegaya is a gatherer of meta information about the software packaged in
+Debian.  This metadata is accumlated by the package maintainer in the version
+control system containing the Debian souce package, in a file called
+<code>debian/upstream</code>, and it is collected by the Umegaya web service
+each time it is accessed.  The Umegaya web service then aggregates information
+about all the packages it knows, and outputs as tables or YAML records that can
+be loaded in central information hubs like the Ultimate Debian Database.
+Optionally, Umegaya will keep a local copy if the files it retrieves from the
+VCS.  See also [[!debwiki UpstreamMetadata]] on the Debian wiki.
+
+Umegaya is distributed under the BOLA [[LICENSE]].
+
+See the [[setup]] for more documentation.

Moving configuration files to a dedicated directory.
diff --git a/debian/install b/debian/install
index 5eda0a1..46188e7 100644
--- a/debian/install
+++ b/debian/install
@@ -1,7 +1,7 @@
 cgi-bin/umegaya 		usr/lib/cgi-bin
-apache.conf			etc/umegaya
-robots.txt			etc/umegaya
-umegaya.conf			etc/umegaya
+conf/apache.conf		etc/umegaya
+conf/robots.txt			etc/umegaya
+conv/umegaya.conf		etc/umegaya
 scripts/umegaya-adm		usr/bin
 scripts/umegaya-guess-url	usr/bin
 scripts/umegaya-ddc-ping	usr/bin

Moving configuration files to a dedicated directory.
This is to avoid robots.txt to prevent the indexing on Branchable.
diff --git a/apache.conf b/apache.conf
deleted file mode 100644
index d14d42a..0000000
--- a/apache.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-Alias /umegaya/license-stats /var/lib/umegaya/license-stats
-Alias /umegaya /usr/share/umegaya/htdocs
-
-<Directory /usr/share/umegaya/htdocs>
-    Options +FollowSymLinks
-    RewriteEngine on
-    RewriteRule ^$ /cgi-bin/umegaya?help=1
-    RewriteRule ^table/([\w_\-]+)$ /cgi-bin/umegaya?table=1;key=$1 [B]
-    RewriteRule ^yaml/([\w_\-]+)$ /cgi-bin/umegaya?yaml=1;key=$1 [B]
-    RewriteRule ^([a-z0-9\.\-\+]+)/([\w_\-]+)$ /cgi-bin/umegaya?package=$1;key=$2 [B]
-</Directory>
-
-#<VirtualHost *:80>
-#    ServerName umegaya.example.com
-#    ServerAdmin umegaya@example.com
-#    DocumentRoot /usr/share/umegaya/htdocs
-#</VirtualHost>
diff --git a/conf/apache.conf b/conf/apache.conf
new file mode 100644
index 0000000..d14d42a
--- /dev/null
+++ b/conf/apache.conf
@@ -0,0 +1,17 @@
+Alias /umegaya/license-stats /var/lib/umegaya/license-stats
+Alias /umegaya /usr/share/umegaya/htdocs
+
+<Directory /usr/share/umegaya/htdocs>
+    Options +FollowSymLinks
+    RewriteEngine on
+    RewriteRule ^$ /cgi-bin/umegaya?help=1
+    RewriteRule ^table/([\w_\-]+)$ /cgi-bin/umegaya?table=1;key=$1 [B]
+    RewriteRule ^yaml/([\w_\-]+)$ /cgi-bin/umegaya?yaml=1;key=$1 [B]
+    RewriteRule ^([a-z0-9\.\-\+]+)/([\w_\-]+)$ /cgi-bin/umegaya?package=$1;key=$2 [B]
+</Directory>
+
+#<VirtualHost *:80>
+#    ServerName umegaya.example.com
+#    ServerAdmin umegaya@example.com
+#    DocumentRoot /usr/share/umegaya/htdocs
+#</VirtualHost>
diff --git a/conf/robots.txt b/conf/robots.txt
new file mode 100644
index 0000000..1f53798
--- /dev/null
+++ b/conf/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /
diff --git a/conf/umegaya.conf b/conf/umegaya.conf
new file mode 100644
index 0000000..bcbb0c2
--- /dev/null
+++ b/conf/umegaya.conf
@@ -0,0 +1,41 @@
+# Location for the Berkeley DB.
+db_dir: /var/lib/umegaya/
+
+# Name of the Berkeley DB.
+db_name: umegaya.db
+
+# Also download Debian control or copyright files if store_files is set.
+#debian_control: 1
+#debian_copyright: 1
+
+# Numbers of seconds for which a new request will not trigger a refresh.
+# Default: one hour.
+delay: 3600
+
+# Debug mode makes Umegaya scripts verbose.
+debug: 0
+
+# Local comment
+#local_comment: >
+# This Umegaya instance on upstream-metadata.debian.net is an experimental
+# service that is not part of the official Debian infrastructure, which is why it
+# is incubated on the debian.net domain instead of debian.org.
+
+# When refresh_blends is set to 1, the daily cron job umegaya-refresh-blends
+# will refresh Umegaya for all Debian Pure Blends.  This means one request to
+# alioth.debian.org for each package recommended or suggested by each Blend.
+refresh_blends: 0
+
+# umegaya-ddc-ping sends messages to syslog if the following is uncommented.
+#messages: syslog
+
+# Will store a copy of debian/upstream and debian/copyright if set to a location.
+#store_files: /var/lib/umegaya/packages-metadata
+
+# URLs for Umegaya
+#local_url: http://umegaya.localhost
+local_url: http://localhost/umegaya
+ping_url: http://localhost/umegaya
+
+# Archive with upstream files for UDD bibref gatherer
+#archive_for_bibref_gatherer: /var/lib/gforge/chroot/home/groups/blends/htdocs/packages-metadata/packages-metadata.tar.bz2
diff --git a/robots.txt b/robots.txt
deleted file mode 100644
index 1f53798..0000000
--- a/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow: /
diff --git a/umegaya.conf b/umegaya.conf
deleted file mode 100644
index bcbb0c2..0000000
--- a/umegaya.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-# Location for the Berkeley DB.
-db_dir: /var/lib/umegaya/
-
-# Name of the Berkeley DB.
-db_name: umegaya.db
-
-# Also download Debian control or copyright files if store_files is set.
-#debian_control: 1
-#debian_copyright: 1
-
-# Numbers of seconds for which a new request will not trigger a refresh.
-# Default: one hour.
-delay: 3600
-
-# Debug mode makes Umegaya scripts verbose.
-debug: 0
-
-# Local comment
-#local_comment: >
-# This Umegaya instance on upstream-metadata.debian.net is an experimental
-# service that is not part of the official Debian infrastructure, which is why it
-# is incubated on the debian.net domain instead of debian.org.
-
-# When refresh_blends is set to 1, the daily cron job umegaya-refresh-blends
-# will refresh Umegaya for all Debian Pure Blends.  This means one request to
-# alioth.debian.org for each package recommended or suggested by each Blend.
-refresh_blends: 0
-
-# umegaya-ddc-ping sends messages to syslog if the following is uncommented.
-#messages: syslog
-
-# Will store a copy of debian/upstream and debian/copyright if set to a location.
-#store_files: /var/lib/umegaya/packages-metadata
-
-# URLs for Umegaya
-#local_url: http://umegaya.localhost
-local_url: http://localhost/umegaya
-ping_url: http://localhost/umegaya
-
-# Archive with upstream files for UDD bibref gatherer
-#archive_for_bibref_gatherer: /var/lib/gforge/chroot/home/groups/blends/htdocs/packages-metadata/packages-metadata.tar.bz2

Transfer example code form TODO file to example script.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..d4f64a9
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+scripts/example-push-metadata
diff --git a/scripts/example-push-metadata b/scripts/example-push-metadata
new file mode 100644
index 0000000..1fa3eee
--- /dev/null
+++ b/scripts/example-push-metadata
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+#
+# This is the script used on blends.debian.net to push the collected files to
+# the packages-metadata directory of the Subversion repositry 'collab-qa'.
+# 
+# It is ugly and has many shortcomings.  All the find commands should
+# disappear.
+#
+# The SSH key is of course restricted to only run svnserve.
+
+POOL=/var/lib/umegaya/packages-metadata/
+
+STAMP= ${TMPDIR-/tmp}/umegaya-timestamp
+
+rm -f $STAMP
+touch $STAMP
+find $POOL -empty             | grep -v 'svn/'         | xargs -L1 rm -f
+find $POOL -name '*control'   | xargs grep -l DOCT     | xargs rm -f
+find $POOL -name '*copyright' | xargs grep -l DOCT     | xargs rm -f
+find $POOL -name '*upstream'  | xargs grep -l DOCT     | xargs rm -f
+find $POOL -name '*upstream'  | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*control'   | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*copyright' | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*control'   | xargs grep -l '^500 Ca'| xargs rm -f
+find $POOL -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm -f
+find $POOL ! -newer $STAMP | grep -v '././.svn' | grep '[mlt]$' | xargs svn add --force
+rm $STAMP
+
+SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push' --quiet
diff --git a/todo.mdwn b/todo.mdwn
index 29c0328..e197c97 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -29,27 +29,8 @@ To do
  - Check if there is no buggy package names with spaces in the berkeley DB.
  - Do not create 404 Gitweb files.
 
-Current workaround:
-
-#!/bin/sh -e
-
-POOL=/var/lib/umegaya/packages-metadata/
-
-rm -f /tmp/umegaya-timestamp
-touch /tmp/umegaya-timestamp
-find $POOL -empty             | grep -v 'svn/'         | xargs -L1 rm -f
-find $POOL -name '*control'   | xargs grep -l DOCT     | xargs rm -f
-find $POOL -name '*copyright' | xargs grep -l DOCT     | xargs rm -f
-find $POOL -name '*upstream'  | xargs grep -l DOCT     | xargs rm -f
-find $POOL -name '*upstream'  | xargs grep -l '^<html' | xargs rm -f
-find $POOL -name '*control'   | xargs grep -l '^<html' | xargs rm -f
-find $POOL -name '*copyright' | xargs grep -l '^<html' | xargs rm -f
-find $POOL -name '*control'   | xargs grep -l '^500 Ca'| xargs rm -f
-find $POOL -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm -f
-find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mlt]$' | xargs svn add --force
-rm /tmp/umegaya-timestamp
-
-SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push' --quiet
+ - See the example file 'example-push-metadata' on how to clean a package-metadata
+   repository before pushing
 
  - Die gracefully if package is not found.
  - Make sure two processes can run at the same time.

license-stats: ignore case.
diff --git a/scripts/umegaya-license-stats b/scripts/umegaya-license-stats
index 60a7394..a90fa31 100755
--- a/scripts/umegaya-license-stats
+++ b/scripts/umegaya-license-stats
@@ -11,10 +11,12 @@ TMPFILE=$(mktemp -t umegaya-license-stats.XXXXXXXXXX)
 for file in $(grep -rl '^Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/$' /var/lib/umegaya/packages-metadata/*/*.copyright )
 do
   grep '^License:' $file |
-    sort -u
+    sort --ignore-case --unique
 done |
   sed -e 's/^License:\s*//' -e 's/\s+$//g' |
-  sort | uniq -c | sort -rn > $TMPFILE
+  sort --ignore-case |
+  uniq --ignore-case --count |
+  sort --reverse --numeric-sort > $TMPFILE
 
 TMPFILE_USER=$(stat  --format %u /var/lib/umegaya/)
 TMPFILE_GROUP=$(stat --format %g /var/lib/umegaya/)

license-stats: Use the stat command instead of parsing the output of ls.
diff --git a/scripts/umegaya-license-stats b/scripts/umegaya-license-stats
index 8c44c42..60a7394 100755
--- a/scripts/umegaya-license-stats
+++ b/scripts/umegaya-license-stats
@@ -16,8 +16,8 @@ done |
   sed -e 's/^License:\s*//' -e 's/\s+$//g' |
   sort | uniq -c | sort -rn > $TMPFILE
 
-TMPFILE_USER=$(ls -ld /var/lib/umegaya/ | cut -f3 -d ' ')
-TMPFILE_GROUP=$(ls -ld /var/lib/umegaya/ | cut -f4 -d ' ')
+TMPFILE_USER=$(stat  --format %u /var/lib/umegaya/)
+TMPFILE_GROUP=$(stat --format %g /var/lib/umegaya/)
 
 chown $TMPFILE_USER:$TMPFILE_GROUP $TMPFILE
 chmod 664 $TMPFILE

umegaya (0.12) unstable; urgency=low
2293ecd umegaya-query: a tool to avoid typing the long default URL.
4db19af umegaya-license-stats: rank licenses by frequency in copyright files.
bfc7689 Serve umegaya-license-stats output at /umegaya/license-stats.
-- Charles Plessy <plessy@debian.org> Sat, 12 Jan 2013 17:56:06 +0900
diff --git a/debian/changelog b/debian/changelog
index 374c041..4cc8512 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+umegaya (0.12) unstable; urgency=low
+
+  2293ecd umegaya-query: a tool to avoid typing the long default URL.
+  4db19af umegaya-license-stats: rank licenses by frequency in copyright files.
+  bfc7689 Serve umegaya-license-stats output at /umegaya/license-stats.
+
+ -- Charles Plessy <plessy@debian.org>  Sat, 12 Jan 2013 17:56:06 +0900
+
 umegaya (0.11) unstable; urgency=low
 
   0268e44 Assume 'foo' as the package name for 'foo/trunk' Svn URLs.

Serve /var/lib/umegaya/license-stats at /umegaya/license-stats
diff --git a/apache.conf b/apache.conf
index 14811c5..d14d42a 100644
--- a/apache.conf
+++ b/apache.conf
@@ -1,3 +1,4 @@
+Alias /umegaya/license-stats /var/lib/umegaya/license-stats
 Alias /umegaya /usr/share/umegaya/htdocs
 
 <Directory /usr/share/umegaya/htdocs>

New script umegaya-license-stats
Parses all the machine-readable Debian copyright files collected in the
repository `/var/lib/umegaya/packages-metadata`, and produces a list of
licenses ranked by their frequency, reporting the number of files where the
license has been found.
diff --git a/debian/install b/debian/install
index e2f9229..5eda0a1 100644
--- a/debian/install
+++ b/debian/install
@@ -5,5 +5,6 @@ umegaya.conf			etc/umegaya
 scripts/umegaya-adm		usr/bin
 scripts/umegaya-guess-url	usr/bin
 scripts/umegaya-ddc-ping	usr/bin
+scripts/umegaya-license-stats	etc/cron.daily
 scripts/umegaya-refresh-blends	etc/cron.daily
 scripts/umegaya-self-clean	etc/cron.daily
diff --git a/man/umegaya-license-stats.1.mdwn b/man/umegaya-license-stats.1.mdwn
new file mode 100644
index 0000000..1ffe4f4
--- /dev/null
+++ b/man/umegaya-license-stats.1.mdwn
@@ -0,0 +1,18 @@
+% UMEGAYA-LICENSE-STATS(1) Umegaya User Manual
+% Charles Plessy
+% January 12, 2013
+
+# NAME
+
+umegaya-license-stats - ranked list of licenses from collected copyright files
+
+# SYNOPSIS
+
+umegaya-license-stats
+
+# DESCRIPTION
+
+Parses all the machine-readable Debian copyright files collected in the
+repository `/var/lib/umegaya/packages-metadata`, and produces a list of
+licenses ranked by their frequency, reporting the number of files where the
+license has been found.
diff --git a/scripts/umegaya-license-stats b/scripts/umegaya-license-stats
new file mode 100755
index 0000000..8c44c42
--- /dev/null
+++ b/scripts/umegaya-license-stats
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+# Exit if umegaya-adm is not installed.
+# Exit code is zero as this script is intended as a cron job.
+[ -x /usr/bin/umegaya-adm ]       || exit 0
+
+TMPFILE=$(mktemp -t umegaya-license-stats.XXXXXXXXXX)
+
+for file in $(grep -rl '^Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/$' /var/lib/umegaya/packages-metadata/*/*.copyright )
+do
+  grep '^License:' $file |
+    sort -u
+done |
+  sed -e 's/^License:\s*//' -e 's/\s+$//g' |
+  sort | uniq -c | sort -rn > $TMPFILE
+
+TMPFILE_USER=$(ls -ld /var/lib/umegaya/ | cut -f3 -d ' ')
+TMPFILE_GROUP=$(ls -ld /var/lib/umegaya/ | cut -f4 -d ' ')
+
+chown $TMPFILE_USER:$TMPFILE_GROUP $TMPFILE
+chmod 664 $TMPFILE
+mv $TMPFILE /var/lib/umegaya/license-stats

Factorise the code building the manpages.
diff --git a/debian/rules b/debian/rules
index cdd8091..329a85a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,8 +8,8 @@ export DH_VERBOSE=1
 override_dh_auto_build:
 	perldoc -o nroff cgi-bin/umegaya               > man/umegaya.1
 	perldoc -o nroff scripts/umegaya-adm           > man/umegaya-adm.1
-	pandoc -s -w man man/umegaya-ddc-ping.1.mdwn  -o man/umegaya-ddc-ping.1
-	pandoc -s -w man man/umegaya-guess-url.1.mdwn -o man/umegaya-guess-url.1
+	for file in man/*.1.mdwn ; do \
+	  pandoc -s -w man $$file  -o man/$$(basename $$file .mdwn) ; done
 
 override_dh_clean:
 	$(RM) man/umegaya*.1

Mention apt-file's "-a source" option.
diff --git a/todo.mdwn b/todo.mdwn
index 7f50c6b..29c0328 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -81,7 +81,8 @@ SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily aut
 
  - Integrate in the PTS.
 
- - Detect all source packages that contain a debian/upstream file.
+ - Detect all source packages that contain a debian/upstream file, for instance using
+   apt-file's "-a source" option (see "#632254").
 
  - Provide an index of all packages in the Umegaya database (or with
    upstream metadata in the UDD).

Suggestions from Paul Wise.
diff --git a/todo.mdwn b/todo.mdwn
index 2b6c75d..7f50c6b 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -78,3 +78,14 @@ SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily aut
  - URL-encode pacakge (and perhaps key) names.
 
  - Warn when VCS URL does not point at a directory (lack a trailing slash).
+
+ - Integrate in the PTS.
+
+ - Detect all source packages that contain a debian/upstream file.
+
+ - Provide an index of all packages in the Umegaya database (or with
+   upstream metadata in the UDD).
+
+ - Accept new debian/upstream files from the public.
+
+ - Integrate with http://duck.debian.net/

Umegaya-query: a tool to avoid typing the long default URL.
Curl is recommended instead of suggested, as the umegaya-query uses curl.
diff --git a/debian/control b/debian/control
index 5089de2..154bb9d 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,7 @@ Architecture: all
 Depends: devscripts, libberkeleydb-perl, libyaml-libyaml-perl,
  libyaml-appconfig-perl, libwww-perl, subversion, ${perl:Depends},
  ${misc:Depends}
-Suggests: curl
+Recommends: curl
 Description: Umegaya is a MEtadata GAtherer using YAml
  Aggregator of meta information about the software packages. The central
  concept is that the metadata is accumlated by the package maintainer in a
diff --git a/man/umegaya-query.1.mdwn b/man/umegaya-query.1.mdwn
new file mode 100644
index 0000000..fa8c4a4
--- /dev/null
+++ b/man/umegaya-query.1.mdwn
@@ -0,0 +1,36 @@
+% UMEGAYA-QUERY(1) Umegaya User Manual
+% Charles Plessy
+% October 13, 2012
+
+# NAME
+
+umegaya-query - query a remote umegaya instance
+
+# SYNOPSIS
+
+umegaya-query key package|table|yaml
+
+# DESCRIPTION
+
+This is a convenience script to avoid typing the long URL
+http://upstream-metadata.debian.net.  All it does for the
+moment is to call curl.
+
+The name and the interface may change in the final implementation.
+
+Later it will take its default URL form `umegaya.conf`, check
+its command-line parameters, etc.
+
+# OPTIONS
+
+## key
+
+First option is a key name.
+
+## package|table|yaml
+
+Second option is a package name, or a special command name such as "table" or "yaml".
+
+# SEE ALSO
+
+`umegaya.conf` (5).
diff --git a/scripts/umegaya-query b/scripts/umegaya-query
new file mode 100755
index 0000000..e487c39
--- /dev/null
+++ b/scripts/umegaya-query
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+usage() {
+  echo "Usage: $0 key package|table|yaml"
+  exit 1
+}
+
+abort() {
+  echo $1
+  exit 1
+}
+
+[ -x /usr/bin/curl ] || abort "Aborted: please install curl."
+
+BASEURL="http://upstream-metadata.debian.net"
+
+curl $BASEURL/$2/$1

umegaya (0.11) unstable; urgency=low
0268e44 Assume 'foo' as the package name for 'foo/trunk' Svn URLs.
7361239 Guess path to debian/upstream in GitHub.
4d88db9 umegaya-self-clean: exit if umegaya-adm is not installed.
Closes: #689250
-- Charles Plessy <plessy@debian.org> Thu, 04 Oct 2012 07:12:40 +0900
diff --git a/debian/changelog b/debian/changelog
index 679f0c2..374c041 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+umegaya (0.11) unstable; urgency=low
+
+  0268e44 Assume 'foo' as the package name for 'foo/trunk' Svn URLs.
+  7361239 Guess path to debian/upstream in GitHub.
+  4d88db9 umegaya-self-clean: exit if umegaya-adm is not installed.
+          Closes: #689250
+
+ -- Charles Plessy <plessy@debian.org>  Thu, 04 Oct 2012 07:12:40 +0900
+
 umegaya (0.10) unstable; urgency=low
 
   * Initial upload to Debian, closes: #657825.

umegaya-self-clean: exit if umegaya-adm is not installed.
Closes: #689250
diff --git a/scripts/umegaya-self-clean b/scripts/umegaya-self-clean
index bd99447..7ba54c3 100755
--- a/scripts/umegaya-self-clean
+++ b/scripts/umegaya-self-clean
@@ -2,6 +2,10 @@
 
 set -e
 
+# Exit if umegaya-adm is not installed.
+# Exit code is zero as this script is intended as a cron job.
+[ -x /usr/bin/umegaya-adm ]       || exit 0
+
 # Delete from the Umegaya database every package whose URL is 'NA'
 
 for package in $(umegaya-adm -k YAML-URL | awk '$2=="NA" { print $1}')

Guess path to debian/upstream in GitHub.
diff --git a/scripts/umegaya-guess-url b/scripts/umegaya-guess-url
index a0b52be..b9fc0b4 100755
--- a/scripts/umegaya-guess-url
+++ b/scripts/umegaya-guess-url
@@ -58,6 +58,11 @@ ERROR_MESSAGE
       $package = $1;
       $package_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/upstream;hb=HEAD|;
     }
+    # GitHub (master branch only)
+    elsif (m|git://github.com/([A-Za-z0-9\+\-\.]+)/([a-z0-9\+\-\.]+).git$|) {
+       $package = $2;
+       $package_url = "https://raw.github.com/$1/$package/master/debian/upstream"
+    }
     else {
       die "Could not detect package name for $package_url\n";
     }

Assume that 'foo' is the package name for Svn URLs finishing by 'foo/trunk'.
diff --git a/scripts/umegaya-guess-url b/scripts/umegaya-guess-url
index a05e642..a0b52be 100755
--- a/scripts/umegaya-guess-url
+++ b/scripts/umegaya-guess-url
@@ -44,6 +44,10 @@ ERROR_MESSAGE
     elsif (m|svn://svn.debian.org/s?v?n?/?debian-science/packages/([a-z0-9\+\-\.]+)/| ) {
       $package = $1;
     }
+    # Other repositories
+    elsif (m|svn://svn.debian.org/.*/([a-z0-9\+\-\.]+)/trunk| ) {
+      $package = $1;
+    }
     else {
       die "Could not detect package name for $package_url\n";
     }

umegaya (0.10) unstable; urgency=low
* Initial upload to Debian, closes: #657825.
c0c90f5 umegaya-ddc-ping: Removed -x flag, forgotten in by accident.
af2f6c7 umegaya-ddc-ping: `message` option to use syslog instead of exiting
on failure.
860eb57 umegaya-self-clean: a script that tidies the Umegaya database.
d4b581f Build-depend on perl-doc.
-- Charles Plessy <plessy@debian.org> Sat, 08 Sep 2012 14:35:01 +0900
diff --git a/debian/changelog b/debian/changelog
index 0f0a114..679f0c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+umegaya (0.10) unstable; urgency=low
+
+  * Initial upload to Debian, closes: #657825.
+
+  c0c90f5 umegaya-ddc-ping: Removed -x flag, forgotten in by accident.
+  af2f6c7 umegaya-ddc-ping: `message` option to use syslog instead of exiting
+          on failure.
+  860eb57 umegaya-self-clean: a script that tidies the Umegaya database.
+  d4b581f Build-depend on perl-doc.
+
+ -- Charles Plessy <plessy@debian.org>  Sat, 08 Sep 2012 14:35:01 +0900
+
 umegaya (0.9) unreleased; urgency=low
 
   * Deployed on debian-med.debian.net.

Build-depend on perl-doc.
diff --git a/debian/control b/debian/control
index 564ef32..5089de2 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: umegaya
 Section: database
 Priority: optional
 Maintainer: Charles Plessy <plessy@debian.org>
-Build-Depends: debhelper (>= 9), pandoc, perl
+Build-Depends: debhelper (>= 9), pandoc, perl, perl-doc
 Standards-Version: 3.9.3
 Homepage: http://upstream-metadata.debian.net/
 Vcs-Browser: http://git.debian.org/?p=users/plessy/umegaya.git

umegaya-self-clean: a script that tidies the Umegaya database.
To be used as a cron job.
diff --git a/debian/install b/debian/install
index 365ea5e..e2f9229 100644
--- a/debian/install
+++ b/debian/install
@@ -6,3 +6,4 @@ scripts/umegaya-adm		usr/bin
 scripts/umegaya-guess-url	usr/bin
 scripts/umegaya-ddc-ping	usr/bin
 scripts/umegaya-refresh-blends	etc/cron.daily
+scripts/umegaya-self-clean	etc/cron.daily
diff --git a/scripts/umegaya-self-clean b/scripts/umegaya-self-clean
new file mode 100755
index 0000000..bd99447
--- /dev/null
+++ b/scripts/umegaya-self-clean
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+# Delete from the Umegaya database every package whose URL is 'NA'
+
+for package in $(umegaya-adm -k YAML-URL | awk '$2=="NA" { print $1}')
+do
+  umegaya-adm -p $package -d
+done

umegaya-ddc-ping: `message` option to use syslog instead of exiting on failure.
diff --git a/man/umegaya-ddc-ping.1.mdwn b/man/umegaya-ddc-ping.1.mdwn
index d97efc7..a764e88 100644
--- a/man/umegaya-ddc-ping.1.mdwn
+++ b/man/umegaya-ddc-ping.1.mdwn
@@ -1,6 +1,6 @@
 % UMEGAYA-DDC-PING(1) Umegaya User Manual
 % Charles Plessy
-% April 8, 2012
+% August 21, 2012
 
 # NAME
 
@@ -20,10 +20,23 @@ entry in `/etc/aliases` will forward emails to `umegaya-ddc-ping`.
 
   emailaddress: |umegaya-ddc-ping
 
+The name of the package to ping is searched in the third field of the first
+line starting with `Subject`.  In case of failure, the script returns with
+an exit code of 1, unless the `messages` option is used.
+
 # OPTIONS
 
-`umegaya-ddc-ping` takes no option but reads `ping_url` from
-`/etc/umegaya/umegaya.conf`.
+`umegaya-ddc-ping` takes no option from the command line, but reads the
+following from `/etc/umegaya/umegaya.conf`.
+
+## `ping_url`
+
+URL of an Umegaya instance.  `http://localhost/umegaya` by default. 
+
+## `messages`
+
+Log pings and failures to determine package name to syslog, and do not exit
+with error in case of failure.  Off by default.
 
 # SEE ALSO
 
diff --git a/scripts/umegaya-ddc-ping b/scripts/umegaya-ddc-ping
index c447776..ae11566 100755
--- a/scripts/umegaya-ddc-ping
+++ b/scripts/umegaya-ddc-ping
@@ -4,11 +4,20 @@
 # Piped emails from http://lists.debian.org/debian-devel-changes to this program
 # trigger a ping for the corresponding package in an Umegaya instance.
 
-URL=$(grep ^ping_url /etc/umegaya/umegaya.conf | sed -r 's/ping_url:\s+//')
+URL=$(awk '/^ping_url:/ {print $2 ; nextfile}' /etc/umegaya/umegaya.conf)
 PACKAGE=$(grep ^Subject -m1 | awk '{print $3}')
+MESSAGES=$(awk '/^messages:/ {print $2 ; nextfile}' /etc/umegaya/umegaya.conf)
 
 if [ "$PACKAGE" != '' ] ; then
   curl --silent ${URL-http://localhost/umegaya}/$PACKAGE/ping > /dev/null
+  if [ "$MESSAGES" = 'syslog' ] ; then
+    logger -i umegaya-ddc-ping: pinged $PACKAGE at $URL
+  fi
   exit 0
 fi
-exit 1
+if [ "$MESSAGES" = 'syslog' ] ; then
+  logger -i umegaya-ddc-ping: failed to find package name in standard input
+else
+  exit 1
+fi
+exit 0
diff --git a/umegaya.conf b/umegaya.conf
index f94e675..bcbb0c2 100644
--- a/umegaya.conf
+++ b/umegaya.conf
@@ -26,6 +26,9 @@ debug: 0
 # alioth.debian.org for each package recommended or suggested by each Blend.
 refresh_blends: 0
 
+# umegaya-ddc-ping sends messages to syslog if the following is uncommented.
+#messages: syslog
+
 # Will store a copy of debian/upstream and debian/copyright if set to a location.
 #store_files: /var/lib/umegaya/packages-metadata
 

Removed -x flag, forgotten in by accident.
diff --git a/scripts/umegaya-ddc-ping b/scripts/umegaya-ddc-ping
index 1e36b12..c447776 100755
--- a/scripts/umegaya-ddc-ping
+++ b/scripts/umegaya-ddc-ping
@@ -1,4 +1,4 @@
-#!/bin/sh -ex
+#!/bin/sh -e
 # Umegaya's debian-devel-changes pinger
 #
 # Piped emails from http://lists.debian.org/debian-devel-changes to this program

umegaya (0.9) unreleased; urgency=low
* Deployed on debian-med.debian.net.
[ Charles Plessy ]
f8de3b3 Update daily push script to also push control files.
1b83a6b Allow the insertion of a local comment.
[ Andreas Tille ]
e06dafc Make sure a failed ping of a package will not let the script exit.
-- Charles Plessy <plessy@debian.org> Mon, 25 Jun 2012 09:30:16 +0900
diff --git a/debian/changelog b/debian/changelog
index cfbaea2..0f0a114 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+umegaya (0.9) unreleased; urgency=low
+
+  * Deployed on debian-med.debian.net.
+
+  [ Charles Plessy ]
+  f8de3b3 Update daily push script to also push control files.
+  1b83a6b Allow the insertion of a local comment.
+
+  [ Andreas Tille ]
+  e06dafc Make sure a failed ping of a package will not let the script exit.
+
+ -- Charles Plessy <plessy@debian.org>  Mon, 25 Jun 2012 09:30:16 +0900
+
 umegaya (0.8) unreleased; urgency=low
 
   * Download Debian source package control files (optional).

Allow the insertion of a local comment.
This is used to explained that services on debian.net are not official.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index cc94827..bb9bacf 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -71,6 +71,7 @@ use YAML::AppConfig;
 
 my $conf = YAML::AppConfig->new(file => "/etc/umegaya/umegaya.conf");
 my $lib         = $conf->get("db_dir");
+my $local_comment    = $conf->get("local_comment");
 my $berkeleydb  = $lib . $conf->get("db_name");
 my $delay       = $conf->get("delay");
 my $debug       = $conf->get("debug");
@@ -105,8 +106,10 @@ help() if ($help);
 help() unless ($table or $yaml or $package);
 
 sub help {
+    my $help_text = qx(perldoc -o html umegaya);
+    $help_text =~ s/<!-- end doc -->/<!-- end doc -->\n$local_comment/ if $local_comment;
     print $cgi->header('text/html');
-    print qx(perldoc -o html umegaya);
+    print $help_text;
     exit;
 }
 
diff --git a/umegaya.conf b/umegaya.conf
index 4b24cfa..f94e675 100644
--- a/umegaya.conf
+++ b/umegaya.conf
@@ -15,6 +15,12 @@ delay: 3600
 # Debug mode makes Umegaya scripts verbose.
 debug: 0
 
+# Local comment
+#local_comment: >
+# This Umegaya instance on upstream-metadata.debian.net is an experimental
+# service that is not part of the official Debian infrastructure, which is why it
+# is incubated on the debian.net domain instead of debian.org.
+
 # When refresh_blends is set to 1, the daily cron job umegaya-refresh-blends
 # will refresh Umegaya for all Debian Pure Blends.  This means one request to
 # alioth.debian.org for each package recommended or suggested by each Blend.

Make sure a failed ping of a package will not let the script exit but rather issue a warning and proceed with next package. (Background: packages-metadata.tar.bz2 was not updated since 23.5.2012)
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 95329cf..f0a3a95 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -18,6 +18,7 @@ set -e
 # names from $(svn ls svn://svn.debian.org/blends/projects/)
 BLENDS='debichem debian-med debian-science'
 
+#set -x
 for BLEND in $BLENDS
 do
   BLEND_URL=$(debcheckout -d $BLEND | grep url | cut -f2)
@@ -41,7 +42,13 @@ do
   for PACKAGE in $PACKAGES 
   do
     SOURCE=$(apt-cache showsrc $PACKAGE 2> /dev/null | grep Package -m1 | awk '{print $2}')
-    [ $SOURCE ] && curl --silent "http://localhost/umegaya/$SOURCE/ping"
+    if [ "$SOURCE" != "" ] ; then
+      # make sure a failed ping will not interupt script
+      curl --silent "http://localhost/umegaya/$SOURCE/ping" || true
+      if [ $? != 0 ] ; then
+        echo "$0: Problem pinging $SOURCE ($?)"
+      fi
+    fi
   done
 done
 

Update daily push script to also push control files.
diff --git a/todo.mdwn b/todo.mdwn
index d4334fb..2b6c75d 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -38,12 +38,15 @@ POOL=/var/lib/umegaya/packages-metadata/
 rm -f /tmp/umegaya-timestamp
 touch /tmp/umegaya-timestamp
 find $POOL -empty             | grep -v 'svn/'         | xargs -L1 rm -f
+find $POOL -name '*control'   | xargs grep -l DOCT     | xargs rm -f
 find $POOL -name '*copyright' | xargs grep -l DOCT     | xargs rm -f
 find $POOL -name '*upstream'  | xargs grep -l DOCT     | xargs rm -f
 find $POOL -name '*upstream'  | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*control'   | xargs grep -l '^<html' | xargs rm -f
 find $POOL -name '*copyright' | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*control'   | xargs grep -l '^500 Ca'| xargs rm -f
 find $POOL -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm -f
-find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mt]$' | xargs svn add --force
+find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mlt]$' | xargs svn add --force
 rm /tmp/umegaya-timestamp
 
 SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push' --quiet

umegaya (0.8) unreleased; urgency=low
* Download Debian source package control files (optional).
* Deployed on debian-med.debian.net.
-- Charles Plessy <plessy@debian.org> Wed, 23 May 2012 09:06:57 +0900
diff --git a/debian/changelog b/debian/changelog
index 2d05f14..cfbaea2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+umegaya (0.8) unreleased; urgency=low
+
+  * Download Debian source package control files (optional).
+  * Deployed on debian-med.debian.net.
+
+ -- Charles Plessy <plessy@debian.org>  Wed, 23 May 2012 09:06:57 +0900
+
 umegaya (0.7) unreleased; urgency=low
 
   * Deployed locally for upload-driven refreshes. 

Optionally download control files as well.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index 51acecb..cc94827 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -75,6 +75,7 @@ my $berkeleydb  = $lib . $conf->get("db_name");
 my $delay       = $conf->get("delay");
 my $debug       = $conf->get("debug");
 my $store_files = $conf->get("store_files");
+my $debian_control   = $conf->get("debian_control")  ;
 my $debian_copyright = $conf->get("debian_copyright");
 
 my %stored;
@@ -178,6 +179,11 @@ sub refresh_from_url {
             or die "Can not write $store_files/$pool/${package}.upstream: $!";
         print $debian_upstream $package_metadata_yaml;
         close($debian_upstream);
+        if ( $debian_control ) {
+            my $debian_control_url = guess_file_url($package_url, "control");
+            system(qq(svn cat "$debian_control_url" > $store_files/$pool/${package}.control)) if $debian_control_url =~ /^svn/;
+            system(qq(GET "$debian_control_url" > $store_files/$pool/${package}.control)) if $debian_control_url =~ /^http/;
+        }
         if ( $debian_copyright ) {
             my $debian_copyright_url = guess_file_url($package_url, "copyright");
             system(qq(svn cat "$debian_copyright_url" > $store_files/$pool/${package}.copyright)) if $debian_copyright_url =~ /^svn/;
diff --git a/setup.mdwn b/setup.mdwn
index afdf109..77b5c5a 100644
--- a/setup.mdwn
+++ b/setup.mdwn
@@ -66,9 +66,9 @@ To determine if a package managed with Git on Alioth contains a debian/upstream
 Accumulating the files on the local disk
 ----------------------------------------
 
-Via the _store_files_ and _debian_copyright_ options, umegaya can keep a local
-copy of the upstream and copyright files of the packages, in the _db_dir_
-directory.
+Via the _store_files_ and _debian_control_ and _debian_copyright_ options,
+umegaya can keep a local copy of the upstream, control and copyright files of
+the packages, in the _db_dir_ directory.
 
 The Debian package provides a pooled directory structure in _/var/lib/umegaya_,
 but it needs to be created if another path is chosen.
diff --git a/umegaya.conf b/umegaya.conf
index 56d618e..4b24cfa 100644
--- a/umegaya.conf
+++ b/umegaya.conf
@@ -4,7 +4,8 @@ db_dir: /var/lib/umegaya/
 # Name of the Berkeley DB.
 db_name: umegaya.db
 
-# Also download Debian copyright files if store_files is set.
+# Also download Debian control or copyright files if store_files is set.
+#debian_control: 1
 #debian_copyright: 1
 
 # Numbers of seconds for which a new request will not trigger a refresh.

More resilient debian-devel-changes pinger.
diff --git a/scripts/umegaya-ddc-ping b/scripts/umegaya-ddc-ping
index 18fa35a..1e36b12 100755
--- a/scripts/umegaya-ddc-ping
+++ b/scripts/umegaya-ddc-ping
@@ -1,11 +1,14 @@
-#!/bin/sh
+#!/bin/sh -ex
 # Umegaya's debian-devel-changes pinger
 #
 # Piped emails from http://lists.debian.org/debian-devel-changes to this program
 # trigger a ping for the corresponding package in an Umegaya instance.
 
 URL=$(grep ^ping_url /etc/umegaya/umegaya.conf | sed -r 's/ping_url:\s+//')
-grep ^Subject -m1 | cut -f3 -d ' ' | while read PACKAGE
-do
-  GET ${URL-http://localhost/umegaya}/$PACKAGE/ping > /dev/null
-done
+PACKAGE=$(grep ^Subject -m1 | awk '{print $3}')
+
+if [ "$PACKAGE" != '' ] ; then
+  curl --silent ${URL-http://localhost/umegaya}/$PACKAGE/ping > /dev/null
+  exit 0
+fi
+exit 1

Need to make sure Apache has write permissions.
diff --git a/todo.mdwn b/todo.mdwn
index f4e61f9..d4334fb 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,6 +1,9 @@
 To do
 =====
 
+ - Problem: make sure that Apache as the write permission on the pool.  This
+   will not be if a user creates a file with a usual umask.
+
  - Keep an eye on https://joinup.ec.europa.eu/asset/adms_foss/description
 
  - umegaya-refresh-blends should log warnings instead of sending them

Make the push job less verbose (but this is not the refresh job).
diff --git a/todo.mdwn b/todo.mdwn
index ca00ef2..f4e61f9 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -28,9 +28,7 @@ To do
 
 Current workaround:
 
-#!/bin/sh
-
-set -ex
+#!/bin/sh -e
 
 POOL=/var/lib/umegaya/packages-metadata/
 
@@ -42,10 +40,10 @@ find $POOL -name '*upstream'  | xargs grep -l DOCT     | xargs rm -f
 find $POOL -name '*upstream'  | xargs grep -l '^<html' | xargs rm -f
 find $POOL -name '*copyright' | xargs grep -l '^<html' | xargs rm -f
 find $POOL -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm -f
-find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mt]$' | xargs svn add
+find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mt]$' | xargs svn add --force
 rm /tmp/umegaya-timestamp
 
-SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push'
+SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push' --quiet
 
  - Die gracefully if package is not found.
  - Make sure two processes can run at the same time.

Keep an eye on ADMS F/OSS.
diff --git a/todo.mdwn b/todo.mdwn
index 71ef484..ca00ef2 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,6 +1,8 @@
 To do
 =====
 
+ - Keep an eye on https://joinup.ec.europa.eu/asset/adms_foss/description
+
  - umegaya-refresh-blends should log warnings instead of sending them
    to root via the cron job.
 

umegaya-refresh-blends should log warnings instead of sending them.
diff --git a/todo.mdwn b/todo.mdwn
index c3b440c..71ef484 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,6 +1,9 @@
 To do
 =====
 
+ - umegaya-refresh-blends should log warnings instead of sending them
+   to root via the cron job.
+
  - Make sure the cron job can work when the package is removed but not purged.
 
  - Make umegaya-adm case-insensitive

Implement Debian-Med's Svn repo structure policy, and update documentation.
diff --git a/man/umegaya-guess-url.1.mdwn b/man/umegaya-guess-url.1.mdwn
index 543f764..33eec2e 100644
--- a/man/umegaya-guess-url.1.mdwn
+++ b/man/umegaya-guess-url.1.mdwn
@@ -20,20 +20,17 @@ Gitweb.
 
 It recoginses VCS URLs from the following Debian Pure Blends.
 
-  svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/gmod/
-  svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/mgltools/
-  svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/R/
-  svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/
-  git://git.debian.org/g?i?t?/?debian-med/
+  svn://svn.debian.org/debian-med/trunk/packages/+?/([a-z0-9\+\-\.]+)/trunk
+  git://git.debian.org/debian-med/([a-z0-9\+\-\.]+).git
  
-  svn://svn.debian.org/s?v?n?/?debichem/unstable/
-  svn://svn.debian.org/s?v?n?/?debichem/experimental/
-  svn://svn.debian.org/s?v?n?/?debichem/wnpp/
-  git://git.debian.org/g?i?t?/?debichem/packages/
-
-  svn://svn.debian.org/s?v?n?/?debian-science/packages/R/
-  svn://svn.debian.org/s?v?n?/?debian-science/packages/
-  git://git.debian.org/g?i?t?/?debian-science/packages/
+  svn://svn.debian.org/s?v?n?/?debichem/unstable/([a-z0-9\+\-\.]+)/
+  svn://svn.debian.org/s?v?n?/?debichem/experimental/([a-z0-9\+\-\.]+)/
+  svn://svn.debian.org/s?v?n?/?debichem/wnpp/([a-z0-9\+\-\.]+)/
+  git://git.debian.org/g?i?t?/?debichem/packages/([a-z0-9\+\-\.]+).git
+
+  svn://svn.debian.org/s?v?n?/?debian-science/packages/R/([a-z0-9\+\-\.]+)/
+  svn://svn.debian.org/s?v?n?/?debian-science/packages/([a-z0-9\+\-\.]+)/
+  git://git.debian.org/g?i?t?/?debian-science/packages/([a-z0-9\+\-\.]+).git
 
 # RETURNS
 
diff --git a/scripts/umegaya-guess-url b/scripts/umegaya-guess-url
index 303139f..a05e642 100755
--- a/scripts/umegaya-guess-url
+++ b/scripts/umegaya-guess-url
@@ -14,17 +14,18 @@ given ($package_url) {
   }
   when (/^svn/) {
     # Debian Med
-    if    (m|svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/gmod/([a-z0-9\+\-\.]+)/| ) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/mgltools/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/R/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
-    }
-    elsif (m|svn://svn.debian.org/s?v?n?/?debian-med/trunk/packages/([a-z0-9\+\-\.]+)/|) {
-      $package = $1;
+    if (m|debian-med/trunk/packages|) {
+        if (m|svn://svn.debian.org/debian-med/trunk/packages.*/([a-z0-9\+\-\.]+)/trunk| ) {
+            $package = $1;
+        } else {
+            die <<"ERROR_MESSAGE"
+Could not parse « $package_url ».
+The package is located in Debian Med’s Subversion repository according to its
+VCS URL, but it does not point at a trunk directory as it should. See the
+following page for more information.
+http://debian-med.alioth.debian.org/docs/policy.html#svn-repository-structure
+ERROR_MESSAGE
+        }
     }
     # Debichem
     elsif (m|svn://svn.debian.org/s?v?n?/?debichem/unstable/([a-z0-9\+\-\.]+)/|) {

Assume a common structure for all Git URLs on Alioth.
diff --git a/scripts/umegaya-guess-url b/scripts/umegaya-guess-url
index 624fd1d..303139f 100755
--- a/scripts/umegaya-guess-url
+++ b/scripts/umegaya-guess-url
@@ -49,19 +49,13 @@ given ($package_url) {
     $package_url .= "debian/upstream";
   }
   when (/^git/) {
-    if    (m|git://git.debian.org/g?i?t?/?debian-med/([a-z0-9\+\-\.]+).git|) {
-      $package = $1;
-    }
-    elsif (m|git://git.debian.org/g?i?t?/?debichem/packages/([a-z0-9\+\-\.]+).git|) {
-      $package = $1;
-    }
-    elsif (m|git://git.debian.org/g?i?t?/?debian-science/packages/([a-z0-9\+\-\.]+).git|) {
+    if    (m|git://git.debian.org/.+/([a-z0-9\+\-\.]+).git|) {
       $package = $1;
+      $package_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/upstream;hb=HEAD|;
     }
     else {
       die "Could not detect package name for $package_url\n";
     }
-    $package_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/upstream;hb=HEAD|;
   }
   default {
     die "Only Subversion and Git URLs are supported"

Add trailing slash to SVN URLs that miss it.
diff --git a/cgi-bin/umegaya b/cgi-bin/umegaya
index e5def67..51acecb 100755
--- a/cgi-bin/umegaya
+++ b/cgi-bin/umegaya
@@ -154,7 +154,10 @@ say "No $key key for package ${package}." if $debug;
 sub guess_file_url {
     my $file_url = shift;
     my $file_to_download = shift;
-    $file_url .= "debian/$file_to_download" if $file_url =~ /^svn/;
+    if ($file_url =~ /^svn/) {
+        $file_url .= '/' unless $file_url =~ m(/$);
+        $file_url .= "debian/$file_to_download";
+    }
     $file_url =~ s|^git://git.debian.org/g?i?t?/?(.*)|http://git.debian.org/?p=$1;a=blob_plain;f=debian/$file_to_download;hb=HEAD| if $file_url =~ /^git/;
     say "Will retreive $file_url for debian/$file_to_download." if $debug;
     return $file_url;

To do: warn when VCS URL does not point at a directory (lack a trailing slash).
diff --git a/todo.mdwn b/todo.mdwn
index 9375541..c3b440c 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -67,3 +67,5 @@ SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily aut
  - Read http://perldoc.perl.org/CGI.html#Avoiding-Denial-of-Service-Attacks
 
  - URL-encode pacakge (and perhaps key) names.
+
+ - Warn when VCS URL does not point at a directory (lack a trailing slash).

umegaya (0.7) unreleased; urgency=low
* Deployed locally for upload-driven refreshes.
-- Charles Plessy <plessy@debian.org> Sun, 22 Apr 2012 12:48:05 +0900
diff --git a/debian/changelog b/debian/changelog
index db62825..2d05f14 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+umegaya (0.7) unreleased; urgency=low
+
+  * Deployed locally for upload-driven refreshes. 
+
+ -- Charles Plessy <plessy@debian.org>  Sun, 22 Apr 2012 12:48:05 +0900
+
 umegaya (0.6) unreleased; urgency=low
 
   * Daily cron job to refresh packages recommended or suggested by Blends.

Script to push changes daily.
diff --git a/todo.mdwn b/todo.mdwn
index 70e1695..9375541 100644
--- a/todo.mdwn
+++ b/todo.mdwn
@@ -1,6 +1,8 @@
 To do
 =====
 
+ - Make sure the cron job can work when the package is removed but not purged.
+
  - Make umegaya-adm case-insensitive
 
  - Safeguards to that umegaya only works on source package names.
@@ -19,14 +21,26 @@ To do
  - Check if there is no buggy package names with spaces in the berkeley DB.
  - Do not create 404 Gitweb files.
 
-Current workarounds:
+Current workaround:
+
+#!/bin/sh
+
+set -ex
+
+POOL=/var/lib/umegaya/packages-metadata/
+
+rm -f /tmp/umegaya-timestamp
+touch /tmp/umegaya-timestamp
+find $POOL -empty             | grep -v 'svn/'         | xargs -L1 rm -f
+find $POOL -name '*copyright' | xargs grep -l DOCT     | xargs rm -f
+find $POOL -name '*upstream'  | xargs grep -l DOCT     | xargs rm -f
+find $POOL -name '*upstream'  | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*copyright' | xargs grep -l '^<html' | xargs rm -f
+find $POOL -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm -f
+find $POOL ! -newer /tmp/umegaya-timestamp | grep -v '././.svn' | grep '[mt]$' | xargs svn add
+rm /tmp/umegaya-timestamp
 
-find . -empty             | grep -v 'svn/'         | xargs -L1 rm
-find . -name '*copyright' | xargs grep -l DOCT     | xargs rm
-find . -name '*upstream'  | xargs grep -l DOCT     | xargs rm
-find . -name '*upstream'  | xargs grep -l '^<html' | xargs rm
-find . -name '*copyright' | xargs grep -l '^<html' | xargs rm
-find . -name '*copyright' | xargs grep -l '^500 Ca'| xargs rm
+SVN_SSH="ssh -i $HOME/.ssh/alioth-svn-commit_rsa" svn commit $POOL -m 'Daily automatic umegaya push'
 
  - Die gracefully if package is not found.
  - Make sure two processes can run at the same time.

Create archive with upstream files for UDD bibref gatherer to avoid need for manuall pushing of SVN dir
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 9d38d0b..95329cf 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -44,3 +44,22 @@ do
     [ $SOURCE ] && curl --silent "http://localhost/umegaya/$SOURCE/ping"
   done
 done
+
+# create downloadable archive of the fetched files
+STOREFILES=`grep ^store_files /etc/umegaya/umegaya.conf | sed -r 's/store_files:\s+//'`
+TARGETARCHIVE=`grep ^archive_for_bibref_gatherer /etc/umegaya/umegaya.conf | sed -r 's/archive_for_bibref_gatherer:\s+//'`
+
+if [ $TARGETARCHIVE != "" -a $STOREFILES != "" ] ; then
+  STOREDIR=`dirname $STOREFILES`
+  if [ -d $STOREDIR ] ; then
+    cd $STOREDIR
+    BASESTOREDIR=`basename $STOREFILES`
+    if [ -d $BASESTOREDIR ] ; then
+      tmpignorezerolengthfiles=`mktemp`
+      find packages-metadata -size 0 >> $tmpignorezerolengthfiles
+      tar --exclude-vcs --exclude-from $tmpignorezerolengthfiles -cjf $TARGETARCHIVE $BASESTOREDIR
+      rm -f $tmpignorezerolengthfiles
+    fi
+  fi
+fi
+
diff --git a/umegaya.conf b/umegaya.conf
index 3b817d2..56d618e 100644
--- a/umegaya.conf
+++ b/umegaya.conf
@@ -26,3 +26,6 @@ refresh_blends: 0
 #local_url: http://umegaya.localhost
 local_url: http://localhost/umegaya
 ping_url: http://localhost/umegaya
+
+# Archive with upstream files for UDD bibref gatherer
+#archive_for_bibref_gatherer: /var/lib/gforge/chroot/home/groups/blends/htdocs/packages-metadata/packages-metadata.tar.bz2

Make curl silent even in non-interactive mode.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 4e4546a..9d38d0b 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -41,6 +41,6 @@ do
   for PACKAGE in $PACKAGES 
   do
     SOURCE=$(apt-cache showsrc $PACKAGE 2> /dev/null | grep Package -m1 | awk '{print $2}')
-    [ $SOURCE ] && curl "http://localhost/umegaya/$SOURCE/ping"
+    [ $SOURCE ] && curl --silent "http://localhost/umegaya/$SOURCE/ping"
   done
 done

Also exit if curl, umegaya-adm, or umegaya-guess-url are not available.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 7baab4e..4e4546a 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -6,10 +6,13 @@ set -e
 [ $(grep ^refresh_blends /etc/umegaya/umegaya.conf |
   sed -r 's/refresh_blends:\s+//') = 0 ] && exit 0
 
-# Exit if debcheckout or svn are not installed.
+# Exit if curl, debcheckout, umegaya-adm, umegaya-guess-url or svn are not installed.
 # Exit code is zero as this script is intended as a cron job.
-[ -x /usr/bin/debcheckout ] || exit 0
-[ -x /usr/bin/svn ] || exit 0
+[ -x /usr/bin/curl ]              || exit 0
+[ -x /usr/bin/debcheckout ]       || exit 0
+[ -x /usr/bin/umegaya-adm ]       || exit 0
+[ -x /usr/bin/umegaya-guess-url ] || exit 0
+[ -x /usr/bin/svn ]               || exit 0
 
 # Start with debichem med and science, but later let's fetch all the
 # names from $(svn ls svn://svn.debian.org/blends/projects/)

Corrected umegaya-refresh-blends' magic number.
diff --git a/scripts/umegaya-refresh-blends b/scripts/umegaya-refresh-blends
index 35b8470..7baab4e 100755
--- a/scripts/umegaya-refresh-blends
+++ b/scripts/umegaya-refresh-blends
@@ -1,4 +1,4 @@
-#/bin/sh
+#!/bin/sh
 
 set -e