Created
October 5, 2016 00:48
-
-
Save DALDEI/738fc960a006fda29a923850358a426a to your computer and use it in GitHub Desktop.
rpm utils - print how yum and rpmUtils parses an RPM filename as a 'NVREA'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# Print the 'NEVRA' of an rpm file using its path only | |
# This is what yum tools does when given only an rpm filename | |
import sys | |
import re | |
from rpmUtils.miscutils import splitFilename | |
for path in sys.argv[1:]: | |
x = path[path.rfind( '/' )+1:] | |
# print "Path: {0} File: {1}".format(path,x) | |
(n, v, r, e, a) = splitFilename(x) | |
print "Path: {5}\nName: {0}\nEpoch: {1}\nVersion: {2}\nRelease: {3}\nArch: {4}".format(n,e,v,r,a,x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment