Merge release/v7.3.0 package fixes

This commit is contained in:
Semyon Bezrukov
2023-01-01 23:17:14 +03:00
parent ef43e6a9a4
commit 655837f8cd
5 changed files with 252 additions and 225 deletions

View File

@ -28,10 +28,11 @@ if utils.is_macos():
desktop_branding_dir = "desktop-apps/macos" desktop_branding_dir = "desktop-apps/macos"
desktop_updates_dir = "build/update" desktop_updates_dir = "build/update"
desktop_changes_dir = "ONLYOFFICE/update/updates/ONLYOFFICE/changes" desktop_changes_dir = "ONLYOFFICE/update/updates/ONLYOFFICE/changes"
desktop_update_changes_list = {
"en": "ReleaseNotes",
"ru": "ReleaseNotesRU"
}
sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac" sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
builder_product_name = "Document Builder" builder_product_name = "Document Builder"
if utils.is_linux():
desktop_make_targets = ["deb", "rpm", "suse-rpm", "tar"]
builder_make_targets = ["deb", "rpm"] # tar
server_make_targets = ["deb", "rpm", "tar"]

View File

@ -16,6 +16,9 @@ def make():
return return
def aws_s3_upload(files, key, ptype=None): def aws_s3_upload(files, key, ptype=None):
if not files:
return False
ret = True
key = "builder/" + key key = "builder/" + key
for file in files: for file in files:
args = ["aws"] args = ["aws"]
@ -26,10 +29,11 @@ def aws_s3_upload(files, key, ptype=None):
file, "s3://" + branding.s3_bucket + "/" + key file, "s3://" + branding.s3_bucket + "/" + key
] ]
if common.os_family == "windows": if common.os_family == "windows":
ret = utils.cmd(*args, verbose=True) upload = utils.cmd(*args, verbose=True)
else: else:
ret = utils.sh(" ".join(args), verbose=True) upload = utils.sh(" ".join(args), verbose=True)
if ret and ptype is not None: ret &= upload
if upload and ptype is not None:
full_key = key full_key = key
if full_key.endswith("/"): full_key += utils.get_basename(file) if full_key.endswith("/"): full_key += utils.get_basename(file)
utils.add_deploy_data( utils.add_deploy_data(
@ -118,12 +122,12 @@ def make_linux():
utils.set_cwd("document-builder-package") utils.set_cwd("document-builder-package")
utils.log_h2("builder build") utils.log_h2("builder build")
args = [] make_args = branding.builder_make_targets
if common.platform == "linux_aarch64": if common.platform == "linux_aarch64":
args += ["-e", "UNAME_M=aarch64"] make_args += ["-e", "UNAME_M=aarch64"]
if not branding.onlyoffice: if not branding.onlyoffice:
args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-builder-package"] make_args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-builder-package"]
ret = utils.sh("make clean && make packages " + " ".join(args), verbose=True) ret = utils.sh("make clean && make " + " ".join(make_args), verbose=True)
utils.set_summary("builder build", ret) utils.set_summary("builder build", ret)
rpm_arch = "x86_64" rpm_arch = "x86_64"
@ -132,32 +136,37 @@ def make_linux():
if common.deploy: if common.deploy:
utils.log_h2("builder deploy") utils.log_h2("builder deploy")
if ret: if ret:
# utils.log_h2("builder tar deploy") if "tar" in branding.builder_make_targets:
# ret = aws_s3_upload( utils.log_h2("builder tar deploy")
# utils.glob_path("tar/*.tar.gz"), ret = aws_s3_upload(
# "linux/generic/%s/" % common.channel, utils.glob_path("tar/*.tar.gz"),
# "Portable") "linux/generic/%s/" % common.channel,
# utils.set_summary("builder tar deploy", ret) "Portable"
)
utils.log_h2("builder deb deploy") utils.set_summary("builder tar deploy", ret)
ret = aws_s3_upload( if "deb" in branding.builder_make_targets:
utils.glob_path("deb/*.deb"), utils.log_h2("builder deb deploy")
"linux/debian/%s/" % common.channel, ret = aws_s3_upload(
"Debian" utils.glob_path("deb/*.deb"),
) "linux/debian/%s/" % common.channel,
utils.set_summary("builder deb deploy", ret) "Debian"
)
utils.log_h2("builder rpm deploy") utils.set_summary("builder deb deploy", ret)
ret = aws_s3_upload( if "rpm" in branding.builder_make_targets:
utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"), utils.log_h2("builder rpm deploy")
"linux/rhel/%s/" % common.channel, ret = aws_s3_upload(
"CentOS" utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"),
) "linux/rhel/%s/" % common.channel,
utils.set_summary("builder rpm deploy", ret) "CentOS"
)
utils.set_summary("builder rpm deploy", ret)
else: else:
# utils.set_summary("builder tar deploy", False) if "tar" in branding.builder_make_targets:
utils.set_summary("builder deb deploy", False) utils.set_summary("builder tar deploy", False)
utils.set_summary("builder rpm deploy", False) if "deb" in branding.builder_make_targets:
utils.set_summary("builder deb deploy", False)
if "rpm" in branding.builder_make_targets:
utils.set_summary("builder rpm deploy", False)
utils.set_cwd(common.workspace_dir) utils.set_cwd(common.workspace_dir)
return return

