Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rpm_subs_hash(path):
- """ Get actual subsystems of correction rpm file.
- Returns dictionary of subsystems with their revisions.
- Takes values from current rpm file.
- """
- # rpm -qlp returns path in following format
- # /var/mnt/local/sysimg/flexiserver/opt/Nokia/var/swmgmt/downloaded_rpms/R_GOMS6_1.19.1.0.release_oms.corr76
- # /var/mnt/local/sysimg/flexiserver/opt/Nokia/var/swmgmt/downloaded_rpms/R_GOMS6_1.19.1.0.release_oms.corr76/SS_Affe-1.37415-R_GOMS6_1.19.1.0_corr76.x86_64.rpm
- # Script needs to ignore lines not containing .rpm files, then remove path (os.split()) and then split actual rpm file.
- # SS_Affe-1.37415-R_GOMS6_1.19.1.0_corr76.x86_64.rpm:
- # (SS_Affe)-1.(37415)-R_GOMS6_1.19.1.0_corr76.x86_64.rpm.
- # This will return a dictionary where first bracket captures a key (name of subsystem) and second captures value (revision of subsystem).
- print("rpm_subs_hash: path: %s") % path
- hashtable = {}
- r = re.compile(r'(SS_[A-Za-z]+)-([\d\.]+).*\.rpm$')
- ret = subprocess.Popen("/bin/rpm -qlp %s" % path, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- for filepath in ret.stdout.lines():
- match = r.search(filepath)
- if match:
- hashtable.update(dict(match.groups()))
- return hashtable
- ----------------------
- ./check_rpm.py -r R_GOMS6_1.19.1.0 -c 80
- Starting main
- Parsing options
- get_arch: SELECT Platform from products_table WHERE RIS='R_GOMS6_1.19.1.0' LIMIT 1;
- get_arch: arch: both
- get_mode: SELECT is_release from products_table WHERE RIS='R_GOMS6_1.19.1.0';
- main: corr_arch: both, corr_mode: release
- main: corr_path64: /build/OMS/R_GOMS6_1.19.1.0.release/corr80/R_GOMS6_1.19.1.0.release_oms.corr80-inc-1.rpm
- rpm_subs_hash: path: /build/OMS/R_GOMS6_1.19.1.0.release/corr80/R_GOMS6_1.19.1.0.release_oms.corr80-inc-1.rpm
- Traceback (most recent call last):
- File "./check_rpm.py", line 162, in ?
- main()
- File "./check_rpm.py", line 137, in main
- rpmsubs_hash64 = rpm_subs_hash(corr_path64)
- File "./check_rpm.py", line 50, in rpm_subs_hash
- ret = subprocess.Popen("/bin/rpm -qlp" +path)
- File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
- errread, errwrite)
- File "/usr/lib64/python2.4/subprocess.py", line 993, in _execute_child
- raise child_exception
- OSError: [Errno 2] No such file or directory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement