mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Switch appcast templates to awk (#286)
* Switch m4 to awk * Update makefile * Fix css * Small fix * Fix dates
This commit is contained in:
@ -27,10 +27,10 @@ VCREDIST += $(VCREDIST13)
|
||||
endif
|
||||
VCREDIST += $(VCREDIST15)
|
||||
|
||||
BUILD_TIMESTAMP = $(shell date +%s)
|
||||
APPCAST := win-linux/package/windows/update/appcast.xml
|
||||
CHANGES_EN := win-linux/package/windows/update/changes.html
|
||||
CHANGES_RU := win-linux/package/windows/update/changes_ru.html
|
||||
CHANGES_DIR := $(BRANDING_DIR)/win-linux/package/windows/update/changes/$(PRODUCT_VERSION)
|
||||
DEPLOY_JSON := win-linux/package/windows/deploy.json
|
||||
|
||||
EXE_URI := $(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/windows/$(notdir $(DESKTOP_EDITORS_EXE))
|
||||
@ -190,19 +190,19 @@ endif
|
||||
|
||||
deploy: $(DEPLOY) $(DEPLOY_JSON)
|
||||
|
||||
M4_PARAMS += -D M4_COMPANY_NAME="$(COMPANY_NAME)"
|
||||
M4_PARAMS += -D M4_PRODUCT_NAME="$(PRODUCT_NAME)"
|
||||
M4_PARAMS += -D M4_PACKAGE_VERSION="$(PACKAGE_VERSION)"
|
||||
M4_PARAMS += -D M4_BUILD_TIMESTAMP="$(shell date +%s)"
|
||||
AWK_PARAMS += -v Version="$(PRODUCT_VERSION)"
|
||||
AWK_PARAMS += -v Build="$(BUILD_NUMBER)"
|
||||
AWK_PARAMS += -v Timestamp="$(shell date +%s)"
|
||||
AWK_PARAMS += -i "$(BRANDING_DIR)/win-linux/package/windows/update/branding.awk"
|
||||
|
||||
$(APPCAST):
|
||||
m4 $(M4_PARAMS) $(BRANDING_DIR)/win-linux/package/windows/update/appcast.xml.m4 > $@
|
||||
%/appcast.xml: %/appcast.xml.awk
|
||||
LANG=en_US.UTF-8 \
|
||||
awk $(AWK_PARAMS) -f $< > $@
|
||||
|
||||
$(CHANGES_EN): L10N=en
|
||||
$(CHANGES_RU): L10N=ru
|
||||
%/changes.html: %/changes.html.awk
|
||||
LANG=en_US.UTF-8 \
|
||||
awk $(AWK_PARAMS) -f $< "$(CHANGES_DIR)/en.html" > $@
|
||||
|
||||
$(CHANGES_EN) $(CHANGES_RU):
|
||||
m4 $(M4_PARAMS) -D L10N="$(L10N)" $(BRANDING_DIR)/win-linux/package/windows/update/changes.html.m4 > $@
|
||||
|
||||
% : %.m4
|
||||
m4 $(M4_PARAMS) $< > $@
|
||||
%/changes_ru.html: %/changes.html.awk
|
||||
LANG=ru_RU.UTF-8 \
|
||||
awk $(AWK_PARAMS) -f $< "$(CHANGES_DIR)/ru.html" > $@
|
||||
|
||||
55
win-linux/package/windows/update/appcast.xml.awk
Normal file
55
win-linux/package/windows/update/appcast.xml.awk
Normal file
@ -0,0 +1,55 @@
|
||||
BEGIN {
|
||||
Title = AppcastProductTitle " Changelog";
|
||||
PubDate = strftime("%a, %e %b %Y %H:%M:%S %z", Timestamp, "0");
|
||||
SparkleVersion = Version "." Build;
|
||||
|
||||
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
print "<rss version=\"2.0\"" \
|
||||
" xmlns:sparkle=\"http://www.andymatuschak.org/xml-namespaces/sparkle\"" \
|
||||
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";
|
||||
print " <channel>";
|
||||
print " <title>" Title "</title>";
|
||||
print " <description>Most recent changes with links to updates." \
|
||||
"</description>";
|
||||
print " <language>en</language>";
|
||||
print " <item>";
|
||||
|
||||
print " <title>Version " Version "</title>";
|
||||
print " <sparkle:releaseNotesLink>" \
|
||||
AppcastChangesPath "/changes.html</sparkle:releaseNotesLink>";
|
||||
if (onlyoffice)
|
||||
print " <sparkle:releaseNotesLink xml:lang=\"ru-RU\">" \
|
||||
AppcastChangesPath "/changes_ru.html</sparkle:releaseNotesLink>";
|
||||
print " <pubDate>" PubDate "</pubDate>";
|
||||
print " <enclosure" \
|
||||
" url=\"" AppcastUpdatesPath "/editors_update_x64.exe\"" \
|
||||
" sparkle:os=\"windows-x64\"" \
|
||||
" sparkle:version=\"" SparkleVersion "\"" \
|
||||
" sparkle:shortVersionString=\"" SparkleVersion "\"" \
|
||||
" sparkle:installerArguments=\"/silent /update\"" \
|
||||
" length=\"0\"" \
|
||||
" type=\"application/octet-stream\" />";
|
||||
|
||||
print " </item>";
|
||||
print " <item>";
|
||||
|
||||
print " <title>Version " Version "</title>";
|
||||
print " <sparkle:releaseNotesLink>" \
|
||||
AppcastChangesPath "/changes.html</sparkle:releaseNotesLink>";
|
||||
if (onlyoffice)
|
||||
print " <sparkle:releaseNotesLink xml:lang=\"ru-RU\">" \
|
||||
AppcastChangesPath "/changes_ru.html</sparkle:releaseNotesLink>";
|
||||
print " <pubDate>" PubDate "</pubDate>";
|
||||
print " <enclosure" \
|
||||
" url=\"" AppcastUpdatesPath "/editors_update_x86.exe\"" \
|
||||
" sparkle:os=\"windows-x86\"" \
|
||||
" sparkle:version=\"" SparkleVersion "\"" \
|
||||
" sparkle:shortVersionString=\"" SparkleVersion "\"" \
|
||||
" sparkle:installerArguments=\"/silent /update\"" \
|
||||
" length=\"0\"" \
|
||||
" type=\"application/octet-stream\" />";
|
||||
|
||||
print " </item>";
|
||||
print " </channel>";
|
||||
print "</rss>";
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
changequote()changequote(`,`)dnl
|
||||
define(`APPCAST_TITLE`,format(`%s Changelog`,M4_COMPANY_NAME M4_PRODUCT_NAME))dnl
|
||||
define(`APPCAST_DESCRIPTION`,`Most recent changes with links to updates.`)dnl
|
||||
define(`APPCAST_VERSION`,M4_PACKAGE_VERSION)dnl
|
||||
define(`APPCAST_ITEM_TITLE`,format(`Version %s`,patsubst(M4_PACKAGE_VERSION,`\(\.\w+\)$`)))dnl
|
||||
define(`APPCAST_PUBDATE`,esyscmd(echo -n $(LANG=en_US date -u -d @M4_BUILD_TIMESTAMP "+%b %e %Y")))dnl
|
||||
define(`APPCAST_LINK_CHANGES_EN`,`http://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/changes/changes.html`)dnl
|
||||
define(`APPCAST_LINK_CHANGES_RU`,`http://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/changes/changes_ru.html`)dnl
|
||||
define(`APPCAST_LINK_EXE_64`,`http://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/updates/editors_update_x64.exe`)dnl
|
||||
define(`APPCAST_LINK_EXE_32`,`http://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice/updates/editors_update_x86.exe`)dnl
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title>APPCAST_TITLE</title>
|
||||
<description>APPCAST_DESCRIPTION</description>
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>APPCAST_ITEM_TITLE</title>
|
||||
<pubDate>APPCAST_PUBDATE</pubDate>
|
||||
<sparkle:releaseNotesLink>APPCAST_LINK_CHANGES_EN</sparkle:releaseNotesLink>
|
||||
<sparkle:releaseNotesLink xml:lang="ru-RU">APPCAST_LINK_CHANGES_RU</sparkle:releaseNotesLink>
|
||||
<enclosure sparkle:os="windows-x64" sparkle:version="APPCAST_VERSION" sparkle:shortVersionString="APPCAST_VERSION" url="APPCAST_LINK_EXE_64" length="0" type="application/octet-stream" sparkle:installerArguments="/silent /update"/>
|
||||
</item>
|
||||
<item>
|
||||
<title>APPCAST_ITEM_TITLE</title>
|
||||
<pubDate>APPCAST_PUBDATE</pubDate>
|
||||
<sparkle:releaseNotesLink>APPCAST_LINK_CHANGES_EN</sparkle:releaseNotesLink>
|
||||
<sparkle:releaseNotesLink xml:lang="ru-RU">APPCAST_LINK_CHANGES_RU</sparkle:releaseNotesLink>
|
||||
<enclosure sparkle:os="windows-x86" sparkle:version="APPCAST_VERSION" sparkle:shortVersionString="APPCAST_VERSION" url="APPCAST_LINK_EXE_32" length="0" type="application/octet-stream" sparkle:installerArguments="/silent /update"/>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
15
win-linux/package/windows/update/branding.awk
Normal file
15
win-linux/package/windows/update/branding.awk
Normal file
@ -0,0 +1,15 @@
|
||||
BEGIN {
|
||||
onlyoffice = "1";
|
||||
|
||||
# Appcast Vars
|
||||
AppcastProductTitle = "ONLYOFFICE Desktop Editors";
|
||||
AppcastBaseUrl = "https://download.onlyoffice.com/install/desktop/editors/windows/onlyoffice";
|
||||
AppcastChangesPath = AppcastBaseUrl "/changes";
|
||||
AppcastUpdatesPath = AppcastBaseUrl "/updates";
|
||||
|
||||
# Changes Vars
|
||||
ChangesProductTitle = "ONLYOFFICE Desktop Editors";
|
||||
ChangesProductHeading = "ONLYOFFICE Desktop Editors";
|
||||
ChangesMoreUrl = "https://github.com/ONLYOFFICE/DesktopEditors/blob/master/" \
|
||||
"CHANGELOG.md#" gensub(/\./, "", "g", Version);
|
||||
}
|
||||
78
win-linux/package/windows/update/changes.html.awk
Normal file
78
win-linux/package/windows/update/changes.html.awk
Normal file
@ -0,0 +1,78 @@
|
||||
BEGIN {
|
||||
if (Lang == "") Lang = ENVIRON["LANG"];
|
||||
if (Lang == "en_US.UTF-8") {
|
||||
Title = ChangesProductTitle " Release Notes";
|
||||
ReleaseDate = strftime("%B %e, %Y", Timestamp, "0");
|
||||
More = "and a little more...";
|
||||
}
|
||||
else if (Lang == "ru_RU.UTF-8") {
|
||||
Title = "История изменений " ChangesProductTitle;
|
||||
ReleaseDate = strftime("%e %B %Y", Timestamp, "0");
|
||||
More = "и многое другое...";
|
||||
}
|
||||
|
||||
print "<!DOCTYPE html>";
|
||||
print "<html>";
|
||||
print "<head>";
|
||||
print " <meta charset=\"utf-8\">";
|
||||
print " <title>" Title "</title>";
|
||||
print " <style type=\"text/css\">";
|
||||
print " body {";
|
||||
print " background: white;";
|
||||
print " font: 12px \"Lucida Grande\"," \
|
||||
" \"Lucida Sans Unicode\", Verdana, Lucida, Helvetica, sans-serif;";
|
||||
print " }";
|
||||
print " h1, h2, h3 {";
|
||||
print " color: #000000;";
|
||||
print " font-family: \"Helvetica\";";
|
||||
print " font-weight: normal;";
|
||||
print " font-style: normal;";
|
||||
print " }";
|
||||
print " h1 {";
|
||||
print " font-size: 18px;";
|
||||
print " }";
|
||||
print " h2 {";
|
||||
print " font-size: 16px;";
|
||||
print " }";
|
||||
print " h3 {";
|
||||
print " font-size: 14px;";
|
||||
print " }";
|
||||
print " .releasedate {";
|
||||
print " color: #888;";
|
||||
print " font-size: medium;";
|
||||
print " }";
|
||||
print " .more {";
|
||||
print " margin-bottom: 20px;";
|
||||
print " }";
|
||||
print " .version {";
|
||||
print " border-bottom: 1px solid #cfcfcf;";
|
||||
print " }";
|
||||
print " </style>";
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
print " <div class=\"version\">";
|
||||
print " <h1>" ChangesProductHeading " " Version \
|
||||
"<span class=\"releasedate\"> - " ReleaseDate "</span></h1>";
|
||||
|
||||
# if (system("test -r " ARGV[1]) != 0) {
|
||||
# print " <p>empty</p>"
|
||||
# exit
|
||||
# }
|
||||
}
|
||||
BEGINFILE {
|
||||
if (ERRNO != "") {
|
||||
print " <p>" ERRNO "</p>";
|
||||
nextfile;
|
||||
}
|
||||
}
|
||||
{
|
||||
print " " $0;
|
||||
}
|
||||
END {
|
||||
if (onlyoffice)
|
||||
print " <div class=\"more\"><a href=\"" ChangesMoreUrl "\"" \
|
||||
" target=\"_blank\">" More "</a></div>";
|
||||
print " </div>";
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
changequote()changequote(`,`)dnl
|
||||
changecom(`<!--`,`-->`)dnl
|
||||
define(`CHANGES_TITLE[en]`,format(`%s Release Notes`,M4_COMPANY_NAME M4_PRODUCT_NAME))dnl
|
||||
define(`CHANGES_TITLE[ru]`,format(`История изменений %s`,M4_COMPANY_NAME M4_PRODUCT_NAME))dnl
|
||||
define(`CHANGES_VERSION`,patsubst(M4_PACKAGE_VERSION,`\(\.\w+\)$`))dnl
|
||||
define(`CHANGES_HEADING`,M4_COMPANY_NAME M4_PRODUCT_NAME CHANGES_VERSION)dnl
|
||||
define(`CHANGES_RELEASE_DATE[en]`,esyscmd(echo -n $(LANG=en_US.UTF-8 date -u -d @M4_BUILD_TIMESTAMP "+%b %e, %Y")))dnl
|
||||
define(`CHANGES_RELEASE_DATE[ru]`,esyscmd(echo -n $(LANG=ru_RU.UTF-8 date -u -d @M4_BUILD_TIMESTAMP "+%e %b %Y")))dnl
|
||||
define(`CHANGES_BODY_FILE`,esyscmd(echo -n $(dirname "__file__"))/changes/CHANGES_VERSION/L10N.html)dnl
|
||||
define(`CHANGES_BODY`,patsubst(sinclude(CHANGES_BODY_FILE),`^`,` `))dnl
|
||||
define(`CHANGES_MORE[en]`,`and a little more...`)dnl
|
||||
define(`CHANGES_MORE[ru]`,`и многое другое...`)dnl
|
||||
define(`CHANGES_LINK_CHANGELOG`,format(`https://github.com/ONLYOFFICE/DesktopEditors/blob/master/CHANGELOG.md#%s`,patsubst(CHANGES_VERSION,`\.`)))dnl
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>defn(CHANGES_TITLE[L10N])</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background:white;
|
||||
font: 12px "Lucida Grande", "Lucida Sans Unicode", Verdana, Lucida, Helvetica, sans-serif;
|
||||
}
|
||||
h1, h2, h3 {
|
||||
color: #000000;
|
||||
font-family: "Helvetica";
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
h1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 14px;
|
||||
}
|
||||
.releasedate {
|
||||
color: #888;
|
||||
font-size: medium;
|
||||
}
|
||||
.version {
|
||||
border-bottom: 1px solid #cfcfcf;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="version">
|
||||
<h1>CHANGES_HEADING<span class="releasedate"> - defn(CHANGES_RELEASE_DATE[L10N])</span></h1>
|
||||
CHANGES_BODY
|
||||
<div style="margin:0 0 20px 0;"><a href="CHANGES_LINK_CHANGELOG" target="_blank">defn(CHANGES_MORE[L10N])</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user