[Reproducible-commits] [blog] 01/01: More work on getting a good blog draft template
Chris Lamb
chris at chris-lamb.co.uk
Sun Jul 31 21:32:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository blog.
commit 5ff81fa5e74b969efb44272cf42901d3a66a373f
Author: Chris Lamb <lamby at debian.org>
Date: Sun Jul 31 17:32:20 2016 -0400
More work on getting a good blog draft template
---
bin/generate-draft | 125 +++++++++++++++++++++++++++++++++-----------
bin/generate-draft.template | 55 +++++++++----------
2 files changed, 123 insertions(+), 57 deletions(-)
diff --git a/bin/generate-draft b/bin/generate-draft
index dfcbb72..48eebc1 100755
--- a/bin/generate-draft
+++ b/bin/generate-draft
@@ -13,6 +13,13 @@ import debianbts
import subprocess
import collections
+PROJECTS = (
+ 'diffoscope',
+ 'strip-nondeterminism',
+ 'disorderfs',
+ 'reprotest',
+)
+
def main(*args):
week = int(args[0])
@@ -43,21 +50,26 @@ def get_data(week, max_age=3600):
pass
log("Getting new data")
+
week_start = datetime.date(2015, 4, 19) + datetime.timedelta(days=week * 7)
week_end = week_start + datetime.timedelta(days=6)
- data = {
- 'week': week,
- 'week_start': week_start,
- 'week_end': week_end,
- }
-
- for k, v in (
+ data = {x: y(week_start, week_end) for x, y in (
('author', get_author),
+ ('commits', get_commits),
('uploads', get_uploads),
+ ('patches', get_patches),
('ftbfs_bugs', get_ftbfs_bugs),
- ):
- data[k] = v(week_start, week_end)
+ ('issues_yml', get_issues_yml),
+ ('packages_yml', get_packages_yml),
+ )}
+
+ data.update({
+ 'week': week,
+ 'week_start': week_start,
+ 'week_end': week_end,
+ 'projects': PROJECTS,
+ })
log("Saving cache to {}", filename)
@@ -70,15 +82,34 @@ def get_author(week_start, week_end):
return os.environ.get('DEBFULLNAME', 'FIXME')
def get_ftbfs_bugs(week_start, week_end):
- log("Querying UDD for FTBFS bugs")
+ return bugs(
+ week_start,
+ week_end,
+ "bugs_usertags.tag = '{}'".format('ftbfs'),
+ )
- data = udd("""
+def get_patches(week_start, week_end):
+ return bugs(
+ week_start,
+ week_end,
+ "id IN (SELECT id FROM bugs_tags WHERE tag = 'patch')",
+ )
+
+def bugs(week_start, week_end, extra="true"):
+ log("Querying UDD for usertagged bugs with filter: {}", extra)
+
+ fields = (
+ 'id',
+ 'source',
+ 'submitter',
+ 'submitter_name',
+ 'title',
+ 'arrival',
+ )
+
+ sql = """
SELECT
- id,
- source,
- submitter,
- title,
- arrival
+ {fields}
FROM
bugs
INNER JOIN
@@ -86,17 +117,19 @@ def get_ftbfs_bugs(week_start, week_end):
WHERE
bugs_usertags.email = 'reproducible-builds at lists.alioth.debian.org'
AND
- bugs_usertags.tag = 'ftbfs'
+ {extra}
AND
- arrival BETWEEN '{week_start}' AND '{week_end}'
+ CAST(arrival AS DATE) BETWEEN '{week_start}' AND '{week_end}'
""".format(**{
+ 'fields': ', '.join(fields),
+ 'extra': extra,
'week_start': week_start.strftime('%F'),
'week_end': week_end.strftime('%F'),
- }), ('id', 'source', 'submitter', 'subject', 'arrival'))
+ })
result = {}
- for x in data:
- result.setdefault(x['submitter'], []).append(x)
+ for x in udd(sql, fields):
+ result.setdefault(x['submitter_name'], []).append(x)
return result
@@ -110,13 +143,6 @@ def get_uploads(week_start, week_end):
'signed_by_name',
)
- sources = (
- 'strip-nondeterminism',
- 'diffoscope',
- 'disorderfs',
- 'reprotest',
- )
-
data = udd("""
SELECT
{fields}
@@ -125,12 +151,12 @@ def get_uploads(week_start, week_end):
WHERE
source IN ({sources})
AND
- date BETWEEN '{week_start}' AND '{week_end}'
+ CAST(date AS date) BETWEEN '{week_start}' AND '{week_end}'
ORDER BY
date
""".format(**{
'fields': ', '.join(fields),
- 'sources': ', '.join("'{}'".format(x) for x in sources),
+ 'sources': ', '.join("'{}'".format(x) for x in PROJECTS),
'week_start': week_start.strftime('%F'),
'week_end': week_end.strftime('%F'),
}), fields)
@@ -160,7 +186,46 @@ def udd(query, fields):
return data
+def get_commits(week_start, week_end):
+ return {x: commits(week_start, week_end, x) for x in PROJECTS}
+
+def get_issues_yml(week_start, week_end):
+ return commits(week_start, week_end, 'notes', 'issues.yml')
+def get_packages_yml(week_start, week_end):
+ return commits(week_start, week_end, 'notes', 'packages.yml')
+
+def commits(week_start, week_end, project, path='.'):
+ # Assume its in the parent dir
+ git_dir = os.path.join(
+ os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
+ project,
+ '.git',
+ )
+
+ output = subprocess.check_output((
+ 'git',
+ 'log',
+ 'origin/master',
+ '--since', week_start.strftime('%F'),
+ '--until', week_end.strftime('%F'),
+ '--pretty=format:%an\t%h\t%s',
+ '--',
+ path,
+ ), env={
+ 'GIT_DIR': git_dir,
+ }).decode('utf-8')
+
+ result = collections.defaultdict(list)
+ for x in output.splitlines():
+ author, sha, title = x.split('\t', 2)
+
+ result[author].append({
+ 'sha': sha,
+ 'title': title,
+ })
+
+ return result
if __name__ == '__main__':
sys.exit(main(*sys.argv[1:]))
diff --git a/bin/generate-draft.template b/bin/generate-draft.template
index 393cb5c..a5f58a9 100644
--- a/bin/generate-draft.template
+++ b/bin/generate-draft.template
@@ -1,22 +1,22 @@
[[!meta title="Reproducible builds: week {{ week }} in Stretch cycle"]]
What happened in the [Reproducible
-Builds](https://wiki.debian.org/ReproducibleBuilds) effort between {{ week_start.strftime('%B') }} {{ week_start.day }} and {{ week_end.strftime('%B') }} {{ week_start.day }} {{ week_end.year }}:
+Builds](https://wiki.debian.org/ReproducibleBuilds) effort between Sunday {{ week_start.strftime('%B') }} {{ week_start.day }} and Saturday {{ week_end.strftime('%B') }} {{ week_end.day }} {{ week_end.year }}:
Media coverage
--------------
+FIXME
+
GSoC and Outreachy updates
--------------------------
+FIXME
+
Documentation update
--------------------
-Toolchain fixes
----------------
-
-Other upstream fixes
---------------------
+FIXME
Reproducible work in other projects
-----------------------------------
@@ -26,26 +26,23 @@ FIXME
Packages reviewed and fixed, and bugs filed
-------------------------------------------
-
-Packages fixed
---------------
-
-The following XXX packages have become reproducible due to changes in their
-build dependencies:
-
-The following packages have become reproducible after being fixed:
-
-Some uploads have fixed some reproducibility issues, but not all of them:
-
-Patches submitted that have not made their way to the archive yet:
+Patches have been submitted by:
+{% for x, ys in patches.items()|sort %}
+- {{ x }}:{% for y in ys %}
+ - [{{ y['title'] }}](https://bugs.debian.org/{{ y['id'] }}){% endfor %}
+{% endfor %}
Package reviews
---------------
-XXX reviews have been added, XXX have been updated and XXX have been removed in this week,
+FIXME reviews have been added, FIXME have been updated and FIXME have been removed in this week,
adding to our knowledge about [identified issues](https://tests.reproducible-builds.org/debian/index_issues.html).
+{% for _, xs in packages_yml.items()|sort %}{% for x in xs %}
+- [{{ x['title'] }}](https://anonscm.debian.org/git/notes.git/commit/?id={{ x['sha'] }}){% endfor %}{% endfor %}
-XXX new issue types have been found:
+Issue types have been updated:
+{% for _, xs in issues_yml.items()|sort %}{% for x in xs %}
+- [{{ x['title'] }}](https://anonscm.debian.org/git/notes.git/commit/?id={{ x['sha'] }}){% endfor %}{% endfor %}
Weekly QA work
--------------
@@ -54,17 +51,21 @@ FTBFS bugs have been reported by:
{% for k, v in ftbfs_bugs.items()|sort %}
- {{ k }} ({{ v|length }}){% endfor %}
-{% for k, v in uploads.items()|sort %}
-{{ k }} development
-----------------------
-{% for x in v %}
-- {{ k }} {{ x['version'] }} was uploaded to {{ x['distribution'] }} by {{ x['signed_by_name'] }}{% endfor %}
-
-FIXME https://sources.debian.net/src/{{ k }}/latest/debian/changelog/
+{% for project in projects %}
+{{ project }} development
+------------{{ "-" * project|length }}
+{% for x in uploads[project] %}
+- {{ project }} {{ x['version'] }} was uploaded to {{ x['distribution'] }} by {{ x['signed_by_name'] }}.{% endfor %}
+{% for x, ys in commits[project].items() %}- {{ x }}:{% for y in ys %}
+ - [{{ y['title'] }}](https://anonscm.debian.org/git/reproducible/{{ project }}.git/commit/?id={{ y['sha'] }}){% endfor %}
+{% endfor %}
{% endfor %}
+
tests.reproducible-builds.org
-----------------------
+FIXME
+
Misc.
-----
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/blog.git
More information about the Reproducible-commits
mailing list