Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't auto upgrade ngeo version #3916

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ import-ngeo-apps: $(APPS_FILES) $(APPS_FILES_ALT)
.PRECIOUS: ngeo
ngeo:
$(PRERULE_CMD)
if [ ! -e "ngeo" ] ; then git clone --depth 1 --branch=$(shell VERSION=$(MAIN_BRANCH) npm-packages --version) https://github.com/camptocamp/ngeo.git ; fi
if [ ! -e "ngeo" ] ; then git clone --depth=100 --branch=$(shell VERSION=$(MAIN_BRANCH) npm-packages --branch) https://github.com/camptocamp/ngeo.git ; fi
git fetch origin
git reset --hard $(shell VERSION=$(MAIN_BRANCH) npm-packages --hash)
touch --no-create $@

.PRECIOUS: ngeo/contribs/gmf/apps/%/index.html.ejs
Expand Down Expand Up @@ -411,7 +413,7 @@ npm-packages: ngeo package.json

admin/npm-packages: ngeo package.json
$(PRERULE_CMD)
npm-packages --src=package.json --dst=$@
npm-packages ngeo --src=package.json --dst=$@

geoportal/package.json: ngeo/package.json
$(PRERULE_CMD)
Expand Down
31 changes: 16 additions & 15 deletions docker/build/bin/npm-packages
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@

import os
import re
import subprocess
from json import loads
import json
from argparse import ArgumentParser


Expand All @@ -57,44 +56,46 @@ def _ngeo_version():
return None


def _get_ngeo_version():
version = _ngeo_version()
if version is not None:
return version
return "https://api.github.com/repos/camptocamp/ngeo/tarball/{}".format(
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd="ngeo").decode("utf-8").strip()
)


def main():
"""
Extract npm packages
"""

parser = ArgumentParser(description='Extract npm packages')

parser.add_argument('--version', action="store_true", help="Get the ngeo version and exit")
parser.add_argument('--branch', action="store_true", help="Get the ngeo branch and exit")
parser.add_argument('--hash', action="store_true", help="Get the ngeo commit hash and exit")
parser.add_argument('--ngeo', action="store_true", help="Add ngeo package")
parser.add_argument('--src', action='append', default=[], metavar='SRC', help="The ngeo source file")
parser.add_argument('--dst', metavar='DST', help="The destination file")
parser.add_argument('excludes', nargs='*', metavar='EXCLUDE', help="The npm package to exclude")

args = parser.parse_args()

if args.version:
if args.branch:
version = _ngeo_version()
print(os.environ["VERSION"] if version is None else version)
exit(0)

if args.hash:
version = _ngeo_version()
if version is None:
with open("package.json") as package_file:
version = json.loads(package_file)["dependencies"]["ngeo"].split(".")[-2]
print(version)
exit(0)

packages = {}
for src_ in args.src:
with open(src_) as src:
input_data = loads(src.read())
input_data = json.loads(src.read())
packages.update(input_data.get('devDependencies', {}))
packages.update(input_data.get('dependencies', {}))
if args.ngeo:
# Freeze the ngeo version
packages["ngeo"] = _get_ngeo_version()
version = _ngeo_version()
Copy link
Member

@ger-benjamin ger-benjamin Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you have removed the "(get)ngeo_version" no ? How does it work ? Am I missing somethings ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have _ngeo_version at line 42 :-)

if version is not None:
packages["ngeo"] = version
for package in args.excludes:
if package in packages:
del packages[package]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"jstree": "3.3.5",
"jstreegrid": "3.9.4",
"magicsuggest-alpine": "1.0.0",
"ngeo": "2.4.0-daily.20180716T092301Z.76f80c4.HEAD",
"openlayers": "https://api.github.com/repos/openlayers/openlayers/tarball/f284b95cb897b3ce1b49b985b58ebe1ca76be1fe",
"typeahead.js": "0.11.1"
}
Expand Down