You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2023/01/14 15:49:02 UTC

svn commit: r1906674 - /comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py

Author: sebb
Date: Sat Jan 14 15:49:02 2023
New Revision: 1906674

URL: http://svn.apache.org/viewvc?rev=1906674&view=rev
Log:
Try to determine relevant project from URL

Modified:
    comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py

Modified: comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py?rev=1906674&r1=1906673&r2=1906674&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py (original)
+++ comdev/projects.apache.org/trunk/scripts/cronjobs/parseprojects.py Sat Jan 14 15:49:02 2023
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3 
+
 """
 
 Reads:
@@ -16,7 +18,7 @@ Deletes any obsolete files from:
 
 """
 
-import errtee
+import errtee # N.B. this is imported for its side-effect
 import sys
 if sys.hexversion < 0x03000000:
     raise ImportError("This script requires Python 3")
@@ -271,7 +273,16 @@ for s in itemlist :
         if isinstance(err, OSError): # OSError is parent of HTTPError/URLError
             # Only mail 404 errors individually
             if isinstance(err, urllib.error.HTTPError) and err.code == 404:
-                printMail("Cannot find doap file: %s" % url, file=sys.stderr,
+                # Try to determine relevant project from URL
+                m = re.match(r"https?://([^.]+)\.", url, re.IGNORECASE)
+                if m:
+                    committeeId = m.group(1)
+                    printMail("Cannot find doap file: %s" % url, file=sys.stderr,
+                          body=("URL: %s\n%s\nSource: %s" % (url,str(err),PROJECTS_SVN)),
+                          project=committeeId
+                          )
+                else:
+                    printMail("Cannot find doap file: %s" % url, file=sys.stderr,
                           body=("URL: %s\n%s\nSource: %s" % (url,str(err),PROJECTS_SVN)))
             else:
                 print("Error when processing doap file %s:" % url, file=sys.stderr)