Skip to content

Commit 5453e9e

Browse files
authored
Merge pull request #232 from FyraLabs/owen/devcontainer
feat(terra): add devcontainer usage, clarify some stuff
2 parents fd751c8 + acff14a commit 5453e9e

1 file changed

Lines changed: 51 additions & 20 deletions

File tree

pages/terra/contributing.mdx

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import { Callout } from "nextra/components";
88
# Contributing
99

1010
Thanks for contributing to Terra!
11+
1112
Terra is specifically designed to be as _package-maintainer-friendly_ as possible — you
1213
don't need to know everything about the infrastructure to create a package for Terra!
1314
See the following guide for creating a new package yourself. Quick and easy.
1415

1516
It's also ok to **suggest packages** to include into Terra, though it might take a while. (We're busy!)
1617

1718
Remember, it takes effort to create a package. If you ever need help, hop into
18-
[our Discord server](https://discord.gg/5fdPuxTg5Q) and we will try to help you.
19+
[our Discord server](https://fyralabs.com/discord) and we will try our best to help you.
1920

2021
## Creating a package
2122

@@ -27,21 +28,42 @@ Remember, it takes effort to create a package. If you ever need help, hop into
2728

2829
### Preparation
2930

30-
- Install [Andaman] on your system and its mock configs
31+
#### Fedora/Ultramarine
32+
33+
- Install [Andaman] and its mock configs on your system
3134
- `sudo dnf install terra-mock-configs{:ansi}` via Terra
3235
- anda is also available via rust crates.io
3336
- If on an atomic system, this command works using podman: `podman run --rm --cap-add=SYS_ADMIN --privileged --volume ./:/anda --volume mock_cache:/var/lib/mock --workdir /anda ghcr.io/terrapkg/builder:frawhide anda`
34-
- Use `rust2rpm` for **Rust** packages
35-
- Use `pyp2rpm` for **Python** packages
36-
- Use `go2rpm` for **Go** packages
37-
- else, find the source of the packages you are adding, preferably a URL to a `.tar.gz` archive
38-
- multiple archives are ok
39-
- non `.tar.gz` archives are also ok, but might require additional build dependencies
40-
- we also prefer archives from git repositories
37+
- Fork the [Terra sources repo](https://github.com/terrapkg/packages), and then `git clone` your fork.
38+
- You are now ready for the [Writing Sources]([contributing#writing-sources](https://developer.fyralabs.com/terra/contributing#writing-sources)) section below.
39+
40+
#### Dev Container
41+
42+
You can create, build, and push a package all from within our Dev Container.
43+
This means you do NOT need to be running Fedora/Ultramarine to create a package.
44+
You can run this devcontainer from Linux, macOS, or Windows.
45+
46+
- If you're Visual Studio Code, open it and navigate to the Extensions menu located at the bottom of the left sidebar.
47+
- Install [Docker](https://docs.docker.com/engine/install/). If you're on Linux, you'll need to enable the service and reboot.
48+
- Fork the [Terra sources repo](https://github.com/terrapkg/packages), and `git clone` your fork.
49+
- Open this folder in Visual Studio Code (File -> Open Folder).
50+
- It should prompt you to `reopen in Dev Container,` click this and wait for the Dev Container to open. If it doesn't prompt you, press `Ctrl` + `Shift` + `P`, type `Reopen in Container`, and press `Enter`.
51+
- You are now in the Terra Dev Container, and have all the packages and configuration necessary to start building packages!
52+
53+
#### Language Support in Editors
54+
55+
The most common languages you will see:
56+
- RPMSPEC (`.spec`), for the package build scripts
57+
- rhai, for the auto-update scripts
58+
- hcl, for informing `anda` of the package
59+
- xml, for appstream metainfo on some packages
60+
61+
VSCode should prompt you to install these extensions, and Zed should auto-install them.
62+
If not/using a different IDE, we suggest installing language support for each of these.
4163

4264
### Writing sources
4365

44-
1. Fork/clone the [Terra sources repo](https://github.com/terrapkg/packages).
66+
1. Fork the [Terra sources repo](https://github.com/terrapkg/packages), and `git clone` your fork.
4567
1. Create a folder named after the package name, for example:
4668
- A font named `lovelyfonttype` would go in `anda/fonts/lovelyfonttype`.
4769
- A Pantheon DE package would go in `anda/desktops/elementary/`.
@@ -51,7 +73,7 @@ Remember, it takes effort to create a package. If you ever need help, hop into
5173
- The name of the folder name actually is just for identifications for Terra package maintainers.
5274
What matters is that the spec file name _must_ match with the package name defined in the spec file later.
5375
This is a Fedora `mock` limitation.
54-
- For more information, check out our [packaging policies](policy).
76+
- For more information, check out our [packaging policies].
5577
1. Edit `anda.hcl`, which tells [Andaman] how to build the package:
5678

5779
```hcl
@@ -66,10 +88,17 @@ Remember, it takes effort to create a package. If you ever need help, hop into
6688
- It is a custom file format for RPM packages.
6789
- This [RPM Packaging Guide] might help newbies with no prior experiences with RPM specs.
6890
- This [Spec file format] docs goes into the details of the spec file format.
91+
- You may use `rust2rpm` for **Rust** packages.
92+
- You may use `pyp2rpm` for **Python** packages.
93+
- You may use `go2rpm` for **Go** packages.
94+
- Otherwise, find the source of the packages you are adding, preferably a URL to a `.tar.gz` archive
95+
- Multiple archives are ok.
96+
- Archives not in `.tar.gz` format are also okay, but might require extra work.
97+
- Archives from git repositories are preferred.
6998

7099
#### Editing the Spec file
71100

72-
> TIP: Check out other spec files for other packages for some examples ;)
101+
> TIP: Check out other spec files of related packages for some examples ;)
73102
74103
A generic spec file looks like this:
75104

@@ -83,8 +112,8 @@ Source0: https://github.com/some/repo/archive/%{version}.tar.gz
83112
# You should change the above link to the source tarball you got from the preparation section
84113
License: MIT
85114
BuildRequires: some dependencies >= 3.2.1 another-dep
86-
Requires: deps here
87-
# We *highly* encourage you to add yourself as the packager here:
115+
Requires: runtime deps here
116+
# We require you to add yourself as the packager here (if this is an issue for you, let us know):
88117
Packager: Your Name <meowy@example.com>
89118
90119
%description
@@ -102,7 +131,8 @@ echo "this will run when building pkg"
102131
echo "this will also run when building pkg but for installing it into %{buildroot} so that anda (mock) can package it"
103132
104133
%files
105-
/usr/bin/pkgname-binary
134+
# This macro expands to `/usr/bin`. To see what macros expand to, you can run `rpm --eval %{MACRO}`
135+
%{_bindir}/pkgname-binary
106136
/path/to/more/files/*/package
107137
108138
%changelog
@@ -111,7 +141,7 @@ echo "this will also run when building pkg but for installing it into %{buildroo
111141
```
112142

113143
- Add `Source0` or `Source1` or more.
114-
These preambles should link to a compressed file (preferably `tar`) and will be extracted during `%prep`
144+
These preambles should link to a compressed file (preferably a tarball) and will be extracted during `%prep`.
115145
You should've had the link prepared during [#Preparation](#preparation) :3
116146
- Add a new line `%prep`
117147
- The source file will be automatically downloaded and
@@ -132,7 +162,7 @@ echo "this will also run when building pkg but for installing it into %{buildroo
132162

133163
## Building
134164

135-
- Having anda installed, run the following command:
165+
- Having anda installed (or in the Dev Container) run the following command:
136166

137167
```ansi
138168
anda build -c terra-rawhide-x86_64 anda/fonts/lovelyfonttype-fonts/pkg
@@ -143,15 +173,16 @@ up a container), add `--rpm-builder=rpmbuild`. Remember to install the build
143173
dependencies using `sudo dnf builddep path/to/pkgname.spec{:ansi}`!
144174

145175
- You don't need to create `pkg`. It's not supposed to exist, just needs to be at the end of the build command
146-
- Modify the architecture to match your machine (`x86_64`, `aarch64`)
176+
- Modify the architecture to match your machine (`x86_64`, `i386`, `aarch64`)
177+
- If needed (404 errors when building off `rawhide`, you can also modify the version it builds on (`43`, `42`, `el10`, etc.)
147178
- If the package fails to build, fix your spec file accordingly
148179
- Usually the actual useful error message can be found before the Python traceback (from mock).
149-
- The built RPM will be inside `anda-build/`
180+
- The built RPM(s) will be inside `anda-build/`
150181

151182
## Done?
152183

153184
- Git commit and push; remember you must sign your commits!
154-
- Create a pull request that merges to the `main` branch
185+
- Create a pull request that merges to the `frawhide` branch, this is equivalent to main or master
155186

156187
## Automatic updates
157188

0 commit comments

Comments
 (0)