mirror of
https://github.com/gluster/glusterfs.git
synced 2026-02-06 18:48:16 +01:00
The jenkins release-new job runs on a CentOS 7 box, which does not have python3. As a result it runs (autogen.sh and) configure before producing the dist tar file, converting all the python3 shebangs to python2 shebangs in the dist tar file. Then when that tar file is "carried" to, e.g. Fedora koji build system to build packages, the shebangs are incorrect, despite having originally been correct in the git repo. Change-Id: I5154baba3f6d29d3c4823bafc2b57abecbf90e5b updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
46 lines
1.2 KiB
Python
Executable File
46 lines
1.2 KiB
Python
Executable File
|
|
from __future__ import print_function
|
|
import sys
|
|
|
|
try:
|
|
import psutil
|
|
except ImportError:
|
|
print("Please install psutil --> pip install psutil")
|
|
sys.exit(1)
|
|
|
|
def pmap_find(p, name):
|
|
for m in p.memory_maps(grouped=True):
|
|
if m.path.endswith("%s.so" % name):
|
|
return True
|
|
continue
|
|
return False
|
|
|
|
def pidof(processname):
|
|
for p in psutil.process_iter():
|
|
if p.pid == 0:
|
|
continue
|
|
if "gluster" in processname:
|
|
if processname == "glusterd" and pmap_find(p, "glusterd"):
|
|
print((p.pid))
|
|
if processname == "glusterfs" and pmap_find(p, "client"):
|
|
print((p.pid))
|
|
if processname == "glusterfsd" and pmap_find(p, "posix-acl"):
|
|
print((p.pid))
|
|
continue
|
|
if processname.strip() == p.name():
|
|
print((p.pid))
|
|
|
|
def main(argv):
|
|
if len(argv) < 2:
|
|
sys.stderr.write("Usage: %s <processname>\n" % (argv[0],))
|
|
return 1
|
|
try:
|
|
pidof(argv[1])
|
|
except Exception as err:
|
|
print(err)
|
|
sys.stderr.write("Please be root - %s\n" % err);
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv)
|