Skip to content

Commit bfe78c1

Browse files
committed
2 parents aff3409 + a9c1d48 commit bfe78c1

7 files changed

Lines changed: 1985 additions & 228 deletions

File tree

README.md

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,41 @@ available open-source libraries, which are hosted on GIT repositories. The ratio
55
[User's Guide](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/packagemanager.html). The package manager
66
is available both via API calls in the interactive environment, and via the OMEdit GUI using the _File | Manage Libraries_ menu.
77

8-
## Configuration of the Package Manager server
8+
## Adding a new library
99

10-
The database of managed libraries is kept in the [repos.json](repos.json) file, which is edited manually. If you want to add
11-
your own open-source library to the OpenModelica package manager, please fork the OMPackageManager repository, add you library
12-
to the [repos.json](repos.json) database and open a pull request, or request us to do it for you by opening a request on the
13-
[OpenModelica issue tracker](https://github.com/OpenModelica/OpenModelica/issues/new/choose).
14-
15-
Starting from this information, the `updateinfo.py` script queries the repositories where the libraries are stored and
16-
generates an up-to-date [rawdata.json](rawdata.json) file. This script is run by the
17-
[Update Package Index job](https://test.openmodelica.org/jenkins/job/Update%20Package%20Index/) on OSMC's Jenkins
18-
server four times a day to keep it up to date with library developments.
19-
Note that the query includes advanced Modelica-specific features, e.g. determining dependencies
20-
via the `uses` annotations, and determining backwards compatibility among versions via the `conversion` annotations.
21-
The `genindex.py` script is then run to generate the `index.json` database, which is queried by OMC clients to
22-
update the local package database.
23-
24-
The package manager preferably refers to official library releases, which are fetched automatically from the GitHub
25-
server without the need of naming them explicitly in the [repos.json](repos.json)
26-
file; whenever a new version of a library is released, the [repos.json](repos.json)
27-
is automatically updated to make it available. However, it is also possible to manage versions of the library that are located on specific named
28-
branches, e.g. master or maintenance branches. This is useful if you want to track development versions or you want to get the latest fixes
29-
before the official release.
10+
If you want to add your own open-source library to the OpenModelica package manager, please fork the OMPackageManager repository,
11+
add your library to the [repos.json](repos.json) database, and open a pull request.
3012

3113
For each library, the [repos.json](repos.json) database contains several pieces of information:
32-
- the name of the library(es) (`names` field); it is possible to collect a set of libraries that are found in the same GIT repository
33-
e.g. Modelica, ModelicaReference, ModelicaServices, Complex, ModelicaTest
34-
- the location of the GIT repository on GitHub (`github` field), or the git URL in case other servers are used (`git` field)
14+
- The name of the library(es) (`names` field); it is possible to collect a set of libraries that are found in the same GIT repository
15+
e.g. Modelica, ModelicaReference, ModelicaServices, Complex, ModelicaTest.
16+
- The location of the GIT repository on GitHub (`github` field), or the git URL in case other servers are used (`git` field).
3517
- Optional locations within the git repository (`search-extra-paths` field) to search for libraries. This can be specified if the libraries are not located at the root of repository.
36-
- optional branches to be managed besides the official releases (`branches` field)
37-
- optional tags to be ignored, if one wants to avoid them to be considered by the package manager (`ignore-tags` field)
38-
- the level of support in OpenModelica of the various versions of the library.
18+
- Optional branches to be managed besides the official releases (`branches` field).
19+
- Optional tags to be ignored, if one wants to avoid them to be considered by the package manager (`ignore-tags` field).
20+
- The level of support in OpenModelica of the various versions of the library (`support` field), see below.
21+
22+
As an example, if you develop your library `MyLibrary` at "https://github.com/myGithubName/MyLibrary.git",
23+
you can add a json object like the following to [repos.json](repos.json)
24+
```json
25+
"MyLibrary": {
26+
"names": ["MyLibrary"],
27+
"github": "myGithubName/MyLibrary",
28+
"support": [
29+
["*", "noSupport"]
30+
]
31+
},
32+
33+
```
3934

4035
## Library support levels in OpenModelica
36+
4137
There are five levels of support:
42-
- `fullSupport`: The library is fully supported by OpenModelica, with over 95% runnable models in the library simulating correctly
43-
- `support`: The library is partially supported by OpenModelica; most models and features work correctly, but some still don't
44-
- `experimental`: The library is currently being tested with OpenModelica, but there is no guarantee of success when using it
45-
- `noSupport`: The library is actively developed or maintained, but is not supported by OpenModelica
46-
- `obsolete`: The library is no longer developed or maintained, or it has been completely superseded by more recent versions
38+
- `fullSupport`: The library is fully supported by OpenModelica, with over 95% runnable models in the library simulating correctly.
39+
- `support`: The library is partially supported by OpenModelica; most models and features work correctly, but some still don't.
40+
- `experimental`: The library is currently being tested with OpenModelica, but there is no guarantee of success when using it.
41+
- `noSupport`: The library is actively developed or maintained, but is not supported by OpenModelica.
42+
- `obsolete`: The library is no longer developed or maintained, or it has been completely superseded by more recent versions.
4743

4844
Note that a library may not be fully supported because of OpenModelica limitations or bugs, but also because the library
4945
is not fully compliant to the Modelica Language standard. In both cases, we are open to cooperation with open-source
@@ -61,7 +57,7 @@ The support field may contain multiple selection criteria that are applied seque
6157
["*", "obsolete"]
6258
]
6359
```
64-
means that all pre-release version are not supported, all _remaining_ versions with version number greater or equal to
60+
means that all pre-release versions are not supported, all _remaining_ versions with version number greater or equal to
6561
7.0.0 are fully supported, all _remaining_ versions with version number greater or equal to 5.1.0 are partially supported,
6662
and all _remaining_ versions are considered obsolete.
6763

@@ -70,3 +66,22 @@ When the first string starts with `>=`, all versions with equal or higher releas
7066
version. In all other cases the first string must match verbatim the version number.
7167

7268
Some libraries in the package manager are regularly tested on the OSMC servers, see the OpenModelica Library Testing [README.md](https://github.com/OpenModelica/OpenModelicaLibraryTesting/blob/master/README.md).
69+
70+
## Configuration of the Package Manager server
71+
72+
The database of managed libraries is kept in the [repos.json](repos.json) file, which is edited manually.
73+
Starting from this information, the `updateinfo.py` script queries the repositories where the libraries are stored and
74+
generates an up-to-date [rawdata.json](rawdata.json) file. This script is run by the
75+
[Update Package Index job](https://test.openmodelica.org/jenkins/job/Update%20Package%20Index/) on OSMC's Jenkins
76+
server four times a day to keep it up to date with library developments.
77+
Note that the query includes advanced Modelica-specific features, e.g. determining dependencies
78+
via the `uses` annotations, and determining backwards compatibility among versions via the `conversion` annotations.
79+
The `genindex.py` script is then run to generate the `index.json` database, which is queried by OMC clients to
80+
update the local package database.
81+
82+
The package manager preferably refers to official library releases, which are fetched automatically from the GitHub
83+
server without the need of naming them explicitly in the [repos.json](repos.json)
84+
file; whenever a new version of a library is released, the [repos.json](repos.json)
85+
is automatically updated to make it available. However, it is also possible to manage versions of the library that are located on specific named
86+
branches, e.g. master or maintenance branches. This is useful if you want to track development versions or you want to get the latest fixes
87+
before the official release.

common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def VersionNumber(s):
1212
except:
1313
return semantic_version.Version(major=0, minor=0, patch=0, prerelease=(s,))
1414

15-
1615
def findMatchingLevel(s, levels):
1716
try:
1817
vn = VersionNumber(s)

generate-cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def filename(url):
2121
return os.path.join(args.destination, url.removeprefix("https://"))
2222
raise Exception(url)
2323

24-
2524
urls = set()
2625
for index in [json.loads(requests.get("https://raw.githubusercontent.com/OpenModelica/OpenModelica/%s/libraries/%s" % branch_file).content) for branch_file in itertools.product(["master", "maintenance/v1.20"],["index.json","install-index.json"])] + [json.load(open("index.json"))]:
2726
for lib in index["libs"].values():

genindex.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ def main():
124124
entry['zipfile'] = r["zip"]
125125
elif "github" in repos[firstKey]:
126126
entry['zipfile'] = "https://github.com/%s/archive/%s.zip" % (repos[firstKey]["github"], r['sha'])
127-
else:
127+
elif "zipfile" in repos[firstKey]:
128128
entry['zipfile'] = repos[firstKey]["zipfile"].format(r['sha'])
129+
else:
130+
raise Exception("Entry does not list an entry \"zip\" (manually added zip-file), \"github\" (project name), or \"zipfile\" URL from where to download the git hash (gitlab/etc):\n"+str(r))
129131
if 'provides' in lib:
130132
entry['provides'] = lib['provides']
131133
if 'uses' in lib:
@@ -139,7 +141,7 @@ def main():
139141
libdict[lib['version']] = entry
140142
# print(entry)
141143
# for lib in data["libs"].keys():
142-
144+
143145
for libName in indexdata["libs"].keys():
144146
versions = indexdata["libs"][libName]["versions"]
145147
for version in versions.keys():

0 commit comments

Comments
 (0)