From: Christian Ruppert <idl0r@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Sebastian Pipping <sping@gentoo.org>
Subject: Re: [gentoo-dev] [rfc] Making repoman/metagen check for validity of herds
Date: Thu, 25 Feb 2010 19:38:07 +0100 [thread overview]
Message-ID: <4B86C38F.5060304@gentoo.org> (raw)
In-Reply-To: <4B86BC30.3080108@gentoo.org>
[-- Attachment #1.1: Type: text/plain, Size: 718 bytes --]
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
[-- Attachment #1.2: repoman-herd-checks.patch --]
[-- Type: text/plain, Size: 2518 bytes --]
--- 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)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2010-02-25 18:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 18:06 [gentoo-dev] [rfc] Making repoman/metagen check for validity of herds Sebastian Pipping
2010-02-25 18:38 ` Christian Ruppert [this message]
2010-02-26 14:39 ` Tiziano Müller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B86C38F.5060304@gentoo.org \
--to=idl0r@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=sping@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox