This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 3.x development tree".
The branch, master has been updated
via fff4b24f4f5c64511559a0d71fa709ce81ecee39 (commit)
via b8d83f4159d72419104b270b82c9fd3e0b7e9fdd (commit)
via 4be1f1154da036b9f4f443ceb11cdad6b10fb3cd (commit)
via e9a48cc7081a4d8183935f95163d5d2d97debce8 (commit)
from b15f209f2c10203c1891d3e9c577efb7eb71149d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fff4b24f4f5c64511559a0d71fa709ce81ecee39
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Apr 22 19:55:50 2010 +0200
naoki: Implemented ./make.sh batch cron.
This will randomly build packages and report
errors.
commit b8d83f4159d72419104b270b82c9fd3e0b7e9fdd
Merge: 4be1f1154da036b9f4f443ceb11cdad6b10fb3cd b15f209f2c10203c1891d3e9c577efb7eb71149d
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Apr 22 19:13:58 2010 +0200
Merge branch 'master' of ssh://ms@git.ipfire.org/pub/git/ipfire-3.x
commit 4be1f1154da036b9f4f443ceb11cdad6b10fb3cd
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Apr 22 19:12:14 2010 +0200
naoki: Naoki will be able to send mails on errors.
You need to configure:
[smtp]
server = 1.2.3.4
user = me # Optional login user
password = *** # Password that belongs to user
[error_report]
recipient = <user>@ipfire.org
commit e9a48cc7081a4d8183935f95163d5d2d97debce8
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Apr 22 19:11:52 2010 +0200
perl-xml-parser: Fix rpath whitelist.
-----------------------------------------------------------------------
Summary of changes:
naoki/__init__.py | 38 ++++++++++++
naoki/backend.py | 82 ++++++++++++++++++++++++++
naoki/chroot.py | 3 +
naoki/constants.py | 13 ++++
pkgs/core/perl-xml-parser/perl-xml-parser.nm | 3 +-
5 files changed, 137 insertions(+), 2 deletions(-)
Difference in files:
diff --git a/naoki/__init__.py b/naoki/__init__.py
index a3c4a9a..239d8f5 100644
--- a/naoki/__init__.py
+++ b/naoki/__init__.py
@@ -2,6 +2,7 @@
import ConfigParser
import os.path
+import random
import sys
import time
@@ -42,6 +43,7 @@ class Naoki(object):
"shell" : self.call_shell,
"repository" : self.call_repository,
"generate" : self.call_generate,
+ "batch" : self.call_batch,
}
return actionmap[args.action.name](args.action)
@@ -319,3 +321,39 @@ Release : %(release)s
gen = chroot.Generator(self, arches.current, args.type)
return gen.run()
+
+ def call_batch(self, args):
+ actionmap = {
+ "cron" : self.call_batch_cron,
+ }
+
+ return actionmap[args.action.name](args.action)
+
+ def call_batch_cron(self, args):
+ packages = []
+ packages_must = []
+ packages_may = []
+ for package in backend.parse_package_info(backend.get_package_names()):
+ if not package.built and package.buildable:
+ packages_must.append(package)
+ continue
+
+ if package.buildable:
+ packages_may.append(package)
+
+ packages += packages_must
+
+ while len(packages) < 10 and packages_may:
+ package = random.choice(packages_may)
+ packages_may.remove(package)
+ packages.append(package)
+
+ random.shuffle(packages)
+
+ # Bad hack because we lack a _build method
+ args.packages = [p.name for p in packages]
+ args.onlydeps = False
+ args.withdeps = False
+ args.shell = False
+
+ self.call_build(args)
diff --git a/naoki/backend.py b/naoki/backend.py
index 4005f1e..9129cc3 100644
--- a/naoki/backend.py
+++ b/naoki/backend.py
@@ -1,7 +1,10 @@
#!/usr/bin/python
+import email.mime.multipart
+import email.mime.text
import os
import shutil
+import smtplib
import urlgrabber
import urlgrabber.progress
import urllib
@@ -259,6 +262,7 @@ class PackageInfo(object):
"fingerprint" : self.fingerprint,
"files" : self.package_files,
"group" : self.group,
+ "id" : self.id,
"license" : self.license,
"maintainer" : self.maintainer,
"name" : self.name,
@@ -553,3 +557,81 @@ class BinaryRepository(object):
@property
def path(self):
return os.path.join(REPOSDIR, self.name, self.arch["name"])
+
+def report_error_by_mail(package):
+ log = package.naoki.log
+
+ # Do not send a report if no recipient is configured
+ if not config["error_report_recipient"]:
+ return
+
+ try:
+ connection = smtplib.SMTP(config["smtp_server"])
+ #connection.set_debuglevel(1)
+
+ if config["smtp_user"] and config["smtp_password"]:
+ connection.login(config["smtp_user"], config["smtp_password"])
+
+ except SMTPConnectError, e:
+ log.error("Could not establish a connection to the smtp server: %s" % e)
+ return
+ except SMTPAuthenticationError, e:
+ log.error("Could not successfully login to the smtp server: %s" % e)
+ return
+
+ msg = email.mime.multipart.MIMEMultipart()
+ msg["From"] = config["error_report_sender"]
+ msg["To"] = config["error_report_recipient"]
+ msg["Subject"] = config["error_report_subject"] % package.all
+ msg.preamble = 'You will not see this in a MIME-aware mail reader.\n'
+
+ body = """\
+The package %(name)s had a difficulty to build itself.
+This email will give you a short report about the error.
+
+Package information:
+ Name : %(name)s - %(summary)s
+ Version : %(version)s
+ Release : %(release)s
+
+ This package in maintained by %(maintainer)s.
+
+
+A detailed logfile is attached.
+
+Sincerely,
+ Naoki
+ """ % package.all
+
+ msg.attach(email.mime.text.MIMEText(body))
+
+ # Read log and append it to mail
+ logfile = os.path.join(LOGDIR, package.id + ".log")
+ if os.path.exists(logfile):
+ log = []
+ f = open(logfile)
+ line = f.readline()
+ while line:
+ line = line.rstrip("\n")
+ if line.endswith(LOG_MARKER):
+ # Reset log
+ log = []
+
+ log.append(line)
+ line = f.readline()
+
+ f.close()
+
+ log = email.mime.text.MIMEText("\n".join(log), _subtype="plain")
+ log.add_header('Content-Disposition', 'attachment',
+ filename="%s.log" % package.id)
+ msg.attach(log)
+
+ try:
+ connection.sendmail(config["error_report_sender"],
+ config["error_report_recipient"], msg.as_string())
+ except Exception, e:
+ log.error("Could not send error report: %s: %s" % (e.__class__.__name__, e))
+ return
+
+ connection.quit()
diff --git a/naoki/chroot.py b/naoki/chroot.py
index 35c01b0..a1888fd 100644
--- a/naoki/chroot.py
+++ b/naoki/chroot.py
@@ -333,6 +333,8 @@ class PackageEnvironment(Environment):
Environment.__init__(self, naoki=package.naoki, *args, **kwargs)
def build(self):
+ self.log.debug(LOG_MARKER)
+
self.package.download()
# Save start time
@@ -343,6 +345,7 @@ class PackageEnvironment(Environment):
except Error:
if config["cleanup_on_failure"]:
self.clean()
+ backend.report_error_by_mail(self.package)
raise
time_end = time.time()
diff --git a/naoki/constants.py b/naoki/constants.py
index 48238aa..f77b00c 100644
--- a/naoki/constants.py
+++ b/naoki/constants.py
@@ -3,6 +3,7 @@
import ConfigParser
import math
import os
+import socket
BASEDIR = os.getcwd()
@@ -26,6 +27,8 @@ CONFIGFILE = os.path.join(CONFIGDIR, "naoki.conf")
CHROOT_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
+LOG_MARKER = "### LOG MARKER ###"
+
def calc_parallelism():
"""
Calculate how many processes to run
@@ -67,6 +70,16 @@ class Config(object):
# Logging
"log_config_file" : os.path.join(CONFIGDIR, "logging.ini"),
"log_file" : os.path.join(LOGDIR, "naoki.log"),
+ #
+ # Reporting
+ "error_report_recipient" : None,
+ "error_report_sender" : "buildsystem@%s" % socket.gethostname(),
+ "error_report_subject" : "[NAOKI] %(id)s got a build failure",
+ #
+ # SMTP
+ "smtp_server" : None,
+ "smtp_user" : None,
+ "smtp_password" : None,
}
def __init__(self):
diff --git a/pkgs/core/perl-xml-parser/perl-xml-parser.nm b/pkgs/core/perl-xml-parser/perl-xml-parser.nm
index e1b5d20..41dbf40 100644
--- a/pkgs/core/perl-xml-parser/perl-xml-parser.nm
+++ b/pkgs/core/perl-xml-parser/perl-xml-parser.nm
@@ -44,9 +44,8 @@ endef
PKG_TARBALL = $(THISAPP).tar.gz
-# XXX has to be removed
define QUALITY_AGENT_WHITELIST_RPATH
- /usr/lib/perl5/site_perl/*/auto/XML/Parser/Expat/Expat.so
+ /lib
endef
define STAGE_BUILD
hooks/post-receive
--
IPFire 3.x development tree