[Mono-devel-list] API to query RPM database?
Rafael Teixeira
monoman at gmail.com
Tue Jan 18 12:09:18 EST 2005
Hi Andrew,
See inline.
> Hello. All of this stuff sounds interesting.
On Tue, 18 Jan 2005 15:43:35 +0100, Andrew <agomez at wke.es> wrote:
> Rafael Teixeira escribió:
> > I don't know any such binding for Mono, but you can:
> >
> > 1) spawn a process to call "rpm -q" and capture and process it's
> > output. That is easy to do in Mono. See this excerpt from mbas code to
> > have an idea:
>
> Can that code (1) run on Mono for windows to call Win32 executables?
It runs with MS.NET too, you just need to call native executables
(binaries/script/.bat/etc.)
> Can that code (1) be compiled by MS VS.NET?
Sure. You just compile with mcs or csc (they generate the same
portable binary) and run with .net or mono (both implement the
Process/ProcessStartInfo classes in their base class libraries in the
System.Diagnostics namespace).
> I write because I need to do something similar, but with "grep" instead
> of "rpm". Is there some .NET library (for Mono or VS.NET) out there that
> already does the "dirty stuff" of the grep tool?
Maybe you can extract ideas from these projects:
http://www.codeproject.com/csharp/shell_net.asp - "Shell.NET is a set
of console applications written in C#" including grep
http://www.codeproject.com/csharp/wingrep.asp - "A C# Grep Application"
>Or should I use the first method proposed by Rafael Texeira?
Then you'll need to have cygwin's grep or some other executable ready
for you to call, it doesn't look like the best solution.
>Or should I code the library myself (it seems not very difficult)?
See the above projects for ideas. The important fact is that the Base
Class Library has classes to easily read text files, recurse into
directories and apply regular expressions so writing such a tool is
just a glue-the-right-parts exercise.
> Any opinions will be appreciated.
Hope it helps,
--
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
More information about the Mono-devel-list
mailing list