Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
Utilities
RelMon
scripts
dir2webdir.py
Go to the documentation of this file.
1
#! /usr/bin/env python
2
################################################################################
3
# RelMon: a tool for automatic Release Comparison
4
# https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon
5
#
6
#
7
#
8
# Danilo Piparo CERN - danilo.piparo@cern.ch
9
#
10
# Transform all html files into a directory into .htmlgz files and add the
11
# .htaccess file to tell Apache to serve the new compressed data.
12
# Moves also the pickles away.
13
#
14
################################################################################
15
16
htaccess_content=
"""
17
RewriteEngine on
18
19
RewriteCond %{HTTP:Accept-Encoding} gzip
20
RewriteRule (.*)\.html$ $1\.htmlgz [L]
21
RewriteRule (.*)\.png$ $1\.pnggz [L]
22
23
AddType "text/html;charset=UTF-8" .htmlgz
24
AddEncoding gzip .htmlgz
25
26
AddType "image/png" .pnggz
27
AddEncoding gzip .pnggz
28
29
DirectoryIndex RelMonSummary.htmlgz
30
31
"""
32
33
34
from
os.path
import
exists
35
from
os
import
system
36
from
sys
import
argv,exit
37
38
argc=len(argv)
39
40
if
argc!=2:
41
print
"Usage: %prog directoryname"
42
exit
(-1)
43
44
directory = argv[1]
45
46
while
directory[-1]==
"/"
: directory= directory[:-1]
47
48
if
not
exists(directory):
49
print
"Directory %s does not exist: aborting!"
%directory
50
exit
(-1)
51
52
print
"Moving pkls away..."
53
pkl_dir=
"%s_pkls"
%directory
54
system(
"mkdir %s"
%pkl_dir)
55
system(
"mv %s/*pkl %s"
%(directory,pkl_dir))
56
print
"All pkls moved in directory %s"
%pkl_dir
57
58
print
"Backupping directory %s"
%directory
59
system(
"cp -r %s %s_back"
%(directory,directory))
# i know, it should be better..
60
print
"Backupped!"
61
62
print
"Gzipping content of %s"
%directory
63
system(
"time gzip -r -S gz %s"
%directory)
# i know, it should be better..
64
print
"Content of %s zipped!"
%directory
65
66
print
"Adding .htaccess file..."
67
htaccess=open(
"%s/.htaccess"
%directory,
"w"
)
68
htaccess.write(htaccess_content)
69
htaccess.close()
70
print
"Apache .htaccess file successfully added!"
cmsRelvalreport.exit
tuple exit
Definition:
cmsRelvalreport.py:1000
Generated for CMSSW Reference Manual by
1.8.5