More build-mac.py

pull/1894/head
Shuai Lin 2017-04-21 16:33:38 +08:00
parent 0ac31d8ede
commit 5a707c9a60
11 changed files with 178 additions and 19 deletions

View File

@ -2,7 +2,7 @@ SUBDIRS = include lib common daemon app doc python
DIST_SUBDIRS = include lib common app daemon doc python
EXTRA_DIST = install-sh $(INTLTOOL) README.markdown scripts debian msi LICENSE.txt
EXTRA_DIST = install-sh $(INTLTOOL) README.markdown scripts debian msi LICENSE.txt dmg
ACLOCAL_AMFLAGS = -I m4

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<dict>
<key>identifier</key>
<string>Layout.B0B66CEF-E35C-48F3-8D66-172544C96704</string>
<key>options</key>
<dict>
<key>backgroundImageName</key>
<string>dmg_background.jpg</string>
<key>fontSize</key>
<integer>12</integer>
<key>iconSize</key>
<integer>128</integer>
<key>layoutItems</key>
<array>
<dict>
<key>identifier</key>
<string>LayoutItem.7DCEB33C-3B26-463C-9D52-D2E99ADD0AD0</string>
<key>name</key>
<string>Applications</string>
<key>position</key>
<string>{426, 190}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.042D24CE-36D9-4328-A97F-BCF3DC524509</string>
<key>name</key>
<string>Seafile Client.app</string>
<key>position</key>
<string>{219, 190}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.CFA83A1B-E783-4354-88A9-255F0F623398</string>
<key>name</key>
<string>.Trashes</string>
<key>position</key>
<string>{128, 426}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.830478CF-49D6-4772-AC6C-3A56A329536F</string>
<key>name</key>
<string>.fseventsd</string>
<key>position</key>
<string>{336, 426}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.E417B39C-5B93-4D7D-AE5A-FC3B0CDFD9D7</string>
<key>name</key>
<string>.DropDMGBackground</string>
<key>position</key>
<string>{400, 426}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.209D5BB3-143C-4DB8-8FB9-F1175B8184F2</string>
<key>name</key>
<string>.DS_Store</string>
<key>position</key>
<string>{64, 426}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.D20D1139-FE25-445E-BBE3-E5374F90A06E</string>
<key>position</key>
<string>{340, 388}</string>
<key>rtf</key>
<string>{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
\f0\fs24 \cf0 Drag Seafile Client to the Applications folder to install}</string>
<key>size</key>
<string>{282, 30}</string>
<key>type</key>
<string>text</string>
</dict>
</array>
<key>windowOriginTopLeft</key>
<string>{100, 100}</string>
</dict>
</dict>
<key>documentCreator</key>
<string>DropDMG 3.1.1</string>
<key>documentType</key>
<string>com.c-command.DropDMG.Layout</string>
<key>formatVersion</key>
<integer>1</integer>
</dict>
</plist>

Binary file not shown.

View File

