initial commit

This commit is contained in:
Frédéric Péters 2013-08-11 23:17:36 +02:00
commit ccf7b4d331
5 changed files with 209 additions and 0 deletions

38
doceo.modules Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" standalone="no"?>
<moduleset>
<repository type="git" name="git.gnome.org" default="yes"
href="git://git.gnome.org/"/>
<repository type="tarball" name="itstool.org"
href="http://files.itstool.org/itstool/"/>
<autotools id="yelp-tools">
<branch revision="gnome-3-6"/>
<dependencies>
<dep package="libxslt"/>
<dep package="libxml2"/>
<dep package="intltool"/>
<dep package="yelp-xsl"/>
<dep package="itstool"/>
</dependencies>
</autotools>
<autotools id="yelp-xsl">
<branch revision="gnome-3-6"/>
<dependencies>
<dep package="libxslt"/>
<dep package="libxml2"/>
<dep package="intltool"/>
<dep package="itstool"/>
</dependencies>
</autotools>
<autotools id="itstool">
<branch repo="itstool.org"
module="itstool-1.2.0.tar.bz2"
version="1.2.0"
hash="sha256:46fed63fb89c72dbfc03097b4477084ff05ad6f171212d8f1f1546ea543978aa"
size="82479"/>
</autotools>
</moduleset>

19
index_template.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Documentation</title>
<link rel="stylesheet" type="text/css" media="all" href="http://www.entrouvert.com/static/eo/css/eo.css">
<link rel="stylesheet" type="text/css" media="all" href="/skin/eo.css">
</head>
<body>
<h1 id="logo">
<a href="/"><img src="http://www.entrouvert.com/static/eo/img/logo.png" alt="Entr'ouvert"></a> Entr'ouvert Documentation</h1>
<dl class="doc-index">
{% for module in modules|dictsort:"title" %}
<dt><a href="/{{ module.name }}/{{ module.branch }}/">{{ module.title }}</a></dt>
<dd><p>{{ module.description }}</p></dd>
{% endfor %}
</dl>
</body>
</html>

7
jhbuildrc Normal file
View File

@ -0,0 +1,7 @@
import os
prefix = os.path.abspath(os.path.join(os.path.dirname(__file__), 'jhbuild'))
checkoutroot = os.path.join(prefix, 'src')
use_lib64 = False
moduleset = 'doceo.modules'

25
modules.json Normal file
View File

@ -0,0 +1,25 @@
[
{"name": "wcs",
"title": "w.c.s.",
"description": "Web application to design and set up online forms"
},
{"name": "univnautes",
"title": "UnivNautes",
"description": "Captive portal with SAMLv2 authentication"
},
{"name": "polynum",
"title": "Polynum",
"description": "Application de gestion de la reproduction des documents pédagogiques"
},
{"name": "portail-citoyen",
"title": "Portail Citoyen",
"description": "Plate-forme dans laquelle sont agrégées des informations provenant de sources web diverses."
},
{"name": "lasso",
"title": "Lasso",
"description": "C library wich implements SAML 2.0 and Liberty Alliance standards; it defines processes for federated identities, single sign-on and related protocols.",
"type": "tarball",
"url": "https://dev.entrouvert.org/lasso/lasso-2.3.6.tar.gz",
"directory": "lasso-2.3.6/docs/reference/lasso/html"
}
]

120
publish.py Executable file
View File

@ -0,0 +1,120 @@
#! /usr/bin/env python
import json
import os
import subprocess
import tarfile
import urllib2
import urlparse
from django.template import Template, Context
from django.conf import settings
settings.configure()
jhbuildrc = os.path.join(os.getcwd(), 'jhbuildrc')
checkouts_directory = os.path.join(os.getcwd(), 'src')
web_directory = os.path.join(os.getcwd(), 'web')
if not os.path.exists('jhbuild'):
os.system('jhbuild -f jhbuildrc -m doceo.modules buildone itstool yelp-xsl yelp-tools')
if not os.path.exists(checkouts_directory):
os.mkdir(checkouts_directory)
def checkout(module):
checkout_dir = os.path.join(checkouts_directory, module)
kws = {}
kws['stdout'] = subprocess.PIPE
kws['stderr'] = subprocess.STDOUT
if not os.path.exists(checkout_dir):
# full clone
cmd = ['git', 'clone', 'http://repos.entrouvert.org/%s.git' % module]
kws['cwd'] = checkouts_directory
else:
# pull
cmd = ['git', 'pull']
kws['cwd'] = checkout_dir
subprocess.call(cmd, **kws)
def download(url):
filename = os.path.split(urlparse.urlparse(url)[2])[-1]
if not os.path.exists(os.path.join(checkouts_directory, filename)):
fd = file(os.path.join(checkouts_directory, filename), 'w')
fd.write(urllib2.urlopen(url).read())
fd.close()
def publish_mallard(module, branch, directory):
checkout_dir = os.path.join(checkouts_directory, module)
kws = {}
kws['stdout'] = subprocess.PIPE
kws['stderr'] = subprocess.STDOUT
cmd = ['git', 'checkout', branch]
subprocess.call(cmd, cwd=checkout_dir, **kws)
help_dir = os.path.join(checkout_dir, 'help', 'fr')
if not os.path.exists(help_dir):
return
output_dir = os.path.join(web_directory, module, directory)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
index_html = os.path.join(output_dir, 'index.html')
if os.path.islink(index_html):
os.unlink(index_html)
cmd = ['jhbuild', '-f', jhbuildrc, 'run', 'yelp-build', 'html', '-o', output_dir]
cmd.extend([os.path.join(help_dir, x) for x in os.listdir(help_dir) if x.endswith('.page')])
subprocess.call(cmd, **kws)
if not os.path.exists(index_html):
html_files = [x for x in os.listdir(output_dir) if x.endswith('.html')]
if html_files:
os.symlink(html_files[0], index_html)
def publish_tarball(module):
output_dir = os.path.join(web_directory, module.get('name'), 'stable')
url = module.get('url')
directory = module.get('directory')
filename = os.path.split(urlparse.urlparse(url)[2])[-1]
tar = tarfile.open(os.path.join(checkouts_directory, filename), 'r')
for tarinfo in tar:
if not tarinfo.name.startswith(directory):
continue
output_filename = os.path.join(output_dir, tarinfo.name[len(directory):].strip('/'))
if tarinfo.isdir():
if not os.path.exists(output_filename):
os.makedirs(output_filename)
else:
fd = tar.extractfile(tarinfo)
file(output_filename, 'w').write(fd.read())
def create_index(modules):
index_html = os.path.join(web_directory, 'index.html')
t = Template(unicode(file('index_template.html').read(), 'utf-8'))
c = Context({'modules': modules})
fd = file(index_html, 'w')
fd.write(t.render(c).encode('utf-8'))
fd.close()
modules = json.load(file('modules.json'))
for module in modules:
if module.get('type') == 'tarball':
download(module.get('url'))
else:
checkout(module.get('name'))
if module.get('directory'):
module['branch'] = 'stable'
publish_tarball(module)
else:
module['branch'] = 'dev'
publish_mallard(module.get('name'), 'master', 'dev')
create_index(modules)