[aur-dev] [PATCH] git-update: Make url field optional

Johannes Löthberg johannes at kyriasis.com
Fri Jun 19 22:01:27 UTC 2015


The url PKGBUILD variable is optional, so should be in the AUR as well.

Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
pkgdesc should be optional as well though, but I was unsure what Lukas 
would think, so sending this first. Comments?

 git-interface/git-update.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index ebed491..34fabcf 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -247,10 +247,13 @@ for commit in walker:
     for pkgname in srcinfo.GetPackageNames():
         pkginfo = srcinfo.GetMergedPackage(pkgname)
 
-        for field in ('pkgver', 'pkgrel', 'pkgname', 'pkgdesc', 'url'):
+        for field in ('pkgver', 'pkgrel', 'pkgname', 'pkgdesc'):
             if not field in pkginfo:
                 die_commit('missing mandatory field: %s' % (field), commit.id)
 
+        if not 'url' in pkginfo:
+            pkginfo['url'] = 'None'
+
         if 'epoch' in pkginfo and not pkginfo['epoch'].isdigit():
             die_commit('invalid epoch: %s' % (pkginfo['epoch']), commit.id)
 
@@ -258,11 +261,11 @@ for commit in walker:
             die_commit('invalid package name: %s' % (pkginfo['pkgname']),
                        commit.id)
 
-        if not re.match(r'(?:http|ftp)s?://.*', pkginfo['url']):
+        if 'url' in pkginfo and not re.match(r'(?:http|ftp)s?://.*', pkginfo['url']):
             die_commit('invalid URL: %s' % (pkginfo['url']), commit.id)
 
         for field in ('pkgname', 'pkgdesc', 'url'):
-            if len(pkginfo[field]) > 255:
+            if field in pkginfo and len(pkginfo[field]) > 255:
                 die_commit('%s field too long: %s' % (field, pkginfo[field]),
                            commit.id)
 
-- 
2.4.3


More information about the aur-dev mailing list