@ -65,6 +65,8 @@ CONF_OUTPUTDIR = 'outputdir'
CONF_THIRDPARTDIR = 'thirdpartdir'
CONF_NO_STRIP = 'nostrip'
CONF_SLAVE_HOST = 'slave_host'
CONF_BRAND = 'brand'
CONF_LOCAL = 'local'
# pylint: enable=bad-whitespace
NUM_CPU = multiprocessing.cpu_count()
@ -379,6 +381,13 @@ class SeafileClient(Project):
def before_build(self):
pass
class SeafileDMGLayout(Seafile):
def __init__(self):
Seafile.__init__(self)
self.build_commands = [
]
class SeafileFinderSyncPlugin(SeafileClient):
def __init__(self):
@ -418,6 +427,7 @@ def validate_args(usage, options):
mode = get_option(CONF_MODE).lower()
assert mode in ('master', 'slave')
version = get_option(CONF_VERSION)
seafile_version = get_option(CONF_SEAFILE_VERSION)
seafile_client_version = get_option(CONF_SEAFILE_CLIENT_VERSION)
@ -439,6 +449,9 @@ def validate_args(usage, options):
# [ keep ]
keep = get_option(CONF_KEEP)
# [ local ]
build_local = get_option(CONF_LOCAL)
# [ builddir ]
builddir = get_option(CONF_BUILDDIR)
if not exists(builddir):
@ -468,7 +481,10 @@ def validate_args(usage, options):
slave_host = get_option(CONF_SLAVE_HOST)
brand = get_option(CONF_BRAND)
conf[CONF_MODE] = mode
conf[CONF_LOCAL] = build_local
conf[CONF_VERSION] = version
conf[CONF_LIBSEARPC_VERSION] = libsearpc_version
conf[CONF_SEAFILE_VERSION] = seafile_version
@ -481,6 +497,7 @@ def validate_args(usage, options):
conf[CONF_KEEP] = keep
conf[CONF_NO_STRIP] = nostrip
conf[CONF_SLAVE_HOST] = slave_host
conf[CONF_BRAND] = brand
# TODO: remove this
# conf[CONF_SLAVE_HOST] = 'lion'
# conf[CONF_SLAVE_HOST] = 'sierra'
@ -588,6 +605,15 @@ def parse_args():
dest=CONF_SLAVE_HOST,
default='lion',
help='the hostname of the lower version osx slave')
parser.add_option(long_opt(CONF_BRAND),
dest=CONF_BRAND,
help='the brand')
parser.add_option(long_opt(CONF_LOCAL),
dest=CONF_LOCAL,
action='store_true',
help='build locally instead of using an old 10.7 vm')
usage = parser.format_help()
options, remain = parser.parse_args()
if remain:
@ -764,13 +790,16 @@ def gen_dmg():
appdir = join(parentdir, 'seafile-applet.app')
app_plugins_dir = join(appdir, 'Contents/PlugIns')
layout = SeafileDMGLayout()
layout.uncompress()
layout_folder = join(layout.projdir, 'dmg/seafileLayout')
args = [
DROPDMG,
parentdir,
'--format', 'bzip2',
# TODO: where to keep the seafileLayout folder? seafile-client repo?
'--layout-folder', expanduser('~/seafileLayout'),
'--volume-name', 'Seafile Client',
'--layout-folder', layout_folder,
'--volume-name', conf[CONF_BRAND] or 'Seafile Client',
]
with cd(conf[CONF_BUILDDIR]):
@ -789,7 +818,12 @@ def gen_dmg():
# Rename the .app dir to 'Seafile Client.app', and create the shortcut
# to '/Applications' so the user can drag into it when opening the DMG.
must_run('mv {}/seafile-applet.app "{}/{}"'.format(parentdir, parentdir, FINAL_APP))
brand = conf.get(CONF_BRAND, '')
if brand:
final_app = '{}.app'.format(brand)
else:
final_app = FINAL_APP
must_run('mv {}/seafile-applet.app "{}/{}"'.format(parentdir, parentdir, final_app))
must_run('ln -sf /Applications {}/'.format(parentdir))
# Sometimes DropDmg would fail if there are two many Finder windows.
@ -950,12 +984,12 @@ def build_on_slave():
def get_app_tgz_from_slave():
fn = 'seafile-applet.app.tar.gz'
src = join(SLAVE_BUILDDIR, fn)
src = join(SLAVE_BUILDDIR, 'seafile-mac-build', fn)
dst = join(conf[CONF_BUILDDIR], fn)
get_file_from_slave(src, dst)
def copy_dmg():
brand = 'seafile-client'
brand = conf[CONF_BRAND] or 'seafile-client'
branded_dmg = '{}-{}.dmg'.format(brand, conf[CONF_VERSION])
src_dmg = os.path.join(conf[CONF_BUILDDIR], 'app-{}.dmg'.format(conf[CONF_VERSION]))
dst_dmg = os.path.join(conf[CONF_OUTPUTDIR], branded_dmg)
@ -1007,15 +1041,7 @@ def copy_sparkle_framework():
# -P` would keep symlinks as is.
must_run('cp -R -P "{}" "{}"'.format(src, dst))
def master_workflow():
send_sources_to_slave()
build_on_slave()
get_app_tgz_from_slave()
build_and_sign_fsplugin()
gen_dmg()
copy_dmg()
def slave_workflow():
def build_projects():
libsearpc = Libsearpc()
ccnet = Ccnet()
seafile = Seafile()
@ -1037,8 +1063,31 @@ def slave_workflow():
copy_shared_libs()
output_app_tgz = join(conf[CONF_BUILDDIR], '..', 'seafile-applet.app.tar.gz')
with cd(seafile_client.projdir):
def local_workflow():
build_projects()
generate_app_tar_gz()
build_and_sign_fsplugin()
gen_dmg()
copy_dmg()
def master_workflow():
send_sources_to_slave()
build_on_slave()
get_app_tgz_from_slave()
build_and_sign_fsplugin()
gen_dmg()
copy_dmg()
def slave_workflow():
build_projects()
generate_app_tar_gz()
def generate_app_tar_gz():
# output_app_tgz = join(conf[CONF_BUILDDIR], '..', 'seafile-applet.app.tar.gz')
output_app_tgz = join(conf[CONF_BUILDDIR], 'seafile-applet.app.tar.gz')
with cd(SeafileClient().projdir):
run('tar czf {} seafile-applet.app'.format(output_app_tgz))
def setup_logging(level=logging.INFO):
@ -1060,7 +1109,9 @@ def main():
info('NUM_CPU = {}'.format(NUM_CPU))
setup_build_env()
if conf[CONF_MODE] == 'master':
if conf[CONF_LOCAL]:
local_workflow()
elif conf[CONF_MODE] == 'master':
info('entering master workflow')
master_workflow()
else: