[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible debian: notes: flake8-fy

Mattia Rizzolo gitlab at salsa.debian.org
Mon Dec 17 19:31:09 GMT 2018


Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
7edea4d5 by Mattia Rizzolo at 2018-12-17T19:30:07Z
reproducible debian: notes: flake8-fy

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
0faa4aaf by Mattia Rizzolo at 2018-12-17T19:30:15Z
reproducible debian: notes: only store notes for debian packages

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- bin/reproducible_notes.py


Changes:

=====================================
bin/reproducible_notes.py
=====================================
@@ -13,7 +13,6 @@ import os
 import yaml
 import json
 import apt_pkg
-apt_pkg.init_system()
 from sqlalchemy import sql
 
 from rblib import db_table, query_db
@@ -21,6 +20,7 @@ from rblib.confparse import log
 from rblib.const import conn_db
 from rblib.utils import print_critical_message, irc_msg
 
+apt_pkg.init_system()
 
 NOTES = 'packages.yml'
 ISSUES = 'issues.yml'
@@ -48,21 +48,26 @@ def load_notes():
         except AssertionError:
             print_critical_message(pkg + ' does not include a version')
             irc_msg('The note for ' + pkg + ' does not include a version.')
+        # We are only dealing with notes targetting debian, so hardcode it here
+        # for now.  Need to be rethought as a whole when multi-distro notes comes
         query = """SELECT s.id, s.version, s.suite
-                FROM results AS r JOIN sources AS s ON r.package_id=s.id
-                WHERE s.name='{pkg}' AND r.status != ''"""
-                # AND s.architecture='amd64'"""
+                FROM results AS r
+                JOIN sources AS s ON r.package_id=s.id
+                JOIN distributions AS d on d.id=s.distribution
+                WHERE d.name = 'debian'
+                AND s.name='{pkg}' AND r.status != ''"""
         query = query.format(pkg=pkg)
         result = query_db(query)
         if not result:
-            log.info('Warning: This query produces no results: ' + query
-                                   + '\nThis means there is no tested ' +
-                                   'package with the name ' + pkg)
+            log.info('Warning: This query produces no results: %s'
+                     '\nThis means there is no tested package with the name %s',
+                     query, pkg)
             try:
                 irc_msg("There is problem with the note for {} (it may "
-                    "have been removed from the archive). Please check {} and {}".
-                    format(pkg, os.environ['BUILD_URL'],
-                           "https://tracker.debian.org/pkg/" + pkg))
+                        "have been removed from the archive). "
+                        "Please check {} and {}".format(
+                            pkg, os.environ['BUILD_URL'],
+                            "https://tracker.debian.org/pkg/" + pkg))
             except KeyError:
                 log.error('There is a problem with the note for %s - please '
                           'check.', pkg)
@@ -73,7 +78,7 @@ def load_notes():
 # https://image-store.slidesharecdn.com/c2c44a06-5e28-4296-8d87-419529750f6b-original.jpeg
                 try:
                     if apt_pkg.version_compare(str(original[pkg]['version']),
-                                       str(suite[1])) > 0:
+                                               str(suite[1])) > 0:
                         continue
                 except KeyError:
                     pass
@@ -146,7 +151,7 @@ def store_issues():
     if existing_issues:
         to_delete = [{'issuename': name} for name in existing_issues]
         delete_query = issues_table.delete().\
-                  where(issues_table.c.name == sql.bindparam('issuename'))
+            where(issues_table.c.name == sql.bindparam('issuename'))
         conn_db.execute(delete_query, to_delete)
         log.info("Removed the following issues: " + str(existing_issues))
 



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/6a6adf9cfc81ef30f99596da8018b34c09e233ad...0faa4aafd44b46686a846a5b811fc8c088cda7fe

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/6a6adf9cfc81ef30f99596da8018b34c09e233ad...0faa4aafd44b46686a846a5b811fc8c088cda7fe
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20181217/becc03fa/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list