mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-25 18:20:48 +00:00
Merge pull request #5073 from Gustl22/build-scripts
Update Build scripts
This commit is contained in:
commit
139fe797af
@ -25,6 +25,7 @@ import subprocess
|
|||||||
import optparse
|
import optparse
|
||||||
import atexit
|
import atexit
|
||||||
import platform
|
import platform
|
||||||
|
import distro
|
||||||
|
|
||||||
####################
|
####################
|
||||||
### Global variables
|
### Global variables
|
||||||
@ -539,6 +540,15 @@ def copy_user_manuals():
|
|||||||
for path in glob.glob(src_pattern):
|
for path in glob.glob(src_pattern):
|
||||||
must_copy(path, dst_dir)
|
must_copy(path, dst_dir)
|
||||||
|
|
||||||
|
# copy go_fileserver "fileserver" to directory seafile-server/seafile/bin
|
||||||
|
def copy_go_fileserver():
|
||||||
|
builddir = conf[CONF_BUILDDIR]
|
||||||
|
srcdir = conf[CONF_SRCDIR]
|
||||||
|
src_go_fileserver = os.path.join(srcdir, 'fileserver')
|
||||||
|
dst_bin_dir = os.path.join(builddir, 'seafile-server', 'seafile', 'bin')
|
||||||
|
|
||||||
|
must_copy(src_go_fileserver, dst_bin_dir)
|
||||||
|
|
||||||
def copy_seafdav():
|
def copy_seafdav():
|
||||||
dst_dir = os.path.join(conf[CONF_BUILDDIR], 'seafile-server', 'seahub', 'thirdpart')
|
dst_dir = os.path.join(conf[CONF_BUILDDIR], 'seafile-server', 'seahub', 'thirdpart')
|
||||||
tarball = os.path.join(conf[CONF_SRCDIR], 'seafdav.tar.gz')
|
tarball = os.path.join(conf[CONF_SRCDIR], 'seafdav.tar.gz')
|
||||||
@ -556,7 +566,8 @@ def copy_scripts_and_libs():
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
builddir = conf[CONF_BUILDDIR]
|
builddir = conf[CONF_BUILDDIR]
|
||||||
scripts_srcdir = os.path.join(builddir, Seafile().projdir, 'scripts')
|
src_seahubdir = Seahub().projdir
|
||||||
|
scripts_srcdir = os.path.join(builddir, src_seahubdir, 'scripts')
|
||||||
serverdir = os.path.join(builddir, 'seafile-server')
|
serverdir = os.path.join(builddir, 'seafile-server')
|
||||||
|
|
||||||
must_copy(os.path.join(scripts_srcdir, 'setup-seafile.sh'),
|
must_copy(os.path.join(scripts_srcdir, 'setup-seafile.sh'),
|
||||||
@ -589,7 +600,7 @@ def copy_scripts_and_libs():
|
|||||||
error('failed to copy upgrade scripts: %s' % e)
|
error('failed to copy upgrade scripts: %s' % e)
|
||||||
|
|
||||||
# copy sql scripts
|
# copy sql scripts
|
||||||
sql_scriptsdir = os.path.join(scripts_srcdir, 'sql')
|
sql_scriptsdir = os.path.join(Seafile().projdir, 'scripts', 'sql')
|
||||||
dst_sql_scriptsdir = os.path.join(serverdir, 'sql')
|
dst_sql_scriptsdir = os.path.join(serverdir, 'sql')
|
||||||
try:
|
try:
|
||||||
shutil.copytree(sql_scriptsdir, dst_sql_scriptsdir)
|
shutil.copytree(sql_scriptsdir, dst_sql_scriptsdir)
|
||||||
@ -603,7 +614,6 @@ def copy_scripts_and_libs():
|
|||||||
runtimedir)
|
runtimedir)
|
||||||
|
|
||||||
# move seahub to seafile-server/seahub
|
# move seahub to seafile-server/seahub
|
||||||
src_seahubdir = Seahub().projdir
|
|
||||||
dst_seahubdir = os.path.join(serverdir, 'seahub')
|
dst_seahubdir = os.path.join(serverdir, 'seahub')
|
||||||
try:
|
try:
|
||||||
shutil.move(src_seahubdir, dst_seahubdir)
|
shutil.move(src_seahubdir, dst_seahubdir)
|
||||||
@ -622,6 +632,9 @@ def copy_scripts_and_libs():
|
|||||||
copy_shared_libs()
|
copy_shared_libs()
|
||||||
copy_user_manuals()
|
copy_user_manuals()
|
||||||
|
|
||||||
|
# copy go_fileserver
|
||||||
|
copy_go_fileserver()
|
||||||
|
|
||||||
def copy_pdf2htmlex():
|
def copy_pdf2htmlex():
|
||||||
'''Copy pdf2htmlEX exectuable and its dependent libs'''
|
'''Copy pdf2htmlEX exectuable and its dependent libs'''
|
||||||
pdf2htmlEX_executable = find_in_path('pdf2htmlEX')
|
pdf2htmlEX_executable = find_in_path('pdf2htmlEX')
|
||||||
@ -785,10 +798,14 @@ def create_tarball(tarball_name):
|
|||||||
excludes_list = [ '--exclude=%s' % pattern for pattern in ignored_patterns ]
|
excludes_list = [ '--exclude=%s' % pattern for pattern in ignored_patterns ]
|
||||||
excludes = ' '.join(excludes_list)
|
excludes = ' '.join(excludes_list)
|
||||||
|
|
||||||
tar_cmd = 'tar czf %(tarball_name)s %(versioned_serverdir)s %(excludes)s' \
|
# tar will copy the content the directory python3.[0-9]+/ to python3/
|
||||||
|
transform = '--transform=\'s,python3\.[0-9]\+/,python3/,\''
|
||||||
|
|
||||||
|
tar_cmd = 'tar czf %(tarball_name)s %(transform)s %(versioned_serverdir)s %(excludes)s' \
|
||||||
% dict(tarball_name=tarball_name,
|
% dict(tarball_name=tarball_name,
|
||||||
versioned_serverdir=versioned_serverdir,
|
versioned_serverdir=versioned_serverdir,
|
||||||
excludes=excludes)
|
excludes=excludes,
|
||||||
|
transform=transform)
|
||||||
|
|
||||||
if run(tar_cmd) < 0:
|
if run(tar_cmd) < 0:
|
||||||
error('failed to generate the tarball')
|
error('failed to generate the tarball')
|
||||||
@ -806,17 +823,20 @@ def gen_tarball():
|
|||||||
# 32-bit: seafile-server_1.2.2_i386.tar.gz
|
# 32-bit: seafile-server_1.2.2_i386.tar.gz
|
||||||
version = conf[CONF_VERSION]
|
version = conf[CONF_VERSION]
|
||||||
arch = os.uname()[-1].replace('_', '-')
|
arch = os.uname()[-1].replace('_', '-')
|
||||||
if 'arm' in platform.machine():
|
if 'arm' in platform.machine() or 'aarch64' in platform.machine():
|
||||||
arch = 'pi'
|
arch = platform.machine()
|
||||||
elif arch != 'x86-64':
|
elif arch != 'x86-64':
|
||||||
arch = 'i386'
|
arch = 'i386'
|
||||||
|
|
||||||
|
# determine linux distribution
|
||||||
|
distribution = distro.codename().replace(' ', '-').lower()
|
||||||
|
|
||||||
dbg = ''
|
dbg = ''
|
||||||
if conf[CONF_NO_STRIP]:
|
if conf[CONF_NO_STRIP]:
|
||||||
dbg = '.dbg'
|
dbg = '.dbg'
|
||||||
|
|
||||||
tarball_name = 'seafile-server_%(version)s_%(arch)s%(dbg)s.tar.gz' \
|
tarball_name = 'seafile-server-%(version)s-%(distribution)s-%(arch)s%(dbg)s.tar.gz' \
|
||||||
% dict(version=version, arch=arch, dbg=dbg)
|
% dict(version=version, distribution=distribution, arch=arch, dbg=dbg)
|
||||||
dst_tarball = os.path.join(conf[CONF_OUTPUTDIR], tarball_name)
|
dst_tarball = os.path.join(conf[CONF_OUTPUTDIR], tarball_name)
|
||||||
|
|
||||||
# generate the tarball
|
# generate the tarball
|
||||||
|
Loading…
Reference in New Issue
Block a user