Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Regex to break up rpm filenames

by jasonk (Parson)
on Feb 22, 2003 at 14:25 UTC ( [id://237735]=note: print w/replies, xml ) Need Help??


in reply to Regex to break up rpm filenames

Keep in mind that the version information in the filename is only there to be helpful for the human, the version information that is used when you actually install the file comes from within the RPM itself. This means it is possible for an rpm to have any filename and still be valid, although the regexps already offered here will work in most cases.

Because of this limitation, the best way to get the information you are looking for is to download the package, and extract the information from inside it. If you can't get the perl RPM package to install, but you do have the rpm command, you can get this information like this:

my($name,$version,$release,$arch) = split(' ',`rpm -qp --queryformat ' +%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' $filename`);

If you can't download the package, the other regexps offered here should work in most cases, just keep this in mind if you find it gives you the wrong information for some package.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://237735]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-24 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found