Skip to content

Commit

Permalink
clean-up and enhancement to versions.json workflow (follow up johnnyc…
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 authored Apr 21, 2021
1 parent b264373 commit a502514
Show file tree
Hide file tree
Showing 23 changed files with 821 additions and 332 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ JULIA_VERSIONS = "1" "1.0" "1.1" "1.2" "1.3" "1.4.0-rc1" "latest"
unittest:
python -m unittest jill/tests/tests_filters.py
python -m unittest jill/tests/tests_versions.py
python -m unittest jill/tests/tests_alias.py

download_install_test:
# check if upstream works
Expand Down
54 changes: 5 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ For Julia (>= 1.5.0) in Linux with `musl` dependency, you can
- download it by passing `--sys musl` command. In the meantime, `--sys linux` will give you Julia
binaries built with `glibc` dependency.

Setting environment variable `JILL_UPSTREAM` will disable the fancy "find-the-nearest-upstream"
feature of `jill` and give you a faster download experience if you just know which upstream is the
fastest. (It has lower priorty than `--upstream` flag.)

## Example with cron

If you're tired of seeing `(xx days old master)` in your nightly build version, then `jill` can
Expand All @@ -117,52 +121,4 @@ it's released -- you don't even need to upgrade `jill`.

## For who are interested in setting up a new release mirror

This section is not for common `jill.py` users that simply wants to download and install Julia.

### Register new mirror

If it's an public mirror and you want to share it worldwide. You can add an entry to the
[public registry](jill/config/sources.json), make a PR, then I will tag a new release for that.

If it's an internal mirror and you don't plan to make it public, you can create a config
file at `~/.config/jill/sources.json` locally. The contents will be appended to
the public registry and overwrite already existing items if there are.

In the registry config file, a new mirror is a dictionary in the `upstream` field:

* `name`: a distinguishable mirror name
* `urls`: URL template to retrive Julia release
* `latest_urls`: URL template to retrive the nightly build of Julia release

### Placeholders

Placeholders are used to register new mirrors. For example, the stable release url of
the "Official" release server provided by [Julialang.org](https://julialang.org/) is
`"https://julialang-s3.julialang.org/bin/$sys/$arch/$minor_version/$filename"`

There're several predefined placeholders for various systems and architectures:

* `system`: `windows`, `macos`, `linux`, `freebsd`
* `sys`: `winnt`, `mac`, `linux`, `freebsd`
* `os`: `win`, `mac`, `linux`, `freebsd`
* `architecture`: `x86_64`, `i686`, `ARMv7`, `ARMv8`
* `arch`: `x86`, `x64`, `armv7l`, `aarch64`
* `osarch`: `win32`, `win64`, `mac64`, `linux-armv7l`, `linux-aarch64`
* `osbit`: `win32`, `win64`, `linux32`, `linux64`, `linuxaarch64`
* `bit`: `32`, `64`
* `extension`: `exe`, `tar.gz`, `dmg` (no leading `.`)

There're also placeholders for versions:

* `patch_version`: `1.2.3`, `latest`
* `minor_version`: `1.2`, `latest`
* `major_version`: `1`
* `version`: `1.2.3-pre`, `latest` (no leading `v`)
* `vpatch_version`: `v1.2.3`, `latest`
* `vminor_version`: `v1.2`, `latest`
* `vmajor_version`: `v1`, `latest`

To keep consistent names with official releases, you can use predefined name placeholders:

* stable release `filename`: `julia-$version-$osarch.$extension`
* nightly release `latest_filename`: `"julia-latest-$osbit.$extension"`
Please check out [register new mirror](register_mirror.md).
7 changes: 3 additions & 4 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ _跨平台的 Julia 一键安装脚本_
- 下载: 用 `--sys musl` 来下载基于`musl`的版本,以及用`--sys linux` 来下载glibc的版本


在你已经提前知道最近的镜像站的情况下, 环境变量 `JILL_UPSTREAM` 可以用来关闭 `jill` 的 “查询最近的上游” 这一功能,
从而加速整个 `jill` 的下载过程。 (不过 `jill --upstream` 的优先级更高一些)

## 案例 -- Cron

通过使用`cron``jill` 还能够保证在你的服务器上提供一个最新版本的每日构建版:
Expand All @@ -105,7 +108,3 @@ PATH=/usr/local/bin:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

类似地,你也可以通过加一个 `jill install --confirm` 来保证 `julia` 永远是最新地稳定发行版。一旦有新的 Julia 版本
发布了,`jill` 就能够下载到它 -- 你甚至不需要更新`jill`

## 镜像源的搭建

Check the [English version](README.md) :)
4 changes: 3 additions & 1 deletion jill/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .download import download_package
from .install import install_julia
from .utils import show_upstream
from .mirror import mirror
import fire
import logging
import os
Expand All @@ -13,7 +14,8 @@ def main():
fire.Fire({
'download': download_package,
'install': install_julia,
'upstream': show_upstream
'upstream': show_upstream,
'mirror': mirror
}, name="jill")


Expand Down
14 changes: 14 additions & 0 deletions jill/config/alias.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Arch": {
"x86": "i686",
"x64": "x86_64",
"armv8": "aarch64",
"armv7": "armv7l"
},
"OS": {
"macos": "mac",
"darwin": "mac",
"windows": "winnt",
"win": "winnt"
}
}
38 changes: 38 additions & 0 deletions jill/config/placeholders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"sys": {},
"os": {
"winnt": "win"
},
"arch": {
"i686": "x86",
"x86_64": "x64"
},
"osarch": {
"win-i686": "win32",
"win-x86_64": "win64",
"mac-x86_64": "mac64"
},
"osbit": {
"wini686": "win32",
"winx86_64": "win64",
"macx86_64": "mac64",
"linuxx86_64": "linux64",
"linuxi686": "linux32",
"freebsdx86_64": "freebsd64",
"freebsdi686": "freebsd32"
},
"extension": {
"winnt": "exe",
"linux": "tar.gz",
"mac": "dmg",
"freebsd": "tar.gz",
"musl": "tar.gz"
},
"bit": {
"i686": 32,
"x86_64": 64,
"aarch64": 64,
"armv7l": 32
}

}
15 changes: 10 additions & 5 deletions jill/config/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
],
"latest_urls": [
"https://julialangnightlies-s3.julialang.org/bin/$sys/$arch/$latest_filename"
]
],
"versions": "https://julialang-s3.julialang.org/bin/versions.json"
},
"BFSU": {
"name": "Beijing Foreign Studies University",
Expand All @@ -16,7 +17,8 @@
],
"latest_urls": [
""
]
],
"versions": "https://mirrors.bfsu.edu.cn/julia-releases/bin/versions.json"
},
"TUNA": {
"name": "Tsinghua University TUNA Association",
Expand All @@ -26,7 +28,8 @@
],
"latest_urls": [
""
]
],
"versions": "https://mirrors.tuna.tsinghua.edu.cn/julia-releases/bin/versions.json"
},
"USTC": {
"name": "University of Science and Technology of China",
Expand All @@ -35,7 +38,8 @@
],
"latest_urls": [
""
]
],
"versions": "https://mirrors.ustc.edu.cn/julia-releases/bin/versions.json"
},
"SJTUG": {
"name": "Shanghai Jiao Tong University Linux User Group",
Expand All @@ -44,7 +48,8 @@
],
"latest_urls": [
""
]
],
"versions": "https://mirrors.sjtug.sjtu.edu.cn/julia-releases/bin/versions.json"
}
}
}
Expand Down
128 changes: 128 additions & 0 deletions jill/config/versions-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/WelcomeValue"
},
"definitions": {
"WelcomeValue": {
"type": "object",
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/File"
}
},
"stable": {
"type": "boolean"
}
},
"required": [
"files",
"stable"
],
"title": "WelcomeValue"
},
"File": {
"type": "object",
"additionalProperties": false,
"properties": {
"triplet": {
"$ref": "#/definitions/Triplet"
},
"kind": {
"$ref": "#/definitions/Kind"
},
"arch": {
"$ref": "#/definitions/Arch"
},
"sha256": {
"type": "string"
},
"size": {
"type": "integer"
},
"version": {
"type": "string"
},
"os": {
"$ref": "#/definitions/OS"
},
"url": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
],
"qt-uri-extensions": [
".dmg",
".exe",
".gz",
".zip"
]
},
"asc": {
"type": "string"
}
},
"required": [
"arch",
"kind",
"os",
"sha256",
"size",
"triplet",
"url",
"version"
],
"title": "File"
},
"Arch": {
"type": "string",
"enum": [
"x86_64",
"i686",
"powerpc64le",
"aarch64",
"armv7l"
],
"title": "Arch"
},
"Kind": {
"type": "string",
"enum": [
"archive",
"installer"
],
"title": "Kind"
},
"OS": {
"type": "string",
"enum": [
"mac",
"winnt",
"linux",
"freebsd"
],
"title": "OS"
},
"Triplet": {
"type": "string",
"enum": [
"x86_64-apple-darwin14",
"x86_64-w64-mingw32",
"i686-w64-mingw32",
"x86_64-linux-gnu",
"i686-linux-gnu",
"powerpc64le-linux-gnu",
"aarch64-linux-gnu",
"armv7l-linux-gnueabihf",
"x86_64-unknown-freebsd11.1",
"x86_64-linux-musl"
],
"title": "Triplet"
}
}
}
Loading

0 comments on commit a502514

Please sign in to comment.