Tridymite is a package manager for github repositories. It allows developers and users to easily install and manage their packages and let them create their own in their repositories.
It only works on Linux.
Tridymite has the following dependencies:
- g++
- cmake
- libcurl (headers)
- yaml-cpp
The installation script will help you, if a dependency isn't installed.
1. Clone the repository and change to it's directory.
git clone https://github.com/triploit/tridymite
cd tridymite/
2. Run the installation script:
bash ./install.sh
You will be lead through the setup.
Installing of Packages is really easy. The only difficulty is: You have to know where the package lies. Tridymite is a package manager to install packages of git repositories. This works with all git servers. Therefor you have to say where the packages lies and which user the package owns.
For example, to install a the package AML from our organisation:
tridy -i triploit:aml@github.com
The syntax of a package argument is: user:package@server#branch
. You can leave
out the server, if you want to install a package from github.com
, because
GitHub is the standard git server. You also can leave out the branch, if you
want to install the package from the master branch, because it's the standard
branch.
So, this will also work:
tridy -i triploit:aml
It installs the package triploit:aml
(https://github.com/triploit/aml) from
the master
branch on the server github.com
.
The standard branch Tridymite installs from, is the master branch. But if you want to install a specific branch (maybe for different releases) you can add a simple option to the package-argument:
tridy -i triploit:aml#master
After the #
starts the branch name, just replace it with the branch you want.
If you exchange the github.com
with (for example) bitbucket.org
, it will
also work, but the repository and the user have to exist on bitbucket.org
:
tridy -i triploit:aml@bitbucket.org
(This won't work, because we don't have a bitbucket account.)
Not all packages have to be installed globally for all users. If a package
supports the local installation option with relative paths, it can be installed
with the option -l
or --local
:
tridy -i triploit:aml -l
AML can be installed as a local package, with the local option it will be
installed in the ~/.local/
folder, so it's only accessable for one user.
If you want to remove a package, it can be done with the option -r
or
--remove
:
tridy -r triploit:aml
This will remove AML, even if it's locally installed.
Updating packages can be done with the option -u
or --update
:
tridy -u triploit:aml
Or, if you want to update all packages, use -ua
or --update-all
:
tridy -ua
Note: Use -l
in combination with -u
or -ua
to uptdate locally
installed packages.
If you have the source code of a Tridymite package, you can just use the option
-p
or --path
:
tridy -p source/to/package
This method also needs a package config. For more information about creating a package, see Tridymite for Package Developers.
For this, use the option -lp
or --list-packages
:
tridy -lp
Note: There is a difference in local and global packages. The option above will
only show the global packages. To see the local packages, add the option -l
or
--local
:
tridy -l -lp
This will show all the packages, that were installed locally.
Before you install a package (or after you installed a package) you can view all
information, the author has given. Just use the option -d
or --description
:
tridy -d triploit:tridymite
Creating packages is really easy. You just have to add 2 files to your project.
First, you have to add a pkg/
directory to the root directory of your
project. In this directory, you have to create 2 files:
The package.yaml
provides information (like author, version, name, ...) to
Tridymite.
Here is an example:
name: "The Test Package"
version: "0.0.1"
description: "Short description of the package."
information: |
Really long text...
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet.
authors:
- your_github_name
- second
products:
- ./prog: "/usr/share/bin/prog"
The field name
contains the written out name of the projects (please don't use
shortcuts).
Tridymite uses semantic versioning, for more information see https://semver.org/.
Information is a long explanation of the project. Descritpion is just a short description.
authors
contains all contributors that worked on the package/program.
This part is really important! After the build of the project, here is the part, where the magic is done. Put all your binary files and configuration files in the following order:
products:
- from: "to"
Example:
products:
- binary: "/usr/share/bin/binary"
You can also use "relative paths". That allows the user, to install the package locally, not globally. Let's say, we have a package with only one binary file. Then, you should let the user decide if he want's to install it locally, or not. For this, we added some variables for paths:
Variable | Redirection |
---|---|
$usr |
/usr/ for global installations, ~/.local/usr/ for local ones |
$share |
/usr/share/ for global installations, ~/.local/usr/share/ for local ones |
$bin |
/usr/bin/ for global installations, ~/.local/usr/bin/ for local ones |
Tridymite prepares this option at the installation.
This option is not necessary and can only be used in some cases. Let's explain the concept:
Let's say, you're a C++ developer and you use cmake. If you add support for
Tridymite to all your projects, it would always be the same package.sh
:
function build {
cmake .
make
}
That's really annoying. But with the pretype
-option you can set the build-type
of your project and it will automaticcaly generate a package.sh
at the
installation. Let's see how it works:
type:
name: cmake
This will automatically generate the file from above. But not only cmake is supported, also make, g++ and gcc. Let's have a look at g++:
type:
name: gcc-cpp
input_file: main.cpp
output_file: binary
arguments: -s
Here variables were used to specify some arguments. This will generate the following build-script:
g++ main.cpp -o binary -s
But how do you know if a pretype needs a variable? a) Tridymite will tell you.
b) You can look into the folder pkg/conf/pretypes
of this repository to see
which pretypes exist and what they need. Let's look at pkg/conf/pretypes/gcc-cpp
:
#% input_file,output_file,arguments
g++ ${input_file} -o ${output_file} ${arguments}
The line starting with #%
tells Tridymite what variables it needs
(its necessary!). The lines without #
will be part of the build-script and
variables will be replaced. On this way, you can add your own pretypes and maybe
create a pull-request for this repository.
The file package.sh
is just the build file. Write your commands to execute
Makefiles/build your projects or prepare the installation here.
It's not allowed, to execute command as root. Also there have to be a function
called build
. For Tridymite it's like a main function like in other programming
languages.
Here is an example:
function build {
echo "building..."
g++ main.cpp -o bin
}
Else you can add own functions and use it in the build
function.
With the new pretypes you don't need this file anymore, if you have a project
with make, cmake or in some other cases.
We're currently writing a documentation to make it easier to understand the Tridymite source code and how to contribute to the project.