- upgrade: add --server_only option

(updates scheduler and back-end programs, but not web code)
    fixes #968

svn path=/trunk/boinc/; revision=20052
This commit is contained in:
David Anderson 2009-12-31 02:37:16 +00:00
parent fd1d46d17f
commit 437087a053
3 changed files with 41 additions and 30 deletions

View File

@ -10761,3 +10761,13 @@ David 30 Dec 2009
lib/ lib/
util.cpp util.cpp
filesys.cpp filesys.cpp
David 30 Dec 2009
- upgrade: add --server_only option
(updates scheduler and back-end programs, but not web code)
fixes #968
tools/
upgrade
py/Boinc/
setup_project.py

View File

@ -296,7 +296,7 @@ def create_project_dirs(dest_dir):
'html/user_profile/images' 'html/user_profile/images'
]) ])
def install_boinc_files(dest_dir, web_only): def install_boinc_files(dest_dir, install_web_files, install_server_files):
"""Copy files from source dir to project dir. """Copy files from source dir to project dir.
Used by the upgrade script, so don't copy sample files to real name.""" Used by the upgrade script, so don't copy sample files to real name."""
@ -305,26 +305,30 @@ def install_boinc_files(dest_dir, web_only):
create_project_dirs(dest_dir); create_project_dirs(dest_dir);
install_glob(srcdir('html/inc/*.inc'), dir('html/inc/')) if install_web_files:
install_glob(srcdir('html/inc/*.php'), dir('html/inc/')) install_glob(srcdir('html/inc/*.inc'), dir('html/inc/'))
install_glob(srcdir('html/inc/*.dat'), dir('html/inc/')) install_glob(srcdir('html/inc/*.php'), dir('html/inc/'))
install_glob(srcdir('html/ops/*.php'), dir('html/ops/')) install_glob(srcdir('html/inc/*.dat'), dir('html/inc/'))
install_glob(srcdir('html/ops/*.inc'), dir('html/ops/')) install_glob(srcdir('html/ops/*.php'), dir('html/ops/'))
install_glob(srcdir('html/ops/ffmail/sample*'), dir('html/ops/ffmail/')) install_glob(srcdir('html/ops/*.inc'), dir('html/ops/'))
install_glob(srcdir('html/ops/mass_email/sample*'), dir('html/ops/mass_email/')) install_glob(srcdir('html/ops/ffmail/sample*'), dir('html/ops/ffmail/'))
install_glob(srcdir('html/ops/remind_email/sample*'), dir('html/ops/remind_email/')) install_glob(srcdir('html/ops/mass_email/sample*'), dir('html/ops/mass_email/'))
install_glob(srcdir('html/user/*.php'), dir('html/user/')) install_glob(srcdir('html/ops/remind_email/sample*'), dir('html/ops/remind_email/'))
install_glob(srcdir('html/user/*.inc'), dir('html/user/')) install_glob(srcdir('html/user/*.php'), dir('html/user/'))
install_glob(srcdir('html/user/*.css'), dir('html/user/')) install_glob(srcdir('html/user/*.inc'), dir('html/user/'))
install_glob(srcdir('html/user/*.txt'), dir('html/user/')) install_glob(srcdir('html/user/*.css'), dir('html/user/'))
install_glob(srcdir('html/user/*.js'), dir('html/user/')) install_glob(srcdir('html/user/*.txt'), dir('html/user/'))
install_glob(srcdir('html/user/*.png'), dir('html/user/img')) install_glob(srcdir('html/user/*.js'), dir('html/user/'))
install_glob(srcdir('html/user/*.gif'), dir('html/user/img')) install_glob(srcdir('html/user/*.png'), dir('html/user/img'))
install_glob(srcdir('html/user/img/*.*'), dir('html/user/img')) install_glob(srcdir('html/user/*.gif'), dir('html/user/img'))
if not os.path.exists(dir('html/user/motd.php')): install_glob(srcdir('html/user/img/*.*'), dir('html/user/img'))
shutil.copy(srcdir('html/user/sample_motd.php'), dir('html/user/motd.php')) if not os.path.exists(dir('html/user/motd.php')):
os.system("rm -f "+dir('html/languages/translations/*')) shutil.copy(srcdir('html/user/sample_motd.php'), dir('html/user/motd.php'))
install_glob(srcdir('html/languages/translations/*.po'), dir('html/languages/translations/')) os.system("rm -f "+dir('html/languages/translations/*'))
install_glob(srcdir('html/languages/translations/*.po'), dir('html/languages/translations/'))
if not install_server_files:
return
# copy Python stuff # copy Python stuff
map(lambda (s): install(srcdir('sched',s), dir('bin',s)), map(lambda (s): install(srcdir('sched',s), dir('bin',s)),
@ -342,9 +346,6 @@ import sys, os
sys.path.insert(0, os.path.join('%s', 'py')) sys.path.insert(0, os.path.join('%s', 'py'))
''' % dest_dir ''' % dest_dir
if web_only:
return
# copy backend (C++) programs; # copy backend (C++) programs;
# rename current web daemons in case they're in use # rename current web daemons in case they're in use
@ -480,7 +481,7 @@ class Project:
# Create the project log directory # Create the project log directory
self.create_logdir() self.create_logdir()
install_boinc_files(self.dir(), self.web_only) install_boinc_files(self.dir(), True, not self.web_only)
# copy sample web files to final names # copy sample web files to final names
install(srcdir('html/user/sample_index.php'), install(srcdir('html/user/sample_index.php'),
@ -489,8 +490,6 @@ class Project:
self.dir('html/project/project.inc')) self.dir('html/project/project.inc'))
install(srcdir('html/project.sample/project_specific_prefs.inc'), install(srcdir('html/project.sample/project_specific_prefs.inc'),
self.dir('html/project/project_specific_prefs.inc')) self.dir('html/project/project_specific_prefs.inc'))
install(srcdir('html/project.sample/project_news.inc'),
self.dir('html/project/project_news.inc'))
install(srcdir('html/project.sample/cache_parameters.inc'), install(srcdir('html/project.sample/cache_parameters.inc'),
self.dir('html/project/cache_parameters.inc')) self.dir('html/project/cache_parameters.inc'))
install(srcdir('html/ops', 'sample_server_status.php'), install(srcdir('html/ops', 'sample_server_status.php'),

View File

@ -20,14 +20,14 @@ from Boinc.setup_project import *
import os, getopt import os, getopt
def usage(): def usage():
print "Usage: upgrade [--project_root] [--web_only] [--srcdir DIR] project_name" print "Usage: upgrade [--project_root] [--web_only | --server_only] [--srcdir DIR] project_name"
raise SystemExit raise SystemExit
def syntax_error(str): def syntax_error(str):
raise SystemExit('%s; See "%s --help" for help\n' % (str, sys.argv[0])) raise SystemExit('%s; See "%s --help" for help\n' % (str, sys.argv[0]))
try: try:
opts, args = getopt.getopt(sys.argv[1:], '', ['help', 'project_root=', 'web_only', 'srcdir=']) opts, args = getopt.getopt(sys.argv[1:], '', ['help', 'project_root=', 'web_only', 'server_only', 'srcdir='])
except getopt.GetoptError, e: except getopt.GetoptError, e:
syntax_error(e) syntax_error(e)
@ -35,12 +35,14 @@ home = os.path.expanduser('~')
options.project_root = os.path.join(home, 'projects') options.project_root = os.path.join(home, 'projects')
options.web_only = False options.web_only = False
options.server_only = False
options.srcdir = None options.srcdir = None
for o,a in opts: for o,a in opts:
if o == '--help': usage() if o == '--help': usage()
elif o == '--project_root': options.project_root = a elif o == '--project_root': options.project_root = a
elif o == '--web_only': options.web_only = True elif o == '--web_only': options.web_only = True
elif o == '--server_only': options.server_only = True
elif o == '--srcdir': options.srcdir = a elif o == '--srcdir': options.srcdir = a
else: else:
raise SystemExit('internal error o=%s'%o) raise SystemExit('internal error o=%s'%o)
@ -70,7 +72,7 @@ print "Upgrading files... "
options.install_method = 'copy' options.install_method = 'copy'
init() init()
install_boinc_files(INSTALL_DIR, options.web_only) install_boinc_files(INSTALL_DIR, not options.server_only, not options.web_only)
print "Upgrading files... done" print "Upgrading files... done"