On Mon, Feb 03, 2014 at 09:48:43PM -0500, James McCoy wrote:
> On Sun, Feb 02, 2014 at 11:44:51AM +0900, Charles Plessy wrote:
> > Le Thu, Jan 30, 2014 at 05:06:22PM +0100, Andreas Tille a écrit :
> > >   * working on the needed changes for UDD machine readable files gatherer
> 
> Attached patch should allow that to work on both debian/upstream and
> debian/upstream/metadata, which is a name I've heard suggested and what
> first came to mind when the issue was initially raised.

Updated patch attached which fixes detection of debian/upstream/metadata
in git repositories.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@debian.org>
From b3019a7ee3632b8f670aae7dae12283d57560fff Mon Sep 17 00:00:00 2001
From: James McCoy <james...@debian.org>
Date: Mon, 3 Feb 2014 21:33:48 -0500
Subject: [PATCH] fetch-machine-readable: Support debian/upstream and
 debian/upstream/metadata

---
 misc/machine_readable/fetch-machine-readable | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/misc/machine_readable/fetch-machine-readable b/misc/machine_readable/fetch-machine-readable
index f905243..a0d1c8a 100755
--- a/misc/machine_readable/fetch-machine-readable
+++ b/misc/machine_readable/fetch-machine-readable
@@ -42,7 +42,7 @@ svn_checkout_machine_readable () {
   TMPLIST=`mktemp`
   svn list --verbose svn://localhost/$1 --recursive | \
     grep -v -e '/tags/' -e '/branches/' -e '/patches/' | \
-    grep -e "/control$" -e "/changelog$" -e "/copyright$" -e "/upstream$" | \
+    grep -e "/control$" -e "/changelog$" -e "/copyright$" -e "/upstream$" -e "/upstream/metadata$" | \
     sed 's/^.*[[:space:]]\([^[:space:]]\+\)/\1/' \
     > $TMPLIST
   # debug
@@ -78,31 +78,31 @@ svn_checkout_machine_readable () {
           echo "Vcs-Svn: svn://svn.debian.org/$1/$vcslocation" > $TARGETDIR/$firstletter/${srcname}.vcs
           echo "Vcs-Browser: http://svn.debian.org/wsvn/$1/$vcslocation"; >> $TARGETDIR/$firstletter/${srcname}.vcs
           echo "Blend: `echo $1 | sed 's?/.*??'`" >> $TARGETDIR/$firstletter/${srcname}.vcs
-          for file in control copyright upstream ; do
+          for file in control copyright upstream upstream/metadata ; do
+            srcfile=${file#upstream/}
+            destfile=${file%/metadata}
             getfile=`grep -e "/$pkg/trunk/debian/$file$" -e "^$pkg/trunk/debian/$file$" -e "^$pkg/debian/$file$" -e "trunk/$pkg/debian/$file$" -e "/$pkg/[a-z]\+/trunk/debian/$file$" $TMPLIST 2>/dev/null`
             if [ "" != "$getfile" ] ; then
               svn export svn://localhost/$1/$getfile >/dev/null 2>/dev/null
-              if [ -e $file ] ; then
-                mv $file $TARGETDIR/$firstletter/${srcname}.$file
+              if [ -e $srcfile ] ; then
+                mv $srcfile $TARGETDIR/$firstletter/${srcname}.$destfile
               else
                 echo "ERR 1: Can not obtain file ${file} of source ${srcname} of team $1 from ${getfile}" >> $ERRLOG
               fi
             else
               if ! `echo $vcslocation | grep -q trunk` ; then
-                if [ "$file" != "upstream" ] ; then
+                if [ "$destfile" != "upstream" ] ; then
                   echo "Package $pkg is lacking trunk directory in vcslocation ${vcslocation}. Try to find file $file anyway." >> $ERRLOG
                   getfile=`grep -e "$vcslocation/debian/$file$" $TMPLIST 2>/dev/null`
                   if [ "" != "$getfile" ] ; then
                     svn export svn://localhost/$1/$getfile >/dev/null 2>/dev/null
-                    if [ -e $file ] ; then
-                      mv $file $TARGETDIR/$firstletter/${srcname}.$file
+                    if [ -e $srcfile ] ; then
+                      mv $srcfile $TARGETDIR/$firstletter/${srcname}.$destfile
                     else
                       echo "ERR 2: Can not obtain file ${file} of source ${srcname} of team $1 from ${getfile}" >> $ERRLOG
                     fi
                   else
-                    if [ "$file" != "upstream" ] ; then
-                      echo "Did not found $file for package $pkg (`grep "$pkg" $TMPLIST | grep "$file"`)" >> $ERRLOG
-                    fi
+                    echo "Did not found $file for package $pkg (`grep "$pkg" $TMPLIST | grep "$file"`)" >> $ERRLOG
                   fi
                 fi
               fi
@@ -135,8 +135,9 @@ git_checkout_machine_readable () {
     echo "Vcs-Git: git://git.debian.org$1" > $TARGETDIR/$firstletter/${srcname}.vcs
     echo "Vcs-Browser: http://git.debian.org"`echo $1 | sed 's+^/git/+/?p=+'` >> $TARGETDIR/$firstletter/${srcname}.vcs
     echo "Blend: `echo $2 | sed 's?/.*??'`" >> $TARGETDIR/$firstletter/${srcname}.vcs
-    for file in `git ls-tree HEAD debian/ 2>/dev/null | grep -e "/control$" -e "/changelog$" -e "/copyright$" -e "/upstream$" | sed 's/^[0-9]\+[[:space:]]\+blob[[:space:]]\+[0-9a-f]\+[[:space:]]\+//'` ; do
-      target=$TARGETDIR/$firstletter/${srcname}.`echo $file | sed 's?debian/??'`
+    for file in `git ls-tree -r HEAD debian/ 2>/dev/null | grep -e "/control$" -e "/changelog$" -e "/copyright$" -e "/upstream$" -e "/upstream/metadata$" | sed 's/^[0-9]\+[[:space:]]\+blob[[:space:]]\+[0-9a-f]\+[[:space:]]\+//'` ; do
+      destfile=${file%/metadata}
+      target=$TARGETDIR/$firstletter/${srcname}.`echo $destfile | sed 's?debian/??'`
       git show HEAD:$file > $target
     done
   else
-- 
1.8.5.2.297.g3e57c29

Attachment: signature.asc
Description: Digital signature

Reply via email to