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

chore!(code structure): Split the script functions into separate libraries #232

Merged
merged 12 commits into from
Sep 23, 2024
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ Apart from trivial changes (like simple typo fixes), it is advised to first [ope
### Coding style

When submitting code changes, try to respect the coding style and the overall way things work, as much as possible.
For instance, for the main bash script:
For instance:

- Stick to bash syntax
- Variables should use the `"${var}"` format
- Use the `{main,info,ask,warning,error}_msg` functions to print messages
- Use `"$(eval_gettext "string")"` for any string chain that should be included in translations
- The main `arch-update.sh` script should only be used as a wrapper around "libraries" stored in `src/lib/`
- [...]

Bash code is checked with [shellcheck](https://www.shellcheck.net/).
Expand Down Expand Up @@ -102,6 +103,17 @@ The recently introduced -l/--list option was missing from the man page
style: Typo fixes in README and man pages
```

```text
chore!(code structure): Split the script functions into separate libraries

Split the functions inside the main script into their own separate libraries scripts to improve readability and ease the overall maintenance and contribution processes.

Closes https://github.com/Antiz96/arch-update/issues/230

BREAKING CHANGE: The python script for the systray applet is now sourced as a library by the main script (and not executed from `"installation_prefix"/bin/` anymore).
People that installed Arch-Update from source will have to either uninstall it (with `make uninstall`) **before** pulling and installing the new version (with `make install`), or they will have to manually remove the `arch-update-tray` file from their system (which is under `/usr/local/bin/` if the default installation prefix was used) after upgrading from `v2.x.x` to `v3.x.x`. Otherwise, the `arch-update-tray` file will remain un-tracked on the system.
```

### License

By contributing to this project, you agree that your contributions will be licensed under the [GPL-3.0 license](https://github.com/Antiz96/arch-update/blob/main/LICENSE) (or any later version of this license).
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ PREFIX ?= /usr/local
all:

install:
# Install scripts
install -Dm 755 "src/script/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}"
install -Dm 755 "src/script/${pkgname}-tray.py" "${DESTDIR}${PREFIX}/bin/${pkgname}-tray"
# Install main script
install -Dm 755 "src/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}"

# Install libraries
install -Dm 755 src/lib/* -t "${DESTDIR}${PREFIX}/share/${pkgname}/lib/"

# Install icons
install -Dm 664 "src/icons/${pkgname}.svg" "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${pkgname}.svg"
Expand Down Expand Up @@ -56,9 +58,11 @@ install:
install -Dm 644 "res/config/${pkgname}.conf.example" "${DESTDIR}${PREFIX}/share/doc/${pkgname}/${pkgname}.conf.example"

uninstall:
# Delete scripts
# Delete main script
rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}"
rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}-tray"

# Delete data folder (which stores libraries)
rm -rf "${DESTDIR}${PREFIX}/share/${pkgname}"

# Delete icons
rm -rf "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${pkgname}.svg"
Expand Down
1 change: 1 addition & 0 deletions README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Codes de sortie :
11 Erreur lors du redémarrage des services nécessitant un redémarrage après mise à jour
12 Erreur lors du traitement des fichiers pacnew
13 Erreur lors de l'édition du fichier de configuration avec l'option `--edit-config`
14 Le dossier de librairies n'a pas été trouvé
```

Pour plus d'informations, consultez la page de manuel arch-update(1).
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Exit Codes:
11 Error when restarting services that require a post upgrade restart
12 Error during the pacnew files processing
13 Error when editing the configuration file with the `--edit-config` option
14 Libraries directory not found
```

For more information, see the arch-update(1) man page.
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export TAG="X.Y.Z"
- Bump version in where necessary:

```bash
sed -i "s/$(arch-update -V | cut -f2 -d " ")/${TAG}/g" doc/man/arch-update.* doc/man/fr/arch-update.* po/* src/script/arch-update.sh
sed -i "s/$(arch-update -V | cut -f2 -d " ")/${TAG}/g" doc/man/arch-update.* doc/man/fr/arch-update.* po/* src/arch-update.sh
```

- Update changelog:
Expand Down
4 changes: 4 additions & 0 deletions doc/man/arch-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ Error when restarting services that require a post upgrade restart
.B 13
.RB "Error when editing the configuration file with the " "--edit-config " "option"

.TP
.B 14
Libraries directory not found

.SH SEE ALSO
.BR checkupdates (8),
.BR pacman (8),
Expand Down
4 changes: 4 additions & 0 deletions doc/man/fr/arch-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ Erreur lors du traitement des fichiers pacnew
.B 13
.RB "Erreur lors de l'édition du fichier de configuration avec l'option " "--edit-config"

.TP
.B 14
Le dossier de librairies n'a pas été trouvé

.SH VOIR AUSSI
.BR checkupdates (8),
.BR pacman (8),
Expand Down
Loading