Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#7085 - namcap has trouble with some PKGBUILDs

Attached to Project: Arch Linux
Opened by Shira K (Shirakawasuna) - Monday, 07 May 2007, 05:38 GMT
Last edited by Jason Chu (jason) - Tuesday, 24 July 2007, 18:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jason Chu (jason)
Architecture All
Severity Medium
Priority Normal
Reported Version 0.8 Voodoo
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

After a bit of searching, it seems namcap has trouble analyzing PKGBUILDs that have md5sum entries that span multiple lines.
For example, if my PKGBUILD has these lines:
md5sums=('afb4476b9556fff4d18db124b20141a9'
'e9d7c18677809eed61ca6f5225c33a9d'
'e19debe24be20f1f88e112bb1ac869a3'
'8ba4628fa1cac3399725fff8a4a88157'
'97a20a4122d0ff789b5a26a6c77fdde1')
then namcap will give this error:

$ namcap PKGBUILD
Traceback (most recent call last):
File "/usr/bin/namcap", line 163, in <module>
ret = pkg.analyze(pkginfo, package)
File "/usr/lib/python2.5/site-packages/Namcap/md5sums.py", line 34, in analyze
if len(pkginfo.source) > len(pkginfo.md5sums):
TypeError: object of type 'NoneType' has no len()

As these lines were generated by makepkg -g PKGBUILD, it would be a good idea to improve this functionality. To work around this, simply reduce the md5sum entry to a single line, i.e. to make the earlier lines work they would look like this:
md5sums=('afb4476b9556fff4d18db124b20141a9' 'e9d7c18677809eed61ca6f5225c33a9d' 'e19debe24be20f1f88e112bb1ac869a3' '8ba4628fa1cac3399725fff8a4a88157' '97a20a4122d0ff789b5a26a6c77fdde1')
This task depends upon

Closed by  Jason Chu (jason)
Tuesday, 24 July 2007, 18:41 GMT
Reason for closing:  Fixed
Additional comments about closing:  This has been fixed in an even better way in namcap 2.0.
Comment by Roman Kyrylych (Romashka) - Monday, 07 May 2007, 11:29 GMT
Weird.
I don't have issues with makepkg -g generated md5sums and namcap.
Comment by Shira K (Shirakawasuna) - Monday, 07 May 2007, 16:15 GMT
I forgot to mention that I'm using pacman 3 and namcap 1.6-1. Were the md5sums generated multiple lines?
Comment by Dan McGee (toofishes) - Monday, 07 May 2007, 19:46 GMT
pacman.py:237 in the namcap source has troubles: m = re.match('\s*md5sums\s*=\s*\((.*)\)', i)

It likely has to do with the omission of the \ at the end of lines in the md5sums array. They are not required by bash and we got rid of them with pacman 3. We may need a new way to parse the PKGBUILD file for all of the arrays that could span multiple lines (in theory, all of them).
Comment by Callan Barrett (wizzomafizzo) - Saturday, 14 July 2007, 18:21 GMT
namcap dies because pkginfo.md5sums returns None. I made the patch for PKGBUILDs without any md5sums and coincidentally it also fixes this problem for the same reason, this is because the regexp doesn't match anything and returns the same as if there were no md5sums at all.

This patch should fix it.
Comment by Jesse Young (PenguinFlavored) - Tuesday, 24 July 2007, 04:53 GMT
To fix toofishes' observation, I've written the following patch which wraps multiline arrays onto one line. It works like the \ character at the end of the line. But instead of looking for the \ it matches a regex.

Loading...