Thursday, February 13, 2020

https://drive.google.com/open?id=1RboQT1g2dm-YnjOTsHnf8YhWFQmF26uL

workflow:


1. we have a path like s.naphaday/rishabh.ml/s-mast where the user will paste the entire defect folder (generated in download_setup)

2. using the already made code of save_file.py we will keep scanning this path and will upload the folder in our server at s-mast/files using curl ->  need to make a python script to automate this, currently, we are entering the curl command manually.

3. we will scan this defect folder (as done in testing.py) to see if there is any Coredump file or not.

4. if not-> then simply create new entry in DB and return UIN (save_file.py does this)

5. if yes, then need to generate BT of CD and match with existing entries in DB (using md5 algo) to decide old UIN or new UIN

5a. corename will give the name of coredump (full name) as done in testing.py

5b. form the image path using the logic as in testing.py (need to modify a bit)
update: here image path is generated for both candidate and released and then its status is checked and it's working.... but we need to add a check that if the image is neither in candidate nor in released (archive - 10 days backup).. then our code shouldn't crash, instead it should throw the exception and stop.

5c. go to image path-> search for symbols.tar.gz (assume its there for now): search using for loop as we searched coredump : update: here we have simply played the image path URL and generated symbols.tar.gz url (without any for loop) and it's working... but we need to put a check in code that if symbols.tar.gz doesn't exist, then it will follow another route, else code will crash.

5d. download symbols.tar.gz

next...

Update:
until now we are able to download symbols.tar.gz but the extract is not working... may be coz we simply did extractall(...)--> need to rectify this.

extract this tar.gz

import tarfile
my_tar = tarfile.open('my_tar.tar.gz')
my_tar.extractall('./my_folder') # specify which folder to extract to
my_tar.close()
TRY THIS NOW------------------
import envoy # pip install envoy

if (file.endswith("tar.gz")):
    envoy.run("tar xzf %s -C %s" % (file, to_directory))

elif (file.endswith("tar")):
    envoy.run("tar xf %s -C %s" % (file, to_directory))

extract the CD (gunzip)

update: this below code is not working... could not understand the gzip command--> may be coz these are putty commands--> need to rectify this.


To retrieve the uncompressed file from gzip archive
import gzip  ------> ADD THIS TO CODE
>>> fp = open("zen1.txt", "wb")
>>> with gzip.open("zen.txt.gz", "rb") as f:
 bindata = f.read()
>>> fp.write(bindata)
>>> fp.close()

gdb: core-file <CD name> --> get service name -> need to see HOW

update: the above code to get service name is successfully implemented and working... need to see the way the service names arrive.. and then scan it to get the desired service name (first one-> LWP) and then generate the rpm name and proceed by going to the rpm path url directly--> play with strings--> I don't think there is any iterator required over here

generate rpm repository path (play with strings) -> CBD

download reqd rpm from service name -> CBD as symbols was downloaded

extract rpm -> need to see

.
.
.
generate bt

Additionally, need to maintain the DB as well.