[Libreoffice-commits] core.git: 3 commits - bin/update Makefile.gbuild
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Aug 4 04:03:17 UTC 2017
Makefile.gbuild | 4 +++-
bin/update/common.sh | 17 +++++++++++++++++
bin/update/create_full_mar.py | 10 +++++-----
bin/update/make_full_update.sh | 1 +
bin/update/path.py | 19 ++++++++++++++++++-
bin/update/signing.py | 3 ++-
6 files changed, 46 insertions(+), 8 deletions(-)
New commits:
commit e4420db1a80fc53e23eafcd6b1dfe1aca293d60f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Aug 4 05:29:53 2017 +0200
updater: skip language packs for windows
Change-Id: I5707bc8d3827aa24a795e91a8851d12c81613cfc
Reviewed-on: https://gerrit.libreoffice.org/40756
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/Makefile.gbuild b/Makefile.gbuild
index 61df1425314a..a55bc5ffd4a7 100644
--- a/Makefile.gbuild
+++ b/Makefile.gbuild
@@ -34,7 +34,9 @@ create-update-info:
rm -rf $(UPDATE_DIR) || true
mkdir -p $(MAR_DIR)/language
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)"
- MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar_for_languages.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)"
+ $(if $(filter WNT,$(OS)),, \
+ MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar_for_languages.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)" \
+ )
upload-update-info:
$(eval BUILDID := $(shell git -C $(SRCDIR) log -1 --format=%H))
commit 1878dac5e1a839bd4c07cae0f85cf62dd7474e45
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Aug 4 05:11:58 2017 +0200
updater: handle windows path in cygwin correctly
This is a huge mess. Any windows executable does not understand
cygwin paths but for example the bash script only understands unix paths.
Additionally, os.path is unixpath so it is not able to correctly handle
windows paths. We therefore convert everything that we need to handle
to unix paths and only the few paths that are passed in the end to windows
executables back to the native format. We selected mixed mode
(windows path with forward slash) to allow the unix scripts to manipulate
paths.
Change-Id: Ic443415ff5e8277bf0bb8704bbafd35f50767288
Reviewed-on: https://gerrit.libreoffice.org/40755
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/bin/update/create_full_mar.py b/bin/update/create_full_mar.py
index 38919542d6a4..48686be21e45 100755
--- a/bin/update/create_full_mar.py
+++ b/bin/update/create_full_mar.py
@@ -8,9 +8,9 @@ import json
from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name
from config import parse_config
from signing import sign_mar_file
-from path import UpdaterPath
+from path import UpdaterPath, convert_to_unix, convert_to_native
-current_dir_path = os.path.dirname(os.path.realpath(__file__))
+current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__)))
def main():
if len(sys.argv) < 5:
@@ -34,14 +34,14 @@ def main():
config = parse_config(update_config)
- tar_dir = os.path.join(workdir, "installation", product_name, "archive", "install", "en-US")
+ tar_dir = os.path.join(update_path.get_workdir(), "installation", product_name, "archive", "install", "en-US")
tar_file = os.path.join(tar_dir, os.listdir(tar_dir)[0])
uncompress_dir = uncompress_file_to_dir(tar_file, temp_dir)
mar_file = make_complete_mar_name(target_dir, filename_prefix)
- subprocess.call([os.path.join(current_dir_path, 'make_full_update.sh'), mar_file, uncompress_dir])
-
+ path = os.path.join(current_dir_path, 'make_full_update.sh')
+ subprocess.call([path, convert_to_native(mar_file), convert_to_native(uncompress_dir)])
sign_mar_file(target_dir, config, mar_file, filename_prefix)
diff --git a/bin/update/path.py b/bin/update/path.py
index 1bc14d70d940..0fe0fd5eb04f 100644
--- a/bin/update/path.py
+++ b/bin/update/path.py
@@ -9,6 +9,8 @@
import os
import errno
+import subprocess
+from sys import platform
def mkdir_p(path):
try:
@@ -19,10 +21,22 @@ def mkdir_p(path):
else:
raise
+def convert_to_unix(path):
+ if platform == "cygwin":
+ return subprocess.check_output(["cygpath", "-u", path]).decode("utf-8", "strict").rstrip()
+ else:
+ return path
+
+def convert_to_native(path):
+ if platform == "cygwin":
+ return subprocess.check_output(["cygpath", "-m", path]).decode("utf-8", "strict").rstrip()
+ else:
+ return path
+
class UpdaterPath(object):
def __init__(self, workdir):
- self._workdir = workdir
+ self._workdir = convert_to_unix(workdir)
def get_workdir(self):
return self._workdir
@@ -41,6 +55,9 @@ class UpdaterPath(object):
def get_language_dir(self):
return os.path.join(self.get_mar_dir(), "language")
+
+ def get_workdir(self):
+ return self._workdir
def ensure_dir_exist(self):
mkdir_p(self.get_update_dir())
diff --git a/bin/update/signing.py b/bin/update/signing.py
index e6ac2832d844..c0b43ce91536 100644
--- a/bin/update/signing.py
+++ b/bin/update/signing.py
@@ -2,10 +2,11 @@ from tools import make_complete_mar_name
import os
import subprocess
+import path
def sign_mar_file(target_dir, config, mar_file, filename_prefix):
signed_mar_file = make_complete_mar_name(target_dir, filename_prefix + '_signed')
mar_executable = os.environ.get('MAR', 'mar')
- subprocess.check_call([mar_executable, '-C', target_dir, '-d', config.certificate_path, '-n', config.certificate_name, '-s', mar_file, signed_mar_file])
+ subprocess.check_call([mar_executable, '-C', path.convert_to_native(target_dir), '-d', path.convert_to_native(config.certificate_path), '-n', config.certificate_name, '-s', path.convert_to_native(mar_file), path.convert_to_native(signed_mar_file)])
os.rename(signed_mar_file, mar_file)
commit 954e4dc962374058e056b6682ff8ba33a2ecc9dc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Aug 3 23:14:55 2017 +0200
updater: check that access to mandatory externals is working
Change-Id: Ica68488f4e39c958a913936573cee67c1ff69175
Reviewed-on: https://gerrit.libreoffice.org/40754
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/bin/update/common.sh b/bin/update/common.sh
index eb358806fd04..5bba576c702c 100644
--- a/bin/update/common.sh
+++ b/bin/update/common.sh
@@ -26,6 +26,23 @@ get_file_size() {
echo ${info[4]}
}
+check_externals() {
+
+ # check whether we can call the mar executable
+ "$MAR" --version > /dev/null 2>&1
+ if [ $? != 0 ]; then
+ notice "Could not find a valid mar executable in the path or in the MAR environment variable"
+ exit 1
+ fi
+
+ # check whether we can access the bzip2 executable
+ "$BZIP2" --help > /dev/null 2>&1
+ if [ $? != 0 ]; then
+ notice "Could not find a valid bzip2 executable in the PATH or in the BZIP2 environment variable"
+ exit 1
+ fi
+}
+
copy_perm() {
reference="$1"
target="$2"
diff --git a/bin/update/make_full_update.sh b/bin/update/make_full_update.sh
index 2c0faef200f8..cb7de49b23d4 100755
--- a/bin/update/make_full_update.sh
+++ b/bin/update/make_full_update.sh
@@ -32,6 +32,7 @@ if [ $1 = -h ]; then
exit 1
fi
+check_externals
# -----------------------------------------------------------------------------
archive="$1"
More information about the Libreoffice-commits
mailing list