Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 83119 Details for
Bug 126733
beagle crawl changes
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
FilterEbuild.cs
FilterEbuild.cs (text/plain), 3.53 KB, created by
Pat Double
on 2006-03-25 16:26:58 UTC
(
hide
)
Description:
FilterEbuild.cs
Filename:
MIME Type:
Creator:
Pat Double
Created:
2006-03-25 16:26:58 UTC
Size:
3.53 KB
patch
obsolete
>// >// FilterEbuild.cs >// >// Copyright (C) 2006 Pat Double <pat@patdouble.com> >// > >// >// Permission is hereby granted, free of charge, to any person obtaining a >// copy of this software and associated documentation files (the "Software"), >// to deal in the Software without restriction, including without limitation >// the rights to use, copy, modify, merge, publish, distribute, sublicense, >// and/or sell copies of the Software, and to permit persons to whom the >// Software is furnished to do so, subject to the following conditions: >// >// The above copyright notice and this permission notice shall be included in >// all copies or substantial portions of the Software. >// >// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE >// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER >// DEALINGS IN THE SOFTWARE. >// > >using System; >using System.IO; >using System.Text.RegularExpressions; >using Beagle.Daemon; > >namespace Beagle.Filters { > > public class FilterEbuild : Beagle.Daemon.Filter { > Regex METADATA_PATTERN = new Regex("\\s*(?<key>([A-Z_]+))\\s*=\\s*\"(?<value>(.*))\"\\s*"); > Regex EINFO = new Regex("\\s*(einfo|ewarn)\\s+\"(?<message>(.*))\"\\s*"); > Regex PACKAGE = new Regex("(?<name>([^0-9]+))-(?<version>(.+)).ebuild"); > > public FilterEbuild () > { > AddSupportedFlavor (FilterFlavor.NewFromExtension (".ebuild")); > SetVersion(2); > } > > override protected void DoOpen (FileInfo file) > { > Match match = PACKAGE.Match(file.Name); > String pkgname = match.Groups["name"].ToString(); > if (pkgname.Length > 0) { > AddProperty (Beagle.Property.New ("dc:title", pkgname)); > } > > String version = match.Groups["version"].ToString(); > if (version.Length > 0) { > AddProperty (Beagle.Property.New ("fixme:version", version)); > } > > StreamReader reader = new StreamReader(new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)); > > string str = null; > while ((str = reader.ReadLine ()) != null) { > // Skip comments > if (str.StartsWith("#")) > continue; > > // Handle line continuation > string str2 = null; > while (str.Trim().EndsWith("\\") && ((str2 = reader.ReadLine ()) != null)) > { > str = str.Trim(); > if (str.Length == 1) > str = str2; > else > str = str.Substring(0, str.Length - 1) + " " + str2.Trim(); > } > > if (str.Length > 0) { > // check for meta data > MatchCollection matches; > matches = METADATA_PATTERN.Matches (str); > if (matches.Count > 0) { > foreach (Match theMatch in matches) { > String key = theMatch.Groups ["key"].ToString (); > String value = theMatch.Groups ["value"].ToString (); > if (key.Equals("DESCRIPTION")) { > AddProperty (Beagle.Property.New ("dc:description", value)); > } > else if (key.Equals("LICENSE")) { > AddProperty (Beagle.Property.New ("dc:rights", value)); > } > else if (key.Equals("HOMEPAGE")) { > AddProperty (Beagle.Property.New ("dc:source", value)); > } > } > } > else > { > // check for einfo/ewarn > matches = EINFO.Matches (str); > if (matches.Count > 0) { > foreach (Match theMatch in matches) { > AppendText(theMatch.Groups ["message"].ToString ()); > } > } > } > } > } > Finished(); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 126733
:
82499
|
82510
|
82511
|
82513
|
82549
|
82643
|
82879
|
82880
|
83118
|
83119
|
83362
|
84153
|
84154
|
84165
|
84166