-
-def run_ldconfig(ctx):
- if (ctx.cmd == 'install'
- and not ctx.env['RAN_LDCONFIG']
- and ctx.env['LIBDIR']
- and not 'DESTDIR' in os.environ
- and not Options.options.destdir):
- try:
- Logs.info("Waf: Running `/sbin/ldconfig %s'" % ctx.env['LIBDIR'])
- subprocess.call(['/sbin/ldconfig', ctx.env['LIBDIR']])
- ctx.env['RAN_LDCONFIG'] = True
- except:
- pass
-
-def write_news(name, in_files, out_file, top_entries=None, extra_entries=None):
- import rdflib
- import textwrap
- from time import strftime, strptime
-
- doap = rdflib.Namespace('http://usefulinc.com/ns/doap#')
- dcs = rdflib.Namespace('http://ontologi.es/doap-changeset#')
- rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#')
- foaf = rdflib.Namespace('http://xmlns.com/foaf/0.1/')
- rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
- m = rdflib.ConjunctiveGraph()
-
- try:
- for i in in_files:
- m.parse(i, format='n3')
- except:
- Logs.warn('Error parsing data, unable to generate NEWS')
- return
-
- proj = m.value(None, rdf.type, doap.Project)
- for f in m.triples([proj, rdfs.seeAlso, None]):
- if f[2].endswith('.ttl'):
- m.parse(f[2], format='n3')
-
- entries = {}
- for r in m.triples([proj, doap.release, None]):
- release = r[2]
- revision = m.value(release, doap.revision, None)
- date = m.value(release, doap.created, None)
- blamee = m.value(release, dcs.blame, None)
- changeset = m.value(release, dcs.changeset, None)
- dist = m.value(release, doap['file-release'], None)
-
- if revision and date and blamee and changeset:
- entry = '%s (%s) stable;\n' % (name, revision)
-
- for i in m.triples([changeset, dcs.item, None]):
- item = textwrap.wrap(m.value(i[2], rdfs.label, None), width=79)
- entry += '\n * ' + '\n '.join(item)
- if dist and top_entries is not None:
- if not str(dist) in top_entries:
- top_entries[str(dist)] = []
- top_entries[str(dist)] += [
- '%s: %s' % (name, '\n '.join(item))]
-
- if extra_entries:
- for i in extra_entries[str(dist)]:
- entry += '\n * ' + i
-
- entry += '\n\n --'
-
- blamee_name = m.value(blamee, foaf.name, None)
- blamee_mbox = m.value(blamee, foaf.mbox, None)
- if blamee_name and blamee_mbox:
- entry += ' %s <%s>' % (blamee_name,
- blamee_mbox.replace('mailto:', ''))
-
- entry += ' %s\n\n' % (
- strftime('%a, %d %b %Y %H:%M:%S +0000', strptime(date, '%Y-%m-%d')))
-
- entries[revision] = entry
- else:
- Logs.warn('Ignored incomplete %s release description' % name)
-
- if len(entries) > 0:
- news = open(out_file, 'w')
- for e in sorted(entries.keys(), reverse=True):
- news.write(entries[e])
- news.close()