rpminspect / rpminspect-tag-runner

Scripts to run rpminspect against an entire tag of packages
GNU General Public License v3.0
0 stars 1 forks source link

Add generate_list python script #1

Closed sturivny closed 2 years ago

sturivny commented 2 years ago

This script does the same as the generate-list.sh but with some improvements. Run python generate_list.py --help to get help Run python generate_list.py --koji-tag=c8s-pending --filename=my_file.log to specify a koji tag and a filename. In case you don't provide any arguments, they will be taken from the scriptб see lines 8-10.

If you find this script useful, feel free to remove the generate-list.sh :)

jimbair commented 2 years ago

We'll need to add #!/usr/bin/python3 to the top I think :) First time I ran chmod +x and tried to run it, it was quite unhappy.

I believe this change happened after your fork, but a minor change I would make is:

koji_url = "https://kojihub.stream.centos.org/kojihub"

I changed that and diffed the results (after a sort) and they were the same so functionally it doesn't change, but it means it works for everyone.

This may just require me to look at the logger docs, but I see we're using:

formatter = logging.Formatter('%(asctime)s - %(name)s - %(message)s')

Which gives us:

2022-04-26 10:10:15,246 - root - Got arguments: Namespace(koji_tag='c9s-pending', filename='list.txt')

Mostly trying to figure out why it's saying root when I am logged in as jbair when running with no sudo being invoked. :) I would also be okay with that being the script name maybe? Or a status, like INFO or ERROR or that sort of thing.

When I run the old and new script and diff the results, it's showing the same results, which looks good:

[jim@xps foo]$ ./generate-list.sh 
Tue Apr 26 10:12:12 AM CDT 2022 - INFO: Generating list.txt
Tue Apr 26 10:12:14 AM CDT 2022 - INFO: list.txt generated successfully.
[jim@xps foo]$ cat list.txt | sort > list.txt.old
[jim@xps foo]$ rm list.txt
[jim@xps foo]$ ./generate_list.py 
2022-04-26 10:12:41,920 - root - Got arguments: Namespace(koji_tag='c9s-pending', filename='list.txt')
2022-04-26 10:12:41,920 - root - Start getting list of tagged packages from Koji tag {koji_tag}
2022-04-26 10:12:43,033 - root - Total 2532 tagged packages in the tag c9s-pending
2022-04-26 10:12:43,034 - root - Saving list of tagged packages to the file list.txt
2022-04-26 10:12:43,034 - root - All packages was saved to the file list.txt
[jim@xps foo]$ cat list.txt | sort > list.txt.new
[jim@xps foo]$ rm list.txt
[jim@xps foo]$ diff list.txt.old list.txt.new 
[jim@xps foo]$ echo $?
0
sturivny commented 2 years ago

Added #!/usr/bin/python3 to the top. Updated koji_url Modified logger. Now you should see jbair when running with no sudo on your laptop That root that you saw was connected to the logger itself :)