FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 02-25-2010, 05:06 PM
Sebastian Pipping
 
Default Making repoman/metagen check for validity of herds

I agree that additional repoman checks can help to improve quality in
Gentoo...


It seems that currently neither metagen nor repoman check what I put in
for herd (i.e. if such a herd exists or not).

Does anyone feel like getting his hands on that or like teaming up on it?



Sebastian
 
Old 02-25-2010, 05:38 PM
Christian Ruppert
 
Default Making repoman/metagen check for validity of herds

On 02/25/2010 07:06 PM, Sebastian Pipping wrote:
> I agree that additional repoman checks can help to improve quality in
> Gentoo...
>
>
> It seems that currently neither metagen nor repoman check what I put in
> for herd (i.e. if such a herd exists or not).
>
> Does anyone feel like getting his hands on that or like teaming up on it?
>
>
>
> Sebastian
>

I started playing with herd checks in repoman but unfortunately I didn't
finish it yet.
I'm sure we can put such checks together with my stuff.
The diff was against portage-2.2_rc61 iirc.

--
Regards,
Christian Ruppert
Gentoo Linux Developer and Bugzilla Admin
Fingerprint: 9B50 01DF E873 A0E4 126D 6C16 8B17 B68E 7FAE 7D38

--- portage/pym/repoman/utilities.py.orig 2010-01-03 23:00:18.703948362 +0100
+++ portage/pym/repoman/utilities.py 2010-01-29 12:26:28.891391463 +0100
@@ -15,7 +15,8 @@ __all__ = [
"get_commit_message_with_editor",
"get_commit_message_with_stdin",
"have_profile_dir",
- "parse_metadata_use"
+ "parse_metadata_use",
+ "check_metadata"
]

import codecs
@@ -146,6 +147,53 @@ def parse_metadata_use(mylines, uselist=
metadatadom.unlink()
return uselist

+def check_metadata(settings, metadata):
+ try:
+ metadatadom = minidom.parse(metadata)
+ except ExpatError, e:
+ raise ExpatError("%s: %s" % (metadata, e,))
+
+ _elem = metadatadom.getElementsByTagName("herd")
+
+ # If no herd tag exist
+ if not _elem:
+ print("There must be at least one herd subtag.")
+ metadatadom.unlink()
+ return True
+ else:
+ for _herd in _elem:
+ # Check for empty herd tags
+ if not _herd.hasChildNodes():
+ print('The contents of the "herd" tag must be the name of a herd as specified in the herds.xml file or the "no-herd" herd. It must occur at least once.')
+ metadatadom.unlink()
+ return True
+
+ _elem = metadatadom.getElementsByTagName("maintainer")
+ if _elem:
+ try:
+ herddom = minidom.parse(os.path.join(settings["PORTDIR"], "metadata/herds.xml"))
+ except ExpatError, e:
+ print(e)
+ metadatadom.unlink()
+ return True
+
+ _herdlist = []
+ _helem = herddom.getElementsByTagName("herd")
+ for _herd in _helem:
+ _email = _herd.getElementsByTagName("email")
+ # Some herds don't have a email tag
+ if _email:
+ _herdlist.append(_email[0].childNodes[0].data)
+ herddom.unlink()
+
+ for _mtainer in _elem:
+ _email = _mtainer.getElementsByTagName("email")
+ if _email[0].childNodes[0].data in _herdlist:
+ print(_email[0].childNodes[0].data)
+ metadatadom.unlink()
+ return True
+
+ metadatadom.unlink()

def FindPackagesToScan(settings, startdir, reposplit):
""" Try to find packages that need to be scanned
--- portage/repoman.orig 2010-01-03 23:00:14.698949316 +0100
+++ portage/repoman 2010-01-29 12:27:06.805142940 +0100
@@ -1273,6 +1273,11 @@ for x in scanlist:
print(red("!!! ")+z)
stats["metadata.bad"]+=1
fails["metadata.bad"].append(x+"/metadata.xml")
+ metadata_bad = True
+ if not metadata_bad:
+ if utilities.check_metadata(repoman_settings, os.path.join(checkdir, "metadata.xml")):
+ stats["metadata.bad"]+=1
+ fails["metadata.bad"].append(x+"/metadata.xml")

del metadata_bad
muselist = frozenset(muselist)
 
Old 02-26-2010, 01:39 PM
Tiziano Müller
 
Default Making repoman/metagen check for validity of herds

Am Donnerstag, den 25.02.2010, 19:06 +0100 schrieb Sebastian Pipping:
> I agree that additional repoman checks can help to improve quality in
> Gentoo...
>
>
> It seems that currently neither metagen nor repoman check what I put in
> for herd (i.e. if such a herd exists or not).
>
> Does anyone feel like getting his hands on that or like teaming up on it?

Since the value for <herd> is a distinct set of values it could be
easily done using a xsd or relax-ng schema plus XIncludes.
See http://dev.gentoo.org/~dev-zero/metadata/ for my earlier
experiments.


--
Tiziano Müller
Gentoo Linux Developer
Areas of responsibility:
Samba, PostgreSQL, CPP, Python, sysadmin, GLEP Editor
E-Mail : dev-zero@gentoo.org
GnuPG FP : F327 283A E769 2E36 18D5 4DE2 1B05 6A63 AE9C 1E30
 

Thread Tools




All times are GMT. The time now is 04:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org