diff options
author | Cliff Brake <cbrake@bec-systems.com> | 2012-08-16 11:02:23 -0400 |
---|---|---|
committer | Cliff Brake <cbrake@bec-systems.com> | 2012-08-16 11:02:23 -0400 |
commit | c11f922b0bfa023a4cf49f26e55aec6a1413344b (patch) | |
tree | 79daf7b525928b8863be0201e552c54123fe58f9 | |
parent | 6560aace7f44e84690380d024e2b43e46a772c18 (diff) | |
download | openembedded-admin-c11f922b0bfa023a4cf49f26e55aec6a1413344b.tar.gz |
update weekly changelog tools
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .gitmodules | 27 | ||||
m--------- | meta-angstrom | 0 | ||||
m--------- | meta-browser | 0 | ||||
m--------- | meta-kde | 0 | ||||
m--------- | meta-mono | 0 | ||||
m--------- | meta-raspberrypi | 0 | ||||
m--------- | meta-ti | 0 | ||||
m--------- | openembedded-core | 0 | ||||
-rw-r--r-- | tools/config-sample.js | 16 | ||||
-rw-r--r-- | tools/dateutil.js | 19 | ||||
-rw-r--r-- | tools/git.js | 15 | ||||
-rw-r--r-- | tools/test/dateutil.test.js | 18 | ||||
-rw-r--r-- | tools/test/git.test.js | 4 | ||||
-rw-r--r-- | tools/weekly-changelog.js | 34 |
15 files changed, 98 insertions, 37 deletions
@@ -1,3 +1,5 @@ tools/node_modules tools/tags weekly-changelog +ooe +tools/config.js diff --git a/.gitmodules b/.gitmodules index beec0a4..9cea27c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,15 +7,9 @@ [submodule "meta-openembedded"] path = meta-openembedded url = git://git.openembedded.org/meta-openembedded -[submodule "meta-angstrom"] - path = meta-angstrom - url = git://git.angstrom-distribution.org/meta-angstrom [submodule "meta-yocto"] path = meta-yocto url = git://git.yoctoproject.org/poky -[submodule "meta-texasinstruments"] - path = meta-texasinstruments - url = git://git.angstrom-distribution.org/meta-texasinstruments [submodule "meta-smartphone"] path = meta-smartphone url = http://git.shr-project.org/repo/meta-smartphone.git @@ -70,9 +64,6 @@ [submodule "meta-java"] path = meta-java url = git://github.com/woglinde/meta-java -[submodule "meta-mozilla"] - path = meta-mozilla - url = git://github.com/OSSystems/meta-mozilla [submodule "meta-qt3"] path = meta-qt3 url = git://git.yoctoproject.org/meta-qt3 @@ -82,3 +73,21 @@ [submodule "meta-eldk"] path = meta-eldk url = git://git.denx.de/eldk.git +[submodule "meta-ti"] + path = meta-ti + url = git://git.yoctoproject.org/meta-ti +[submodule "meta-angstrom"] + path = meta-angstrom + url = git://github.com/Angstrom-distribution/meta-angstrom.git +[submodule "meta-browser"] + path = meta-browser + url = git://github.com/OSSystems/meta-browser.git +[submodule "meta-mono"] + path = meta-mono + url = git://git.yoctoproject.org/meta-mono.git +[submodule "meta-raspberrypi"] + path = meta-raspberrypi + url = git://github.com/djwillis/meta-raspberrypi.git +[submodule "meta-kde"] + path = meta-kde + url = git://gitorious.org/openembedded-core-layers/meta-kde.git diff --git a/meta-angstrom b/meta-angstrom -Subproject c25bbe1ab78e5cc4fada32ce87771abe7a2b999 +Subproject e9984c45500c309bb28d8f9ab0386fd4e60f946 diff --git a/meta-browser b/meta-browser new file mode 160000 +Subproject 5d176cb405497e5c5823fa14dbae353a2e1e373 diff --git a/meta-kde b/meta-kde new file mode 160000 +Subproject 1499fa5aea84e79ebd560ed55c979729b2abab3 diff --git a/meta-mono b/meta-mono new file mode 160000 +Subproject adf47f078dbf788a80ff1398a15a4fd5a334d32 diff --git a/meta-raspberrypi b/meta-raspberrypi new file mode 160000 +Subproject 010fee44f3d0c099b7b2f9332fe17d9d139648b diff --git a/meta-ti b/meta-ti new file mode 160000 +Subproject 7b54887b9505bb8334bfbe4094a2c396add8da4 diff --git a/openembedded-core b/openembedded-core -Subproject 2f597ad74d7ed383365dba10e61010e8f82ab6b +Subproject ddc9a58b8553599d2328ac1c4449b41681ae45d diff --git a/tools/config-sample.js b/tools/config-sample.js new file mode 100644 index 0000000..9f0941d --- /dev/null +++ b/tools/config-sample.js @@ -0,0 +1,16 @@ +exports.config = { + email: { + transport: { + type: 'SMTP', + options: { + host: "my-server.com", + auth: { + user: 'smtp-user', + pass: 'password' + } + } + }, + from: 'user@gmail.com' + } +} + diff --git a/tools/dateutil.js b/tools/dateutil.js index bf33b0e..3995e63 100644 --- a/tools/dateutil.js +++ b/tools/dateutil.js @@ -2,12 +2,15 @@ var dateutil = require('./dateutil'); exports.last_week = function() { - // we go from Mon-Mon + // we go from Sun-Sun var day = 1000*60*60*24; - var d = new Date(); + var d = new Date() + d.setUTCHours(0) + d.setUTCMinutes(0) + d.setUTCSeconds(0) var today_weekday = d.getDay(); var ret = {}; - ret['end'] = new Date(d.getTime() - (today_weekday-1)*day); + ret['end'] = new Date(d.getTime() - (today_weekday + 1)*day); ret['start'] = new Date(ret['end'].getTime() - 7*day); return ret; } @@ -17,12 +20,14 @@ exports.last_week_text = function() { var lastwk = dateutil.last_week(); var end_day = lastwk.end; var start_day = lastwk.start; - return dateutil.isoformat(start_day) + ' to ' + dateutil.isoformat(end_day); + return 'since ' + dateutil.isoDate(start_day) + ' until ' + dateutil.isoDate(end_day); } -exports.isoformat = function(d) { - var m = d.getMonth() + 1; - return d.getFullYear() + '-' + (m < 10 ? '0' : '') + m + '-' + d.getDate(); +exports.isoDate = function(d) { +// var m = d.getMonth() + 1; +// return d.getFullYear() + '-' + (m < 10 ? '0' : '') + m + '-' + d.getDate(); + var e = /(.*)T/.exec(d.toISOString()) + return e[1] } diff --git a/tools/git.js b/tools/git.js index 523c7e0..5b2b47d 100644 --- a/tools/git.js +++ b/tools/git.js @@ -1,6 +1,7 @@ var fs = require('fs'), child_process = require('child_process'), - dateutil = require('./dateutil'); + dateutil = require('./dateutil'), + util = require('util') exports.parse_gitmodules = function(filepath, callback) { fs.readFile(filepath, 'utf8', function(err, data) { @@ -14,14 +15,15 @@ exports.parse_gitmodules = function(filepath, callback) { var url = null; var submodules = {} for (var i=0; i < lines.length; i++) { - if (/submodule/(lines[i])) { + console.log("lines[i] = " + lines[i]) + if (/submodule/.exec(lines[i])) { path = null; url = null; } - var re_path = /path = (\S.*)/(lines[i]); + var re_path = /path = (\S.*)/.exec(lines[i]); if (re_path) path = re_path[1]; - var re_url = /url = (\S.*)/(lines[i]); + var re_url = /url = (\S.*)/.exec(lines[i]); if (re_url) { url = re_url[1]; } @@ -37,8 +39,9 @@ exports.parse_gitmodules = function(filepath, callback) { } exports.changelog = function(repo_dir, startdate, enddate, callback) { - var start_iso = dateutil.isoformat(startdate); - var end_iso = dateutil.isoformat(enddate); + var start_iso = dateutil.isoDate(startdate); + var end_iso = dateutil.isoDate(enddate); + console.log("git changelog " + start_iso + " to " + end_iso) child_process.exec('cd ' + repo_dir + "; git shortlog --since=" + start_iso + " --until=" + end_iso + " origin/master | grep -v 'Merge branch' | grep -v 'Merge commit'|sed -e 's/^ //g'|cut -b -78", function(error, stdout, stderr) { if (stderr) diff --git a/tools/test/dateutil.test.js b/tools/test/dateutil.test.js new file mode 100644 index 0000000..8023a8f --- /dev/null +++ b/tools/test/dateutil.test.js @@ -0,0 +1,18 @@ +var dateutil = require('../dateutil'), + util = require('util'), + assert = require('assert') + +exports.test_last_week = function() { + var lastwk = dateutil.last_week() + console.log(util.inspect(lastwk)) + + assert(/Sun.*00:00:00/.exec(lastwk.start.toUTCString()), "lastwk start is not correct " + lastwk.start.toUTCString()) + + assert(/Sun.*00:00:00/.exec(lastwk.end.toUTCString()), "lastwk end is not correct " + lastwk.start.toUTCString()) + +} + +exports.test_last_week_text = function() { + console.log(dateutil.last_week_text()) +} + diff --git a/tools/test/git.test.js b/tools/test/git.test.js index 9fc1ddd..7afdb4f 100644 --- a/tools/test/git.test.js +++ b/tools/test/git.test.js @@ -19,8 +19,8 @@ exports.test_changelog = function() { var repo_dir = path.join(__dirname, 'fixture/openembedded-admin'); var expected = "Cliff Brake (2):\n initial commit of admin repos and tools\n add .gitignore\n\n" child_process.exec('git clone git://git.openembedded.org/openembedded-admin ' + repo_dir, function(error, stdout, stderr) { - var start = new Date('2011-05-19'); - var end = new Date('2011-05-20'); + var start = new Date('2011-05-18'); + var end = new Date('2011-05-19'); git.changelog(repo_dir, start, end, function(err, changelog) { assert.equal(err, null); assert.equal(changelog, expected); diff --git a/tools/weekly-changelog.js b/tools/weekly-changelog.js index 71d1935..71e1625 100644 --- a/tools/weekly-changelog.js +++ b/tools/weekly-changelog.js @@ -1,6 +1,6 @@ // script to collect the weekly changelog in a git repo -var testing = false; +var testing = true; var email_to = ''; var email_bcc = 'cbrake@bec-systems.com,'; @@ -14,7 +14,8 @@ var path = require('path'), fs = require('fs'), nodemailer = require('nodemailer'), git = require('./git'), - dateutil = require('./dateutil'); + dateutil = require('./dateutil'), + config = require('./config').config String.prototype.format = function() { var formatted = this; @@ -45,24 +46,30 @@ var format_report = function(projects, weekly_data) { } var email_report = function(report) { - nodemailer.send_mail( - { - sender: "cliff.brake@gmail.com", - to: email_to, - bcc: email_bcc, - subject: "OE Changelog for " + dateutil.last_week_text(), - body: report - }, - function(error, success) { - console.log("Message " + (success?"sent":"failed")); + console.log("send email ...") + var transport = nodemailer.createTransport(config.email.transport.type, config.email.transport.options) + var mailOptions = { + from: config.email.from, + to: email_to, + bcc: email_bcc, + subject: "OE Changelog " + dateutil.last_week_text(), + text: report + } + + transport.sendMail(mailOptions, function(error, response) { + if (error) { + console.log("Failed to send email: " + response) + } else { + console.log("mail sent: " + response.message) } - ); + }) } var run_changelog = function(projects) { var output = {}; var count = Object.keys(projects).length; var lastwk = dateutil.last_week(); + console.log("start = " + lastwk.start + " end = " + lastwk.end) var project; for (project in projects) { // function required to preserve the value of project @@ -75,6 +82,7 @@ var run_changelog = function(projects) { console.log('changelog error: ' + err); } else { output[project] = changelog; + console.log("changelog finished for " + project) } count--; if (count === 0) { |