Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sca-server-report for openSUSE:Factory checked in at 2023-08-23 14:57:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sca-server-report (Old) and /work/SRC/openSUSE:Factory/.sca-server-report.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sca-server-report" Wed Aug 23 14:57:24 2023 rev:8 rq:1105143 version:1.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/sca-server-report/sca-server-report.changes 2022-03-11 11:35:45.414231428 +0100 +++ /work/SRC/openSUSE:Factory/.sca-server-report.new.1766/sca-server-report.changes 2023-08-23 14:58:24.198074789 +0200 @@ -1,0 +2,8 @@ +Mon Aug 21 19:01:59 UTC 2023 - jason.rec...@suse.com + +- Changes in version 1.5.2 + + Fixed scatool email failure with python3 (bsc#1192315) + + Allow batch mode that does not have progress bar issue#13 (pr#14) + + Added quiet and debug modes issue#11 + +------------------------------------------------------------------- Old: ---- sca-server-report-1.5.1.tar.gz New: ---- sca-server-report-1.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sca-server-report.spec ++++++ --- /var/tmp/diff_new_pack.TOdqo2/_old 2023-08-23 14:58:24.978076183 +0200 +++ /var/tmp/diff_new_pack.TOdqo2/_new 2023-08-23 14:58:24.986076197 +0200 @@ -1,7 +1,7 @@ # # spec file for package sca-server-report # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ %define sca_python %{libbase}/python Name: sca-server-report -Version: 1.5.1 +Version: 1.5.2 Release: 0 Summary: Supportconfig Analysis Server Report License: GPL-2.0-only @@ -31,7 +31,6 @@ Source: %{name}-%{version}.tar.gz Requires: python3-base Requires: sca-patterns-base >= 1.5.0 -Requires: w3m BuildArch: noarch %description ++++++ sca-server-report-1.5.1.tar.gz -> sca-server-report-1.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sca-server-report-1.5.1/bin/scatool.py new/sca-server-report-1.5.2/bin/scatool.py --- old/sca-server-report-1.5.1/bin/scatool.py 2022-03-07 20:34:11.785087349 +0100 +++ new/sca-server-report-1.5.2/bin/scatool.py 2023-08-21 21:37:18.946299796 +0200 @@ -1,9 +1,9 @@ ############################################################################## # scatool.py - Supportconfig Analysis (SCA) Tool -# Copyright (c) 2014-2022 SUSE LLC +# Copyright (c) 2014-2023 SUSE LLC # # Description: Runs and analyzes local or remote supportconfigs -# Modified: 2022 Mar 07 +# Modified: 2023 Aug 19 ############################################################################## #command @@ -23,7 +23,7 @@ # Jason Record <jason.rec...@suse.com> # ############################################################################## -SVER = '1.5.1-1' +SVER = '1.5.1-4' ########################################################################################## # Python Imports @@ -41,10 +41,9 @@ import getopt import re import smtplib -import email -import email.encoders -import email.mime.text -import email.mime.base +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.application import MIMEApplication ########################################################################################## # Global Declarations @@ -63,6 +62,7 @@ global patternDict global firstSize global fieldOutput +global progressBarActive global progressBarWidth global productsList global distroInfo @@ -88,6 +88,7 @@ print(" -r Remove archive files (REMOVE_ARCHIVE) leaving only the report html file") print(" -p Print a pattern summary") print(" -q Quiet output") + print(" -b Batch mode that disables the progress bar") print(" -v Verbose output") print() @@ -150,6 +151,7 @@ firstSize = 30 fieldOutput = "{0:" + str(firstSize) + "} {1}" +progressBarActive = True progressBarWidth = 52 knownClasses = [] results = [] @@ -429,6 +431,36 @@ # print("]") # sys.exit() +########################################################################################## +# ProgressBar class +########################################################################################## +class ProgressBar(): + "Initialize and update progress bar class" + def __init__(self, prefix, bar_width, total): + self.prefix = prefix + self.bar_width = bar_width + self.total = total + self.count = 0 + self.out = sys.stdout + + def __str__(self): + return 'class %s(\n prefix=%r \n bar_width=%r \n total=%r\n)' % (self.__class__.__name__, self.prefix, self.bar_width, self.total) + + def update(self, count): + if( count > self.total ): + self.count = self.total + else: + self.count = count + percent_complete = int(100*self.count/self.total) + current_progress = int(self.bar_width*self.count/self.total) + print("{}[{}{}] {:3g}% {:3g}/{:3g}".format(self.prefix, "#"*current_progress, "."*(self.bar_width-current_progress), percent_complete, self.count, self.total), end='\r', file=self.out, flush=True) + #print("{}[{}{}] {:3g}%".format(self.prefix, "#"*current_progress, "."*(self.bar_width-current_progress), percent_complete), end='\r', file=self.out, flush=True) + + def finish(self): + if( self.count < self.total ): + self.update(self.total) + print("\n", flush=True, file=self.out) + ########################################################################################## # HTML REPORT FUNCTIONS @@ -948,7 +980,7 @@ else: return 0 SERVER = 'localhost' - TO = re.split(r',\s*|\s*', emailAddrList) + TO = emailAddrList.split(',') FROM = 'SCA Tool <root>' SUBJECT = "SCA Report for " + str(distroInfo['serverName']) + ": " + str(patternStats['Applied']) + "/" + str(patternStats['Total']) + ", " + str(patternStats['Crit']) + ":" + str(patternStats['Warn']) + ":" + str(patternStats['Recc']) + ":" + str(patternStats['Succ']) SCA_REPORT = htmlOutputFile.split('/')[-1] @@ -983,17 +1015,16 @@ html += "<tr><td> Success:</td><td>" + str(patternStats['Succ']) + '</td></tr>\n' html += "<tr><td>Source:</td><td>scatool v" + str(SVER) + '</td></tr>\n' html += "</table>\n</body></html>\n\n" - emailMsg = email.MIMEMultipart.MIMEMultipart('alternative') + emailMsg = MIMEMultipart() emailMsg['Subject'] = SUBJECT emailMsg['From'] = FROM emailMsg['To'] = ', '.join(TO) - emailMsg.attach(email.mime.text.MIMEText(text,'plain')) - emailMsg.attach(email.mime.text.MIMEText(html,'html')) + emailMsg.attach(MIMEText(text,'plain')) + emailMsg.attach(MIMEText(html,'html')) # now attach the file - fileMsg = email.mime.base.MIMEBase('text','html') - fileMsg.set_payload(file(htmlOutputFile).read()) - email.encoders.encode_base64(fileMsg) + with open(htmlOutputFile, 'rb') as file: + fileMsg = MIMEApplication(file.read(), _subtype="html") fileMsg.add_header('Content-Disposition','attachment;filename=' + SCA_REPORT) emailMsg.attach(fileMsg) @@ -1024,6 +1055,7 @@ global loglevel global fieldOutput global progressBarWidth + global progressBarActive results = [] validPatterns = patternPreProcessor(extractedSupportconfig) @@ -1032,9 +1064,6 @@ patternCount = 0 patternStats['Total'] = len(validPatterns) verboseLine = '{0:6} {1:>5} of {2} {3}' - patternInterval = int( int(patternStats['Total']) / int(progressBarWidth) ) - if( patternStats['Total'] < progressBarWidth ): - patternInterval = 1 patternSkipped = False if( loglevel['current'] >= loglevel['normal'] ): @@ -1043,10 +1072,10 @@ if( loglevel['current'] >= loglevel['verbose'] ): print(fieldOutput.format('Analyzing Supportconfig:', 'In Progress')) elif( loglevel['current'] == loglevel['normal'] ): - sys.stdout.write("Analyzing Supportconfig: [%s]" % (" " * progressBarWidth)) - sys.stdout.flush() - sys.stdout.write("\b" * (progressBarWidth+1)) # return to start of line, after '[' -# sys.stdout.write("\n") + if progressBarActive: + ascbar = ProgressBar("Analyzing Supportconfig: ", progressBarWidth, patternStats['Total']) + else: + print(fieldOutput.format('Analyzing Supportconfig:', 'In Progress')) for patternFile in validPatterns: patternCount += 1 @@ -1073,15 +1102,8 @@ else: print(verboseLine.format('ERROR:', patternCount, patternStats['Total'], patternErrorList[-1])) elif( loglevel['current'] == loglevel['normal'] ): - #advance the progress bar if it's not full yet -# sys.stdout.write("Count = " + str(patternCount) + ", Total = " + str(patternStats['Total']) + ", Progress = " + str(progressCount) + ", Width = " + str(progressBarWidth) + ", Interval = " + str(patternInterval) + "\n") -# sys.stdout.flush() - if( progressCount < progressBarWidth ): - #advance the progress bar in equal intervals - if( patternCount % patternInterval == 0 ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() + if progressBarActive: + ascbar.update(patternCount) except Exception as e: patternErrorList.append(patternFile + " -- Pattern runtime error: " + str(e)) if( loglevel['current'] >= loglevel['verbose'] ): @@ -1089,11 +1111,8 @@ #make output look nice if( loglevel['current'] == loglevel['normal'] ): - while( progressCount < progressBarWidth ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() - sys.stdout.write("\n") + if progressBarActive: + ascbar.finish() patternStats['Applied'] = len(results) patternStats['Errors'] = len(patternErrorList) @@ -1182,6 +1201,7 @@ global loglevel global analysisDateTime global fieldOutput + global progressBarActive global progressBarWidth #reset stuff @@ -1237,10 +1257,10 @@ if( loglevel['current'] >= loglevel['verbose'] ): print(fieldOutput.format('Gathering Supportconfig:', 'In Progress')) elif( loglevel['current'] == loglevel['normal'] ): - sys.stdout.write("Gathering Supportconfig: [%s]" % (" " * progressBarWidth)) - sys.stdout.flush() - sys.stdout.write("\b" * (progressBarWidth+1)) # return to start of line, after '[' - sys.stdout.flush() + if progressBarActive: + scbar = ProgressBar("Gathering Supportconfig: ", progressBarWidth, scTotal) + else: + print(fieldOutput.format('Gathering Supportconfig:', 'In Progress')) #this acts like a do-while. I love do-while :) #print output of the subprocess (supportconfig) @@ -1248,6 +1268,7 @@ while condition: out = p.stdout.read(1) if out != '': + progressCount += 1 alloutput = alloutput + out if( loglevel['current'] >= loglevel['verbose'] ): sys.stdout.write(out) @@ -1255,25 +1276,16 @@ elif( loglevel['current'] == loglevel['normal'] ): if out == "\n": lineNum += 1 + if progressBarActive: + scbar.update(lineNum) if ( scHeaderLines > 0 ): scHeaderLines -= 1 - else: - #advance the progress bar if it's not full yet - if( progressCount < progressBarWidth ): - #advance the progress bar in equal intervals - if( lineNum % scInterval == 0 ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() #--WHILE-- condition = not bool(out == "" and p.poll() != None) if( loglevel['current'] == loglevel['normal'] ): - while( progressCount < progressBarWidth ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() - sys.stdout.write("\n") + if progressBarActive: + scbar.finish() #if a path was given. analyze given file/folder elif len(arg) == 1: @@ -1382,10 +1394,10 @@ if( loglevel['current'] >= loglevel['verbose'] ): print(fieldOutput.format('Gathering Supportconfig:', 'In Progress')) elif( loglevel['current'] == loglevel['normal'] ): - sys.stdout.write("Gathering Supportconfig: [%s]" % (" " * progressBarWidth)) - sys.stdout.flush() - sys.stdout.write("\b" * (progressBarWidth+1)) # return to start of line, after '[' - sys.stdout.flush() + if progressBarActive: + rscbar = ProgressBar("Gathering Supportconfig: ", progressBarWidth, scTotal) + else: + print(fieldOutput.format('Gathering Supportconfig:', 'In Progress')) if( loglevel['current'] >= loglevel['verbose'] ): sys.stdout.write(out.strip("~")) @@ -1393,16 +1405,8 @@ elif( loglevel['current'] == loglevel['normal'] ): if out == "\n": lineNum += 1 - if ( scHeaderLines > 0 ): - scHeaderLines -= 1 - else: - #advance the progress bar if it's not full yet - if( progressCount < progressBarWidth ): - #advance the progress bar in equal intervals - if( lineNum % scInterval == 0 ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() + if progressBarActive: + rscbar.update(lineNum) #if we are ate the end of the file output if out == "~": endOfSupportconfig = True @@ -1414,10 +1418,8 @@ if( loglevel['current'] == loglevel['normal'] ): if remoteProgressBarSetup: - while( progressCount < progressBarWidth ): - progressCount += 1 - sys.stdout.write("=") - sys.stdout.flush() + if progressBarActive: + rscbar.finish() supportconfigPath = localSupportconfigFullPath fileInfo = os.stat(supportconfigPath) @@ -1608,7 +1610,7 @@ # Process command line arguments if( len(sys.argv[1:]) > 0 ): try: - opts, args = getopt.getopt(sys.argv[1:], "ha:so:rkcqdvpe:") + opts, args = getopt.getopt(sys.argv[1:], "ha:bso:rkcqdvpe:") # print "opts = " + str(len(opts)) + ", args = " + str(len(args)) + ":" + str(args) + ", sys.argv = " + str(len(sys.argv)) + ", last = " + str(sys.argv[-1]) except getopt.GetoptError as err: # print help information and exit: @@ -1629,6 +1631,8 @@ title() patternLibraryList() sys.exit() + elif startUpOption in ("-b"): + progressBarActive = False elif startUpOption in ("-k"): # This is the default behavior, but -k remains for compatibility. removeArchive = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sca-server-report-1.5.1/spec/sca-server-report.changes new/sca-server-report-1.5.2/spec/sca-server-report.changes --- old/sca-server-report-1.5.1/spec/sca-server-report.changes 2022-03-07 20:34:11.785087349 +0100 +++ new/sca-server-report-1.5.2/spec/sca-server-report.changes 2023-08-21 21:37:18.946299796 +0200 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Mon Aug 21 19:01:59 UTC 2023 - jason.rec...@suse.com + +- Changes in version 1.5.2 + + Fixed scatool email failure with python3 (bsc#1192315) + + Allow batch mode that does not have progress bar issue#13 (pr#14) + + Added quiet and debug modes issue#11 + +------------------------------------------------------------------- Mon Mar 7 19:18:39 UTC 2022 - Jason Record <jason.rec...@suse.com> - Changes to updated version 1.5.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sca-server-report-1.5.1/spec/sca-server-report.spec new/sca-server-report-1.5.2/spec/sca-server-report.spec --- old/sca-server-report-1.5.1/spec/sca-server-report.spec 2022-03-07 20:34:11.785087349 +0100 +++ new/sca-server-report-1.5.2/spec/sca-server-report.spec 2023-08-21 21:37:18.946299796 +0200 @@ -1,6 +1,6 @@ # spec file for package sca-server-report # -# Copyright (c) 2017-2021 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ %define sca_python %{libbase}/python Name: sca-server-report -Version: 1.5.1 +Version: 1.5.2 Release: 0 Summary: Supportconfig Analysis Server Report License: GPL-2.0 @@ -26,7 +26,6 @@ Source: %{name}-%{version}.tar.gz Requires: sca-patterns-base >= 1.5.0 Requires: python3-base -Requires: w3m BuildArch: noarch %description