Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 710029 Details for
Bug 919499
FEAT: deprecate results rpm building code
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
removes the results package generation from the submit command
results-rpm-remove.patch (text/plain), 15.40 KB, created by
Greg Nichols
on 2013-03-14 13:55:31 UTC
(
hide
)
Description:
removes the results package generation from the submit command
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2013-03-14 13:55:31 UTC
Size:
15.40 KB
patch
obsolete
>diff --git a/hwcert/hardwaretest.py b/hwcert/hardwaretest.py >index d348db6..7679f0a 100644 >--- a/hwcert/hardwaretest.py >+++ b/hwcert/hardwaretest.py >@@ -1001,39 +1001,19 @@ class HardwareTestHarness(Controller): > return self.__submit() > > def __submit(self): >- success = True >- if self.certification and self.certification.getNumberOfTestRuns() > 0: >- if self.options.mode != Constants.auto: >- # optionally submit results to the catalog >- if self.catalog.isReachable(): >- (submitted, success) = self.catalog.submit(self.certification) >- if not success: >- return False >- if submitted: >- if self.ui.promptConfirm("Would you like to clean current test results from this system?"): >- self.removeLogFiles() >- return True >- >- # make sure model and vendor are set >- if not (self.certification.getHardware(Tags.vendor) and self.certification.getHardware(Tags.make) and self.certification.getHardware(Tags.model)): >- print "Error: could not generate results rpm because vendor, make or model are not set" >- print "Use \"hwcert plan --certification to set these values" >- return False >- >- if self.options.mode == Constants.auto or self.ui.promptConfirm("Would you like to package the results?"): >- report = Report(self.options, self.certification) >- if report.WriteResultsRPM(self.environment.getLogDirectory()): >- self.__save() >- self.removeLogFiles() >- print "done." >- return True >- # otherwise >- print "Error: failed to generate results rpm" >- return False >- #otherwise >- print "Error: no test results to submit" >- return False >- >+ >+ if not self.certification or self.certification.getNumberOfTestRuns() == 0: >+ print "Error: no test results to submit" >+ return False >+ >+ if self.catalog.isReachable() and self.options.mode != Constants.auto: >+ (submitted, success) = self.catalog.submit(self.certification) >+ if success and submitted and self.ui.promptConfirm("Would you like to clean current test results from this system?"): >+ self.removeLogFiles() >+ >+ # otherwise >+ return True >+ > def doSave(self): > self.load() > if self.certification and self.certification.getNumberOfTestRuns() > 0: >diff --git a/hwcert/report.py b/hwcert/report.py >index c944094..f82dd1c 100644 >--- a/hwcert/report.py >+++ b/hwcert/report.py >@@ -187,272 +187,3 @@ class Report(Controller): > if udi.startswith(prefix): > udi = udi[len(prefix):] > return udi >- >- >- def WriteResultsRPM(self, logDirectory): >- self.logDirectory = logDirectory >- varLogHwCertDirectory = "/var/log/hwcert"; >- # build the output directories under /var/log/hwcert/<vendor>-<model>-<os><release>_<arch>_results >- submissionDirectory = self.logDirectory + ("/%s_results" % (self.removeBadCharactersInName(self.certification.getName()))) >- if self.Debugging: >- print "writing results to %s" % submissionDirectory >- self.removeDirectory(submissionDirectory) # clean it, if it's there >- self.makeDirectoryPath(submissionDirectory) >- >- # write the test plan and results xml to etc/hwcert >- etcDirectory = submissionDirectory + "/etc/hwcert" >- self.makeDirectoryPath(etcDirectory) >- resultsXML = ResultsDocument() >- resultsXML.load(os.path.join(self.options.data, self.environment.getResultsFileName())) >- resultsXML.compressToFile(os.path.join(etcDirectory, self.environment.getResultsFileName())) >- shutil.copy("/etc/hwcert.xml", os.path.join(etcDirectory, "hwcert.xml")) # save hwcert environment settings >- >- >- >- #write a system.conf for backwards compatability >- self.generateRHR2systemConf(etcDirectory) >- >- >- # write the test output to var/log/rhr >- testsByName = self.certification.getTestsGroupedByName() >- for n in range(self.certification.getNumberOfTestRuns()): >- runNumber = n+1 >- self.writeTestRun(runNumber, runNumber, testsByName, submissionDirectory, varLogHwCertDirectory) >- >- # write additional test runs for subtests >- subTestsByNameAndParent = self.certification.getSubTestsGroupedByNameAndParent() >- if self.Debugging != Constants.off: >- print "Found %u sub-certifications" % len(subTestsByNameAndParent) >- # subTestsByNameAndParent[name][test run number] >- directoryRunNumber = runNumber+1 >- for subTestsByName in subTestsByNameAndParent: >- # currently, there can only be one run of subtests, as with FV, hwcert clean is called each fv_* test run >- self.writeTestRun(1, directoryRunNumber, subTestsByName, submissionDirectory, varLogHwCertDirectory) >- directoryRunNumber = directoryRunNumber +1 >- >- # package the directories as an rpm >- try: >- self.generateResultsRPMSpec(submissionDirectory) >- tar = Command("tar -jcvf %s -C %s . >> /var/hwcert/package.log 2>&1" % (self.tarFileName, submissionDirectory)) >- Command("echo \"\n%s\n----------------------------\" > /var/hwcert/package.log" % tar.command).run() >- tar.run() >- print "building results rpm..." >- rpmBuild = Command("rpmbuild -tb %s >> /var/hwcert/package.log 2>&1" % (self.tarFileName)) >- Command("echo \"\n%s\n----------------------------\" >> /var/hwcert/package.log" % rpmBuild.command).run() >- rpmBuild.run() >- >- >- rpm = Command("cat /var/hwcert/package.log").getString(regex="Wrote: (?P<rpm>[^\ ]+)$", regexGroup="rpm", singleLine=False) >- print "Moving the results rpm to %s" % os.path.join(self.options.data, os.path.basename(rpm.strip())) >- Command("mv %s %s" % (rpm.strip(), self.options.data)).echo() >- except HwCertCommandException, exception: >- print exception >- return False >- # otherwise >- >- # submit the results rpm >- return True >- >- def writeTestRun(self, runNumber, directoryRunNumber, testsByName, submissionDirectory, varLogHwCertDirectory): >- # write the test logs to [...]/var/log/rhr/runs/<directoryRunNumber-1>/<testname> >- # and [...]/var/log/rhr/tests/<testname>/<directoryRunNumber-1> >- runDirectory = "%s%s/runs/%u" % (submissionDirectory, varLogHwCertDirectory, directoryRunNumber-1) >- self.removeDirectory(runDirectory) >- self.makeDirectoryPath(runDirectory) >- >- for testName in testsByName.keys(): >- if self.Debugging != Constants.off: >- print "testName = " + testName >- test = testsByName[testName][0] >- # YK: need upper case test name , to be compatible with HwCert Catalog >- byRunDirectory = runDirectory + ("/%s" % test.getName().upper()) >- testDirectory = "%s%s/tests/%s" % (submissionDirectory, varLogHwCertDirectory, test.getName().upper()) >- if directoryRunNumber == 1: self.removeDirectory(testDirectory) >- byTestDirectory = testDirectory + ("/%u" % (directoryRunNumber-1)) >- self.WriteLogForRPM(testsByName[testName], runNumber, byTestDirectory) >- # link to byTestDirectory from byRunDirectory >- if os.path.exists(byTestDirectory): >- relativePathToTestDirectory = "../../tests/%s/%u" % (test.getName().upper(), directoryRunNumber-1) >- try: >- os.remove(byRunDirectory) >- except OSError: >- pass >- os.system("ln -s %s %s " % (relativePathToTestDirectory, byRunDirectory)) >- if self.Debugging != Constants.off: >- print "Linking to %s from %s" % (relativePathToTestDirectory, byRunDirectory) >- >- def WriteLogForRPM(self, testsByName, runNumber, dir): >- if self.Debugging != Constants.off: >- print "Writing logs to %s --------------------------" % dir >- self.removeDirectory(dir) >- deviceNumber = 0 >- combinedTestPass = True >- for test in testsByName: >- if not test.wasRun(runNumber): >- continue >- >- # otherwise >- if self.Debugging != Constants.off: >- print "Writing results for test: %s udi: %s run: %u" % (test.getName(), test.getUDI(), runNumber) >- run = test.getRun(runNumber) >- if not run.passed(): >- combinedTestPass = False >- >- if len(testsByName) > 1: >- deviceNumber = deviceNumber + 1 >- self.makeDirectoryPath(dir) >- outputLog = run.getTestOutput() >- if outputLog: >- log = codecs.open(dir + "/output.log", "a", "utf-8" ) >- log.write(outputLog) >- if run.passed(): >- log.write(Constants.PASS+"\n") >- else: >- log.write(Constants.FAIL+"\n") >- log.close() >- systemLog = run.getSystemLog() >- if systemLog: >- log = codecs.open(dir + "/system.log", "a", "utf-8" ) >- log.write(systemLog) >- log.close() >- >- self.generateHardwareLog(run, dir) >- self.copyAttachmentsToRPM(test, run, runNumber, deviceNumber, dir) >- >- #add a new MD5 sum >- self.generateMD5Sum(dir, combinedTestPass) >- >- def generateHardwareLog(self, run, directory): >- hardwareOutPath = "%s/hardware.log" % directory >- if os.path.exists(hardwareOutPath): >- if self.Debugging != Constants.off: >- print "%s exists - not generating hardware.log" >- return >- hardwareOutFile = codecs.open(hardwareOutPath, "w", "utf-8") >- devices = run.getDevices() >- for device in devices: >- if device: >- device.write(hardwareOutFile) >- elif self.Debugging != Constants.off: >- print "Warning: run has bad device data" >- hardwareOutFile.close() >- >- >- def generateResultsRPMSpec(self, submissionDirectory): >- vendor = self.certification.getHardware(Tags.vendor) >- make = self.certification.getHardware(Tags.make) >- model = self.certification.getHardware(Tags.model) >- # YK: get the osname,osrelease,arch as well >- # and replace the white space " " with "_" in osname >- osname = self.certification.getOS(Tags.name) >- osname = osname.replace(" ", "_") >- osrelease = self.certification.getOS(Tags.release) >- arch = self.certification.getHardware(Tags.arch) >- # commment out now >- # hwcertRelease = self.certification.getHwCertVersion() >- prefix = "/var/log/hwcert" >- packageName = "hwcert-%s-%s" % (vendor, model) >- packageName = packageName.replace(" ", "_") >- packageName = self.removeBadCharactersInName(packageName) >- >- # use run time as the rpm release, preventing name collisions >- runTime = self.certification.getRunTime() >- if runTime: >- rpmRelease = self.certification.timeStringToTimestamp(runTime) >- else: >- print "Warning: could not determine certification run time" >- rpmRelease = "0" >- tmpPath = "/tmp" >- >- >- specFile = open("%s/%s" % (submissionDirectory, self.specFileName), "w") >- specFile.writelines([ >- "Summary: Red Hat hardware certification test results.\n", >- "Name: %s\n" % packageName, >- "Version: %s_%s_results\n" % (osname, arch), >- "Release: %s\n" % rpmRelease, >- "License: GPL\n", >- "Vendor: %s\n" % vendor, >- "Group: Applications/System\n", >- "Source: %s\n" % self.tarFileName, >- "BuildRoot: %_tmppath/%name-%version-buildroot\n", >- "BuildArch: noarch\n", >- "Prefix: %s\n" % prefix, >- "\n", >- "%%description\n", >- "Red Hat Ready hardware certification test results. Specific results for\n", >- "%s %s %s.\n" % (vendor, make, model), >- "\n", >- "%global _binaries_in_noarch_packages_terminate_build 0\n", >- "%prep\n", >- "%setup -c rhr-results\n", >- "%build\n", >- "%install\n", >- "rm -rf $RPM_BUILD_ROOT\n", >- "mkdir -p $RPM_BUILD_ROOT/%{prefix}/%{name}-%{version}\n", >- "cp -a * $RPM_BUILD_ROOT/%{prefix}/%{name}-%{version}\n", >- "\n", >- "%clean\n", >- "rm -rf $RPM_BUILD_ROOT\n", >- "\n", >- "%files\n", >- "%defattr(-,root,root)\n", >- "%{prefix}/%{name}-%{version}\n", >- "\n", >- "%changelog\n", >- "* Tue Sep 12 2006 Greg Nichols <gnichols@redhat.com>\n", >- "- initial spec file based on rhr2 version\n", >- ]) >- >- def generateRHR2systemConf(self, directory): >- systemConfFile = open("%s/system.conf" % directory, "w") >- systemConfFile.writelines([ >- "# RHR system.conf file\n", >- "# Generated by hwcert for backwards compatability\n", >- "VENDOR=\"%s\"\n" % self.certification.getHardware(Tags.vendor), >- "MAKE=\"%s\"\n" % self.certification.getHardware(Tags.make), >- "MODEL=\"%s\"\n" % self.certification.getHardware(Tags.model), >- "CERTTYPE=\"%s\"\n" % "server", >- "RHRRELEASE=\"%s\"\n" % self.certification.getHardware(Tags.model) >- ]) >- systemConfFile.close() >- >- >- def copyAttachmentsToRPM(self, test, run, runNumber, deviceNumber, dir): >- if self.Debugging != Constants.off: >- print "copying attachments..." >- >- destinationDir = dir >- if deviceNumber > 0: >- destinationDir = "%s/device-%u" % (dir, deviceNumber) >- self.makeDirectoryPath(destinationDir) >- run.setDebugging(self.Debugging) >- run.writeAttachments(destinationDir) >- >- >- >- def generateMD5Sum(self, dir, combinedTestPass): >- if self.Debugging != Constants.off: >- print "combining test results md5 sum" >- try: >- log = open(dir + "/output.log", "a+") >- contents = "" >- returnValue = 1 >- if combinedTestPass: >- returnValue = 0 >- for line in log: >- contents += line >- m=hashModule.md5() >- m.update(contents) >- sum=int(m.hexdigest(),16) >- # YK: write the decimal format result to output.log, not hex >- log.write(("%u\n" % (sum - returnValue)).upper()) >- #log.write(("%x\n" % (sum - returnValue)).upper()) >- except IOError: >- pass >- >- >- >- >- >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 919499
: 710029