[Cdd-commits] r1127 - in cdd/trunk/webtools: . webconf
CDD Subversion Commit
noreply at alioth.debian.org
Mon Oct 6 07:33:25 UTC 2008
Author: tille
Date: Mon Oct 6 07:33:21 2008
New Revision: 1127
Modified:
cdd/trunk/webtools/distasktools.py
cdd/trunk/webtools/tasks.py
cdd/trunk/webtools/webconf/debian-edu.conf
cdd/trunk/webtools/webconf/debian-gis.conf
cdd/trunk/webtools/webconf/debian-junior.conf
cdd/trunk/webtools/webconf/debian-med.conf
cdd/trunk/webtools/webconf/debian-science.conf
Log:
More generic handling of outputdir to enable other scripts using same procedure, better handling of common cache dir to store package files and DDTP files.
Modified: cdd/trunk/webtools/distasktools.py
==============================================================================
--- cdd/trunk/webtools/distasktools.py (original)
+++ cdd/trunk/webtools/distasktools.py Mon Oct 6 07:33:21 2008
@@ -32,7 +32,6 @@
KEYSTOIGNORE = ( 'Architecture', 'Comment', 'Leaf', 'NeedConfig', 'Note', 'Section',
'Needconfig', 'DontAvoid',
'Enhances', 'Test-always-lang', 'Metapackage')
-GLOBALCACHE = "/var/cache/dis/"
# DDTP now exports to official debian mirror
#DDTPURL = "http://ddtp.debian.net/debian/dists/"
DDTPURL = "http://ftp.de.debian.org/debian/dists/"
@@ -46,6 +45,8 @@
HOMEPAGENONE = '#'
+DEFAULTCACHEDIR='/var/lib/gforge/chroot/home/groups/cdd/cache'
+
def ReadConfig(disname=''):
# Try to read config file CONFDIR/<disname>.conf
conffile = CONFDIR + '/' + disname + '.conf'
@@ -68,7 +69,7 @@
'css' : '',
'outputdir' : '',
'datadir' : '',
- 'cachedir' : '/var/lib/gforge/chroot/home/groups/dis/cache',
+ 'cachedir' : DEFAULTCACHEDIR,
'advertising' : None, # headline with advertising string is optional
}
for stanza in deb822.Sources.iter_paragraphs(f, shared_storage=False):
@@ -365,7 +366,7 @@
return
# Make sure that cache directory for DDTP translations exists and is writable
- cachedir = GLOBALCACHE
+ cachedir = self.data['cachedir']
if not os.access(cachedir, os.W_OK):
try:
os.mkdir(cachedir)
@@ -419,6 +420,20 @@
tdeps = self.tasks[task]
tdeps.MarkupPreformatedStrings()
+ def CheckOrCreateOutputDir(self, subdir):
+ outputdir = self.data['outputdir'] + '/' + subdir
+ if not os.access(outputdir, os.W_OK):
+ try:
+ os.mkdir(outputdir)
+ except:
+ # if more than one dir in the tree has to be crated just use mkdir -p ...
+ try:
+ os.system("mkdir -p %s" % outputdir)
+ except:
+ print >>stderr, "Unable to create output dir " + outputdir
+ return None
+ return outputdir
+
class TaskDependencies:
# List of depencencies defined in one Metapackage
@@ -742,8 +757,7 @@
# has non zero elements
return
- cachedir = GLOBALCACHE
- #if ! -d cachedir :
+ cachedir = DEFAULTCACHEDIR
if not os.access(cachedir, os.W_OK):
try:
os.mkdir(cachedir)
Modified: cdd/trunk/webtools/tasks.py
==============================================================================
--- cdd/trunk/webtools/tasks.py (original)
+++ cdd/trunk/webtools/tasks.py Mon Oct 6 07:33:21 2008
@@ -58,19 +58,12 @@
# initialize gensi
loader = TemplateLoader([template_dir], auto_reload=True)
-if not os.access(data['outputdir'], os.W_OK):
- try:
- os.mkdir(data['outputdir'])
- except:
- # if more than one dir in the tree has to be crated just use mkdir -p ...
- try:
- os.system("mkdir -p %s" % data['outputdir'])
- except:
- print >>stderr, "Unable to create output dir " + data['outputdir']
- exit(-1)
+outputdir = cdeps.CheckOrCreateOutputDir('tasks')
+if outputdir == None:
+ exit(-1)
t = datetime.now()
-htaccess = data['outputdir'] + '/.htaccess'
+htaccess = outputdir + '/.htaccess'
try:
os.unlink(htaccess)
except: # simply continue if file does not exist
@@ -162,7 +155,7 @@
template = loader.load('tasks_idx.xhtml')
- outputfile = data['outputdir'] + '/index.html'
+ outputfile = outputdir + '/index.html'
if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
outputfile += '.' + lang
try:
@@ -207,7 +200,7 @@
data['othertasks'] = _("Links to other tasks")
data['indexlink'] = _("Index of all tasks")
- outputfile = data['outputdir'] + '/' + task + '.html'
+ outputfile = outputdir + '/' + task + '.html'
if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
outputfile += '.' + lang
try:
Modified: cdd/trunk/webtools/webconf/debian-edu.conf
==============================================================================
--- cdd/trunk/webtools/webconf/debian-edu.conf (original)
+++ cdd/trunk/webtools/webconf/debian-edu.conf Mon Oct 6 07:33:21 2008
@@ -5,7 +5,7 @@
AliothUrl: http://alioth.debian.org/projects/debian-edu
ProjectList: debian-edu at lists.debian.org
LogoUrl: http://cdd.alioth.debian.org/edu/img/slx-tux.png
-OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/edu/tasks
+OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/edu
DataDir: /var/lib/gforge/chroot/home/groups/cdd/data/edu
CacheDir: /var/lib/gforge/chroot/home/groups/cdd/cache
VcsDir: /svn/debian-edu/trunk/src/debian-edu
Modified: cdd/trunk/webtools/webconf/debian-gis.conf
==============================================================================
--- cdd/trunk/webtools/webconf/debian-gis.conf (original)
+++ cdd/trunk/webtools/webconf/debian-gis.conf Mon Oct 6 07:33:21 2008
@@ -5,7 +5,7 @@
AliothUrl: http://alioth.debian.org/projects/debian-edu
ProjectList: pkg-grass-devel at lists.alioth.debian.org
LogoUrl: http://cdd.alioth.debian.org/gis/img/debiangis_mollweide.png
-OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/gis/tasks
+OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/gis
DataDir: /var/lib/gforge/chroot/home/groups/cdd/data/gis
CacheDir: /var/lib/gforge/chroot/home/groups/cdd/cache
VcsDir: /svn/pkg-grass/packages/debian-gis
Modified: cdd/trunk/webtools/webconf/debian-junior.conf
==============================================================================
--- cdd/trunk/webtools/webconf/debian-junior.conf (original)
+++ cdd/trunk/webtools/webconf/debian-junior.conf Mon Oct 6 07:33:21 2008
@@ -4,7 +4,7 @@
Homepage: http://www.debian.org/devel/debian-jr
AliothUrl:
ProjectList: debian-junior at lists.debian.org
-OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/junior/tasks
+OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/junior
DataDir: /var/lib/gforge/chroot/home/groups/cdd/data/junior
CacheDir: /var/lib/gforge/chroot/home/groups/cdd/cache
VcsDir: /svn/cdd/projects/junior/trunk/debian-junior
Modified: cdd/trunk/webtools/webconf/debian-med.conf
==============================================================================
--- cdd/trunk/webtools/webconf/debian-med.conf (original)
+++ cdd/trunk/webtools/webconf/debian-med.conf Mon Oct 6 07:33:21 2008
@@ -6,7 +6,7 @@
ProjectList: debian-med at lists.debian.org
LogoUrl: http://debian-med.alioth.debian.org/img/logo.png
Ignore: alternative Logo: http://people.debian.org/~tille/debian-med/logos/med-06.jpg
-OutputDir: /var/lib/gforge/chroot/home/groups/debian-med/htdocs/tasks
+OutputDir: /var/lib/gforge/chroot/home/groups/debian-med/htdocs
DataDir: /var/lib/gforge/chroot/home/groups/debian-med/data
CacheDir: /var/lib/gforge/chroot/home/groups/cdd/cache
VcsDir: /svn/cdd/projects/med/trunk/debian-med
Modified: cdd/trunk/webtools/webconf/debian-science.conf
==============================================================================
--- cdd/trunk/webtools/webconf/debian-science.conf (original)
+++ cdd/trunk/webtools/webconf/debian-science.conf Mon Oct 6 07:33:21 2008
@@ -4,7 +4,7 @@
Homepage: http://wiki.debian.org/DebianScience
AliothUrl: http://alioth.debian.org/projects/debian-science
ProjectList: debian-science at lists.debian.org
-OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/science/tasks
+OutputDir: /var/lib/gforge/chroot/home/groups/cdd/htdocs/science
DataDir: /var/lib/gforge/chroot/home/groups/cdd/data/science
CacheDir: /var/lib/gforge/chroot/home/groups/cdd/cache
VcsDir: /svn/cdd/projects/science/trunk/debian-science
More information about the Cdd-commits
mailing list