View File

@ -19,6 +19,9 @@ def make():
return return
def aws_s3_upload(files, key, ptype=None): def aws_s3_upload(files, key, ptype=None):
if not files:
return False
ret = True
key = "desktop/" + key key = "desktop/" + key
for file in files: for file in files:
args = ["aws"] args = ["aws"]
@ -29,10 +32,11 @@ def aws_s3_upload(files, key, ptype=None):
file, "s3://" + branding.s3_bucket + "/" + key file, "s3://" + branding.s3_bucket + "/" + key
] ]
if common.os_family == "windows": if common.os_family == "windows":
ret = utils.cmd(*args, verbose=True) upload = utils.cmd(*args, verbose=True)
else: else:
ret = utils.sh(" ".join(args), verbose=True) upload = utils.sh(" ".join(args), verbose=True)
if ret and ptype is not None: ret &= upload
if upload and ptype is not None:
full_key = key full_key = key
if full_key.endswith("/"): full_key += utils.get_basename(file) if full_key.endswith("/"): full_key += utils.get_basename(file)
utils.add_deploy_data( utils.add_deploy_data(
@ -400,13 +404,12 @@ def make_advinst():
def make_macos(): def make_macos():
global package_name, build_dir, branding_dir, updates_dir, changes_dir, \ global package_name, build_dir, branding_dir, updates_dir, changes_dir, \
update_changes_list, suffix, lane, scheme, key_prefix suffix, lane, scheme, app_version
package_name = branding.desktop_package_name package_name = branding.desktop_package_name
build_dir = branding.desktop_build_dir build_dir = branding.desktop_build_dir
branding_dir = branding.desktop_branding_dir branding_dir = branding.desktop_branding_dir
updates_dir = branding.desktop_updates_dir updates_dir = branding.desktop_updates_dir
changes_dir = branding.desktop_changes_dir changes_dir = branding.desktop_changes_dir
update_changes_list = branding.desktop_update_changes_list
suffix = { suffix = {
"darwin_x86_64": "x86_64", "darwin_x86_64": "x86_64",
"darwin_x86_64_v8": "v8", "darwin_x86_64_v8": "v8",
@ -430,15 +433,16 @@ def make_macos():
current_build = utils.sh_output( current_build = utils.sh_output(
'/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ' + plist_path, '/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ' + plist_path,
verbose=True).rstrip() verbose=True).rstrip()
app_version = current_version
appcast_url = branding.sparkle_base_url + "/" + suffix + "/" + branding.desktop_package_name.lower() + ".xml" appcast_url = branding.sparkle_base_url + "/" + suffix + "/" + branding.desktop_package_name.lower() + ".xml"
release_version = utils.sh_output( release_version = utils.sh_output(
'curl -s ' + appcast_url + ' 2> /dev/null' \ 'curl -Ls ' + appcast_url + ' 2> /dev/null' \
+ ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:shortVersionString\']" -' \ + ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:shortVersionString\']" -' \
+ ' | cut -f2 -d\\\"', + ' | cut -f2 -d\\\"',
verbose=True).rstrip() verbose=True).rstrip()
release_build = utils.sh_output( release_build = utils.sh_output(
'curl -s ' + appcast_url + ' 2> /dev/null' \ 'curl -Ls ' + appcast_url + ' 2> /dev/null' \
+ ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:version\']" -' \ + ' | xmllint --xpath "/rss/channel/item[1]/enclosure/@*[name()=\'sparkle:version\']" -' \
+ ' | cut -f2 -d\\\"', + ' | cut -f2 -d\\\"',
verbose=True).rstrip() verbose=True).rstrip()
@ -446,11 +450,12 @@ def make_macos():
utils.log("CURRENT=" + current_version + "(" + current_build + ")" \ utils.log("CURRENT=" + current_version + "(" + current_build + ")" \
+ "\nRELEASE=" + release_version + "(" + release_build + ")") + "\nRELEASE=" + release_version + "(" + release_build + ")")
make_dmg() dmg = make_dmg()
if int(current_build) > int(release_build): if dmg:
make_sparkle_updates() if int(current_build) > int(release_build):
else: make_sparkle_updates()
utils.log(release_build + " <= " + current_build) else:
utils.log(release_build + " <= " + current_build)
utils.set_cwd(common.workspace_dir) utils.set_cwd(common.workspace_dir)
return return
@ -459,13 +464,13 @@ def make_dmg():
utils.log_h2("desktop dmg build") utils.log_h2("desktop dmg build")
utils.log_h3(scheme) utils.log_h3(scheme)
utils.log_h3("build/" + package_name + ".app") utils.log_h3("build/" + package_name + ".app")
ret = utils.sh( dmg = utils.sh(
"bundler exec fastlane " + lane + " skip_git_bump:true", "bundler exec fastlane " + lane + " skip_git_bump:true",
verbose=True verbose=True
) )
utils.set_summary("desktop dmg build", ret) utils.set_summary("desktop dmg build", dmg)
if common.deploy and ret: if common.deploy and dmg:
utils.log_h2("desktop dmg deploy") utils.log_h2("desktop dmg deploy")
ret = aws_s3_upload( ret = aws_s3_upload(
utils.glob_path("build/*.dmg"), utils.glob_path("build/*.dmg"),
@ -473,86 +478,74 @@ def make_dmg():
"Disk Image" "Disk Image"
) )
utils.set_summary("desktop dmg deploy", ret) utils.set_summary("desktop dmg deploy", ret)
return
utils.log_h2("desktop zip deploy")
ret = aws_s3_upload(
["build/%s-%s.zip" % (scheme, app_version)],
"mac/%s/%s/%s/" % (suffix, common.version, common.build),
"Archive"
)
utils.set_summary("desktop zip deploy", ret)
return dmg
def make_sparkle_updates(): def make_sparkle_updates():
utils.log_h2("desktop sparkle files build") utils.log_h2("desktop sparkle files build")
app_version = utils.sh_output("/usr/libexec/PlistBuddy \
-c 'Print :CFBundleShortVersionString' \
build/" + package_name + ".app/Contents/Info.plist", verbose=True).rstrip()
zip_filename = scheme + '-' + app_version zip_filename = scheme + '-' + app_version
macos_zip = "build/" + zip_filename + ".zip" macos_zip = "build/" + zip_filename + ".zip"
updates_storage_dir = "%s/%s/_updates" % (utils.get_env('ARCHIVES_DIR'), scheme) updates_storage_dir = "%s/%s/_updates" % (utils.get_env('ARCHIVES_DIR'), scheme)
utils.create_dir(updates_dir) utils.create_dir(updates_dir)
utils.copy_dir_content(updates_storage_dir, updates_dir, ".zip")
# utils.copy_dir_content(updates_storage_dir, updates_dir, ".html")
utils.copy_file(macos_zip, updates_dir) utils.copy_file(macos_zip, updates_dir)
utils.copy_dir_content(updates_storage_dir, updates_dir, ".zip")
utils.copy_file(
changes_dir + "/" + app_version + "/ReleaseNotes.html",
updates_dir + "/" + zip_filename + ".html"
)
utils.copy_file(
changes_dir + "/" + app_version + "/ReleaseNotesRU.html",
updates_dir + "/" + zip_filename + ".ru.html"
)
if "en" in update_changes_list: sparkle_base_url = "%s/%s/updates/" % (branding.sparkle_base_url, suffix)
notes_sret = "%s/%s/%s.html" % (changes_dir, app_version, update_changes_list["en"]) ret = utils.sh(
notes_dst = "%s/%s.html" % (updates_dir, zip_filename) common.workspace_dir \
if utils.is_file(notes_src):
utils.copy_file(notes_src, notes_dst)
cur_date = utils.sh_output("env LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"", verbose=True)
utils.replace_in_file(notes_dst,
r"(<span class=\"releasedate\">).+(</span>)",
"\\1 - " + cur_date + "\\2")
else:
utils.write_file(notes_dst, '<html><head></head><body></body></html>\n')
if "ru" in update_changes_list:
notes_sret = "%s/%s/%s.html" % (changes_dir, app_version, update_changes_list["ru"])
if update_changes_list["ru"] != "ReleaseNotes":
notes_dst = "%s/%s.ru.html" % (updates_dir, zip_filename)
else:
notes_dst = "%s/%s.html" % (updates_dir, zip_filename)
if utils.is_file(notes_src):
utils.copy_file(notes_src, notes_dst)
cur_date = utils.sh_output("env LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"", verbose=True)
utils.replace_in_file(notes_dst,
r"(<span class=\"releasedate\">).+(</span>)",
"\\1 - " + cur_date + "\\2")
else:
utils.write_file(notes_dst, '<html><head></head><body></body></html>\n')
sparkle_download_url = "%s/%s/updates/" % (branding.sparkle_base_url, suffix)
sparkle_release_notes_url = "%s/%s/updates/changes/%s/" % (branding.sparkle_base_url, suffix, app_version)
utils.sh(common.workspace_dir \
+ "/desktop-apps/macos/Vendor/Sparkle/bin/generate_appcast " \ + "/desktop-apps/macos/Vendor/Sparkle/bin/generate_appcast " \
+ updates_dir \ + updates_dir \
+ " --download-url-prefix " + sparkle_download_url \ + " --download-url-prefix " + sparkle_base_url \
+ " --release-notes-url-prefix " + sparkle_release_notes_url) + " --release-notes-url-prefix " + sparkle_base_url \
+ " 2>&1 | grep -v xar_prop_serializable",
verbose=True
)
utils.set_summary("desktop sparkle files build", ret)
utils.log_h3("edit sparkle appcast links") # utils.log_h3("edit sparkle appcast links")
appcast_url = branding.sparkle_base_url + "/" + suffix # appcast_url = branding.sparkle_base_url + "/" + suffix
appcast = "%s/%s.xml" % (updates_dir, package_name.lower()) # appcast = "%s/%s.xml" % (updates_dir, package_name.lower())
# for lang, base in update_changes_list.items():
for lang, base in update_changes_list.items(): # if base == "ReleaseNotes":
if base == "ReleaseNotes": # utils.replace_in_file(appcast,
utils.replace_in_file(appcast, # r'(<sparkle:releaseNotesLink>.+/).+(\.html</sparkle:releaseNotesLink>)',
r'(<sparkle:releaseNotesLink>.+/).+(\.html</sparkle:releaseNotesLink>)', # "\\1" + base + "\\2")
"\\1" + base + "\\2") # else:
else: # utils.replace_in_file(appcast,
utils.replace_in_file(appcast, # r'(<sparkle:releaseNotesLink xml:lang="' + lang + r'">).+(\.html</sparkle:releaseNotesLink>)',
r'(<sparkle:releaseNotesLink xml:lang="' + lang + r'">).+(\.html</sparkle:releaseNotesLink>)', # "\\1" + base + "\\2")
"\\1" + base + "\\2")
utils.log_h3("delete unnecessary files")
for file in os.listdir(updates_dir):
if (-1 == file.find(app_version)) and (file.endswith(".zip") or
file.endswith(".html")):
utils.delete_file(updates_dir + '/' + file)
utils.log("")
utils.log_h3("generate checksums") utils.log_h3("generate checksums")
utils.sh("md5 *.zip *.delta > md5sums.txt", chdir="build/update", verbose=True) utils.sh(
utils.sh("shasum -a 256 *.zip *.delta > sha256sums.txt", chdir="build/update", verbose=True) "md5 *.zip *.delta > md5sums.txt",
chdir="build/update", verbose=True
)
utils.sh(
"shasum -a 256 *.zip *.delta > sha256sums.txt",
chdir="build/update", verbose=True
)
if common.deploy: if common.deploy:
utils.log_h2("desktop sparkle files deploy") utils.log_h2("desktop sparkle files deploy")
ret = aws_s3_upload( ret = aws_s3_upload(
[macos_zip] \ utils.glob_path("build/update/*.delta") \
+ utils.glob_path("build/update/*.delta") \
+ utils.glob_path("build/update/*.xml") \ + utils.glob_path("build/update/*.xml") \
+ utils.glob_path("build/update/*.html"), + utils.glob_path("build/update/*.html"),
"mac/%s/%s/%s/" % (suffix, common.version, common.build), "mac/%s/%s/%s/" % (suffix, common.version, common.build),
@ -576,15 +569,13 @@ def make_sparkle_updates():
def make_linux(): def make_linux():
utils.set_cwd("desktop-apps/win-linux/package/linux") utils.set_cwd("desktop-apps/win-linux/package/linux")
ret = utils.sh("make clean", verbose=True) utils.log_h2("desktop build")
utils.set_summary("desktop clean", ret) make_args = branding.desktop_make_targets
args = []
if common.platform == "linux_aarch64": if common.platform == "linux_aarch64":
args += ["-e", "UNAME_M=aarch64"] make_args += ["-e", "UNAME_M=aarch64"]
if not branding.onlyoffice: if not branding.onlyoffice:
args += ["-e", "BRANDING_DIR=../../../../" + common.branding + "/desktop-apps/win-linux/package/linux"] make_args += ["-e", "BRANDING_DIR=../../../../" + common.branding + "/desktop-apps/win-linux/package/linux"]
ret = utils.sh("make packages " + " ".join(args), verbose=True) ret = utils.sh("make clean && make " + " ".join(make_args), verbose=True)
utils.set_summary("desktop build", ret) utils.set_summary("desktop build", ret)
rpm_arch = "x86_64" rpm_arch = "x86_64"
@ -594,58 +585,22 @@ def make_linux():
utils.log_h2("desktop deploy") utils.log_h2("desktop deploy")
if ret: if ret:
utils.log_h2("desktop tar deploy") utils.log_h2("desktop tar deploy")
ret = aws_s3_upload( if "tar" in branding.desktop_make_targets:
utils.glob_path("tar/*.tar.gz") + utils.glob_path("tar/*.tar.xz"), ret = aws_s3_upload(
"linux/generic/%s/" % common.channel, utils.glob_path("tar/*.tar.gz") + utils.glob_path("tar/*.tar.xz"),
"Portable" "linux/generic/%s/" % common.channel,
) "Portable"
utils.set_summary("desktop tar deploy", ret) )
utils.set_summary("desktop tar deploy", ret)
utils.log_h2("desktop deb deploy") if "deb" in branding.desktop_make_targets:
ret = aws_s3_upload( utils.log_h2("desktop deb deploy")
utils.glob_path("deb/*.deb"), ret = aws_s3_upload(
"linux/debian/%s/" % common.channel, utils.glob_path("deb/*.deb"),
"Debian" "linux/debian/%s/" % common.channel,
) "Debian"
utils.set_summary("desktop deb deploy", ret) )
utils.set_summary("desktop deb deploy", ret)
utils.log_h2("desktop rpm deploy") if "deb-astra" in branding.desktop_make_targets:
ret = aws_s3_upload(
utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("rpm/builddir/RPMS/noarch/*.rpm"),
"linux/rhel/%s/" % common.channel,
"CentOS"
)
utils.set_summary("desktop rpm deploy", ret)
utils.log_h2("desktop rpm-apt deploy")
ret = aws_s3_upload(
utils.glob_path("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("apt-rpm/builddir/RPMS/noarch/*.rpm"),
"linux/altlinux/%s/" % common.channel,
"ALT Linux"
)
utils.set_summary("desktop rpm-apt deploy", ret)
utils.log_h2("desktop urpmi deploy")
ret = aws_s3_upload(
utils.glob_path("urpmi/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("urpmi/builddir/RPMS/noarch/*.rpm"),
"linux/rosa/%s/" % common.channel,
"ROSA"
)
utils.set_summary("desktop urpmi deploy", ret)
utils.log_h2("desktop rpm-suse deploy")
ret = aws_s3_upload(
utils.glob_path("suse-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("suse-rpm/builddir/RPMS/noarch/*.rpm"),
"linux/suse/%s/" % common.channel,
"SUSE Linux"
)
utils.set_summary("desktop rpm-suse deploy", ret)
if not branding.onlyoffice:
utils.log_h2("desktop deb-astra deploy") utils.log_h2("desktop deb-astra deploy")
ret = aws_s3_upload( ret = aws_s3_upload(
utils.glob_path("deb-astra/*.deb"), utils.glob_path("deb-astra/*.deb"),
@ -653,15 +608,57 @@ def make_linux():
"Astra Linux Signed" "Astra Linux Signed"
) )
utils.set_summary("desktop deb-astra deploy", ret) utils.set_summary("desktop deb-astra deploy", ret)
if "rpm" in branding.desktop_make_targets:
utils.log_h2("desktop rpm deploy")
ret = aws_s3_upload(
utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("rpm/builddir/RPMS/noarch/*.rpm"),
"linux/rhel/%s/" % common.channel,
"CentOS"
)
utils.set_summary("desktop rpm deploy", ret)
if "suse-rpm" in branding.desktop_make_targets:
utils.log_h2("desktop suse-rpm deploy")
ret = aws_s3_upload(
utils.glob_path("suse-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("suse-rpm/builddir/RPMS/noarch/*.rpm"),
"linux/suse/%s/" % common.channel,
"SUSE Linux"
)
utils.set_summary("desktop suse-rpm deploy", ret)
if "apt-rpm" in branding.desktop_make_targets:
utils.log_h2("desktop apt-rpm deploy")
ret = aws_s3_upload(
utils.glob_path("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("apt-rpm/builddir/RPMS/noarch/*.rpm"),
"linux/altlinux/%s/" % common.channel,
"ALT Linux"
)
utils.set_summary("desktop apt-rpm deploy", ret)
if "urpmi" in branding.desktop_make_targets:
utils.log_h2("desktop urpmi deploy")
ret = aws_s3_upload(
utils.glob_path("urpmi/builddir/RPMS/" + rpm_arch + "/*.rpm") \
+ utils.glob_path("urpmi/builddir/RPMS/noarch/*.rpm"),
"linux/rosa/%s/" % common.channel,
"ROSA"
)
utils.set_summary("desktop urpmi deploy", ret)
else: else:
utils.set_summary("desktop tar deploy", False) if "tar" in branding.desktop_make_targets:
utils.set_summary("desktop deb deploy", False) utils.set_summary("desktop tar deploy", False)
utils.set_summary("desktop rpm deploy", False) if "deb" in branding.desktop_make_targets:
utils.set_summary("desktop rpm-apt deploy", False) utils.set_summary("desktop deb deploy", False)
utils.set_summary("desktop urpmi deploy", False) if "deb-astra" in branding.desktop_make_targets:
utils.set_summary("desktop rpm-suse deploy", False)
if not branding.onlyoffice:
utils.set_summary("desktop deb-astra deploy", False) utils.set_summary("desktop deb-astra deploy", False)
if "rpm" in branding.desktop_make_targets:
utils.set_summary("desktop rpm deploy", False)
if "suse-rpm" in branding.desktop_make_targets:
utils.set_summary("desktop suse-rpm deploy", False)
if "apt-rpm" in branding.desktop_make_targets:
utils.set_summary("desktop apt-rpm deploy", False)
if "urpmi" in branding.desktop_make_targets:
utils.set_summary("desktop urpmi deploy", False)
utils.set_cwd(common.workspace_dir) utils.set_cwd(common.workspace_dir)
return return

View File

@ -15,6 +15,9 @@ def make(edition):
return return
def aws_s3_upload(files, key, edition, ptype=None): def aws_s3_upload(files, key, edition, ptype=None):
if not files:
return False
ret = True
key = "server/" + key key = "server/" + key
for file in files: for file in files:
args = ["aws"] args = ["aws"]
@ -25,10 +28,11 @@ def aws_s3_upload(files, key, edition, ptype=None):
file, "s3://" + branding.s3_bucket + "/" + key file, "s3://" + branding.s3_bucket + "/" + key
] ]
if common.os_family == "windows": if common.os_family == "windows":
ret = utils.cmd(*args, verbose=True) upload = utils.cmd(*args, verbose=True)
else: else:
ret = utils.sh(" ".join(args), verbose=True) upload = utils.sh(" ".join(args), verbose=True)
if ret and ptype is not None: ret &= upload
if upload and ptype is not None:
full_key = key full_key = key
if full_key.endswith("/"): full_key += utils.get_basename(file) if full_key.endswith("/"): full_key += utils.get_basename(file)
utils.add_deploy_data( utils.add_deploy_data(
@ -77,12 +81,12 @@ def make_linux(edition):
utils.set_cwd("document-server-package") utils.set_cwd("document-server-package")
utils.log_h2("server " + edition + " build") utils.log_h2("server " + edition + " build")
args = ["-e", "PRODUCT_NAME=" + product_name] make_args = branding.server_make_targets + ["-e", "PRODUCT_NAME=" + product_name]
if common.platform == "linux_aarch64": if common.platform == "linux_aarch64":
args += ["-e", "UNAME_M=aarch64"] make_args += ["-e", "UNAME_M=aarch64"]
if not branding.onlyoffice: if not branding.onlyoffice:
args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-server-package"] make_args += ["-e", "BRANDING_DIR=../" + common.branding + "/document-server-package"]
ret = utils.sh("make clean && make packages " + " ".join(args), verbose=True) ret = utils.sh("make clean && make " + " ".join(make_args), verbose=True)
utils.set_summary("server " + edition + " build", ret) utils.set_summary("server " + edition + " build", ret)
rpm_arch = "x86_64" rpm_arch = "x86_64"
@ -91,46 +95,51 @@ def make_linux(edition):
if common.deploy: if common.deploy:
utils.log_h2("server " + edition + " deploy") utils.log_h2("server " + edition + " deploy")
if ret: if ret:
utils.log_h2("server " + edition + " tar deploy") if "deb" in branding.server_make_targets:
ret = aws_s3_upload( utils.log_h2("server " + edition + " deb deploy")
utils.glob_path("*.tar.gz"), ret = aws_s3_upload(
"linux/generic/%s/" % common.channel, utils.glob_path("deb/*.deb"),
edition, "linux/debian/%s/" % common.channel,
"Portable" edition,
) "Debian"
utils.set_summary("server " + edition + " tar deploy", ret) )
utils.set_summary("server " + edition + " deb deploy", ret)
utils.log_h2("server " + edition + " deb deploy") if "rpm" in branding.server_make_targets:
ret = aws_s3_upload( utils.log_h2("server " + edition + " rpm deploy")
utils.glob_path("deb/*.deb"), ret = aws_s3_upload(
"linux/debian/%s/" % common.channel, utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"),
edition, "linux/rhel/%s/" % common.channel,
"Debian" edition,
) "CentOS"
utils.set_summary("server " + edition + " deb deploy", ret) )
utils.set_summary("server " + edition + " rpm deploy", ret)
utils.log_h2("server " + edition + " rpm deploy") if "apt-rpm" in branding.server_make_targets:
ret = aws_s3_upload( utils.log_h2("server " + edition + " apt-rpm deploy")
utils.glob_path("rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"), ret = aws_s3_upload(
"linux/rhel/%s/" % common.channel, utils.glob_path("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"),
edition, "linux/altlinux/%s/" % common.channel,
"CentOS" edition,
) "ALT Linux"
utils.set_summary("server " + edition + " rpm deploy", ret) )
utils.set_summary("server " + edition + " apt-rpm deploy", ret)
utils.log_h2("server " + edition + " apt-rpm deploy") if "tar" in branding.server_make_targets:
ret = aws_s3_upload( utils.log_h2("server " + edition + " snap deploy")
utils.glob_path("apt-rpm/builddir/RPMS/" + rpm_arch + "/*.rpm"), ret = aws_s3_upload(
"linux/altlinux/%s/" % common.channel, utils.glob_path("*.tar.gz"),
edition, "linux/generic/%s/" % common.channel,
"ALT Linux" edition,
) "Snap"
utils.set_summary("server " + edition + " apt-rpm deploy", ret) )
utils.set_summary("server " + edition + " snap deploy", ret)
else: else:
utils.set_summary("server " + edition + " tar deploy", False) if "deb" in branding.server_make_targets:
utils.set_summary("server " + edition + " deb deploy", False) utils.set_summary("server " + edition + " deb deploy", False)
utils.set_summary("server " + edition + " rpm deploy", False) if "rpm" in branding.server_make_targets:
utils.set_summary("server " + edition + " rpm-alt deploy", False) utils.set_summary("server " + edition + " rpm deploy", False)
if "apt-rpm" in branding.server_make_targets:
utils.set_summary("server " + edition + " apt-rpm deploy", False)
if "tar" in branding.server_make_targets:
utils.set_summary("server " + edition + " snap deploy", False)
utils.set_cwd(common.workspace_dir) utils.set_cwd(common.workspace_dir)
return return

View File

@ -360,7 +360,18 @@ def sh(command, **kwargs):
log(" chdir: " + kwargs["chdir"]) log(" chdir: " + kwargs["chdir"])
if kwargs.get("creates"): if kwargs.get("creates"):
log(" creates: " + kwargs["creates"]) log(" creates: " + kwargs["creates"])
return subprocess.call(command, stderr=subprocess.STDOUT, shell=True) == 0 if kwargs.get("creates") and is_exist(kwargs["creates"]):
log_err("creates exist")
return False
if kwargs.get("chdir") and is_dir(kwargs["chdir"]):
oldcwd = get_cwd()
set_cwd(kwargs["chdir"])
ret = subprocess.call(
command, stderr=subprocess.STDOUT, shell=True
) == 0
if kwargs.get("chdir") and oldcwd:
set_cwd(oldcwd)
return ret
def sh_output(command, **kwargs): def sh_output(command, **kwargs):
if kwargs.get("verbose"): if kwargs.get("verbose"):