Skip to content

Commit

Permalink
🏭 mommy adds and documents code for obs~
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Nov 25, 2023
1 parent 331687d commit 0d10761
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 33 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec
sudo make -C /tmp/shellspec/ install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Install additional shells"
Expand Down Expand Up @@ -203,6 +204,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec
make -C /tmp/shellspec install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Install additional shells"
Expand All @@ -212,7 +214,7 @@ jobs:
- name: Checkout mommy
uses: actions/checkout@v4
with:
# Checkout to subdirectory is required for 'pkg/fpm/rpkg.conf' to correctly determine '${git_props:root}'
# Checkout to subdirectory is required for 'pkg/rpkg/rpkg.conf' to correctly determine '${git_props:root}'
path: mommy
- name: Test script
working-directory: ./mommy/
Expand Down Expand Up @@ -247,7 +249,7 @@ jobs:
working-directory: ./mommy/
run: |
echo "::group::Build"
rpkg -p ./pkg/fpm local # build srpm
rpkg -p ./pkg/rpkg local # build srpm
rpmbuild --rebuild /tmp/rpkg/mommy-*/*.rpm
echo "::endgroup::"
Expand Down Expand Up @@ -350,6 +352,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec
gmake -C /tmp/shellspec install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Install additional shells"
Expand Down Expand Up @@ -416,6 +419,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec/
gmake -C /tmp/shellspec/ install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Install additional shells"
Expand Down Expand Up @@ -477,6 +481,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec
gmake -C /tmp/shellspec install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Install additional shells"
Expand Down Expand Up @@ -534,6 +539,7 @@ jobs:
echo "::group::Install ShellSpec"
git clone --depth=1 https://github.com/shellspec/shellspec.git /tmp/shellspec
make -C /tmp/shellspec install
rm -rf /tmp/shellspec
echo "::endgroup::"
echo "::group::Post-install additional shells"
Expand Down
62 changes: 36 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ is probably a better approach, though~

the script below downloads the latest stable release and extracts it for you.
if you don't want to use curl, just [check the latest release](https://github.com/FWDekker/mommy/releases/latest) in
your browser and download the `+generic.tar.gz` file manually~
your browser and download the file ending in `+generic.tar.gz` manually~
```shell
# download latest archive from github release
Expand Down Expand Up @@ -416,7 +416,7 @@ make sure you do not put spaces around the `=`~
### 🪣 lists
some of these settings support lists.
mommy chooses a random element from each list each time she is called by you.
(except for `MOMMY_FORBIDDEN_WORDS` and `MOMMY_SUPPRESS_EXIT`, where all elements of the list are always considered.)
(except for `MOMMY_FORBIDDEN_WORDS` and `MOMMY_SUPPRESS_EXIT`, where mommy always considers all elements of the list.)
in a list, elements are separated by a newline or by a `/`.
elements that contain whitespace only, and elements that start with a `#` are ignored~

Expand Down Expand Up @@ -466,9 +466,9 @@ outputs `your mommy loves you`~
| `%%SWEETIE%%` | what mommy calls you |
### ✍️ renaming the mommy executable
if you want to write `daddy npm test` instead of `mommy npm test`, you can just create a symlink.
if you want to write `daddy npm test` instead of `mommy npm test`, you can create a symlink~
> ℹ️ if you [integrate mommy with your shell](#-shell-integration) you won't have to prefix `daddy` in the first place~
> ℹ️ if you [integrate mommy with your shell](#-shell-integration) you won't have to write `daddy` in the first place~

mommy is installed in slightly different locations on different systems, but you can easily find where mommy is
installed with `whereis mommy`:
Expand Down Expand Up @@ -613,7 +613,7 @@ if that annoys you, run `make build` after each change, and use `build/bin/mommy
```shell
make test/integration
```
3. **test installation**
3. **test installed code**
```shell
make system=1 test
```
Expand All @@ -637,7 +637,7 @@ the binary packages attached to the github release are built with the
run `make list` to see a list of build targets;
you're looking for the ones starting with `dist/`~
to build the packages, you need at least gnu make, ruby, and fpm.
to build the packages, you need at least gnu make, ruby, and [fpm](https://github.com/jordansissel/fpm).
(actually, you don't need fpm for netbsd and openbsd.)
on debian-based systems, you already have gnu make, so you only need
```shell
Expand All @@ -646,33 +646,40 @@ sudo gem install fpm
```
after that, just run `make dist/deb` (or better: `mommy make dist/deb`), and a `.deb` package will be built in `dist/`.
run `make` or `make list` for a list of valid building targets.
run `make` or `make list` for a list of valid build targets.
a special target is `install`, which directly copies the files into the specified directories on your system.
these directories can be changed by setting `prefix` variables, as in `make prefix=/usr/ install`.
i recommend running `make --dry-run prefix=/usr/ install` first so you can verify that all directories are calculated
correctly.
check the `GNUmakefile` for more details~
check the [makefile](https://github.com/FWDekker/mommy/blob/main/GNUmakefile) for more details~
all systems can build packages for themselves without additional dependencies.
all systems can build packages for themselves without dependencies beyond those noted above.
if you want to compile for a different system, you may need additional dependencies.
for example, if you want to build packages for alpinelinux, archlinux, and rpm from a debian-like system, you will need
for example, if you want to build packages for alpinelinux, archlinux, and rpm from a debian-like system, you will
respectively need
```shell
sudo apt install libarchive-tools rpm zstd
```
and then you can run
```shell
make apk pacman rpm
make dist/apk dist/pacman dist/rpm
```
unfortunately, packages for macos, netbsd, and openbsd cannot be built on systems other than themselves~
</details>
<details>
<summary>🏗️ external build servers</summary>
a service builds mommy on-demand on each release, and makes the created packages available for all users.
currently, this happens only for fedora/epel at [copr](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/).
the relevant build files are hosted in
[mommy's `pkg/fpm/` directory](https://github.com/FWDekker/mommy/tree/main/pkg/fpm/)~
build servers build mommy distributions on-demand for each release, and make the created packages available for all
users.
how sweet~
* [copr](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/) builds packages for fedora and epel~
* [openbuildservice](https://build.opensuse.org/package/show/home:fwdekker:mommy/mommy) builds packages for all
deb-based and rpm-based systems~
see [pkg/README.md](https://github.com/FWDekker/mommy/blob/main/pkg/README.md) for more information on the build
process~
</details>
<details>
Expand All @@ -697,29 +704,32 @@ every merge into `main` automatically build and releases a new version~
* **before merging into `main`**
* update `version`~
* update `pkg/fpm/mommy.spec.rpkg` if changes were made to the packaging~
* update release number~
* update change log~
* update `CHANGELOG.md`~
* update all changelogs~
* update `CHANGELOG.md`~
* do not leave a placeholder section for `[Unreleased]`, because that will end up in the `.deb` changelogs~
* remove empty subsections for the new release~
* ensure no line breaks are used as whitespace;
github release notes use them as actual line breaks~
* update `pkg/obs/debian.changelog` if changes were made to obs's debian packaging process~
* update `pkg/obs/mommy.spec` if changes were made to obs's rpm packaging process~
* update `pkg/rpkg/mommy.spec.rpkg` if changes were made to copr's rpkg packaging process~
* update acknowledgements in `README.md`~
* update promotional images in `.github/img/`~
* **after merging into `main`**
* a new github release is created automatically~
* [aur-mommy](https://github.com/FWDekker/aur-mommy/)
* updated automatically when `mommy` updates
* always [manually check deployment status](https://github.com/FWDekker/aur-mommy/actions?query=branch%3Amaster)~
* updated automatically when `mommy` updates
* always [manually check deployment status](https://github.com/FWDekker/aur-mommy/actions?query=branch%3Amaster)~
* [copr](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/)
* updated automatically when `mommy` updates
* always [manually check deployment status](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/builds/)~
* updated automatically when `mommy` updates
* always [manually check deployment status](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/builds/)~
* [homebrew-mommy](https://github.com/FWDekker/homebrew-mommy)
* updated automatically when `mommy` updates
* always
[manually check deployment status](https://github.com/FWDekker/homebrew-mommy/actions?query=branch%3Amain)~
* updated automatically when `mommy` updates
* always [manually check deployment status](https://github.com/FWDekker/homebrew-mommy/actions?query=branch%3Amain)~
* [openbuildservice](https://build.opensuse.org/package/show/home:fwdekker:mommy/mommy)
* updated automatically when `mommy` updates
* always [manually check deployment status](https://build.opensuse.org/package/show/home:fwdekker:mommy/mommy)~
</details>
### 🤠 contribution guidelines
Expand Down
23 changes: 23 additions & 0 deletions pkg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
this directory contains files used by external build servers~

## obs
obs is for [openbuildservice](https://build.opensuse.org/package/show/home:fwdekker:mommy/mommy), which works by looking
at the `_service` file (stored in the build server's own repo), which itself states that obs should download this repo,
extract the `pkg/obs/` directory, and then run [`obs-build`](https://github.com/openSUSE/obs-build).
there are two entry points:
* `mommy.dsc` for deb-based outputs, in total using the following files:
* `debian.changelog` is the changelog,
* `debian.compat` describes the
[debhelper compatibility level](https://www.debian.org/doc/manuals/maint-guide/dother.en.html#compat),
* `debian.control` describes the build logic,
* `debian.rules` is a sort of makefile for
[debhelper](https://manpages.debian.org/testing/debhelper/debhelper.7.en.html),
* and `mommy.dsc` contains build-independent metadata; and
* `mommy.spec` for rpm-based outputs~

the whole architecture here was heavily inspired (which means: basically copied) from
[mpz](https://build.opensuse.org/package/show/home:oleg_antonyan/mpz)~

## rpkg
rpkg is for [copr](https://copr.fedorainfracloud.org/coprs/fwdekker/mommy/), which works by downloading this repo,
`cd`ing into `pkg/rpkg`, and then running [rpkg](https://pagure.io/rpkg-util)~
2 changes: 0 additions & 2 deletions pkg/fpm/rpkg.conf

This file was deleted.

5 changes: 5 additions & 0 deletions pkg/obs/debian.changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mommy (1.2.5-1) stable; urgency=low

* Initial release using OpenBuildService.

-- Florine W. Dekker <[email protected]> Sat, 25 Nov 2023 13:01:09 +0000
1 change: 1 addition & 0 deletions pkg/obs/debian.compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
10 changes: 10 additions & 0 deletions pkg/obs/debian.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Source: mommy
Section: misc
Priority: optional
Maintainer: Florine W. Dekker <[email protected]>
Build-Depends: debhelper (>= 10)
Homepage: https://github.com/FWDekker/mommy

Package: mommy
Architecture: any
Description: mommy's here to support you, in any shell~ ❤️
12 changes: 12 additions & 0 deletions pkg/obs/debian.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/make -f

export DESTROOT="$(CURDIR)/debian/mommy"

%:
dh $@

override_dh_auto_install:
dh_auto_install -- prefix="$(DESTROOT)/usr/"

override_dh_auto_test:
echo "Skipping tests"
7 changes: 7 additions & 0 deletions pkg/obs/mommy.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Format: 1.0
Source: mommy
Version: placeholder
Binary: mommy
Maintainer: Florine W. Dekker <[email protected]>
Architecture: any
Build-Depends: debhelper (>= 10)
44 changes: 44 additions & 0 deletions pkg/obs/mommy.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Name: mommy
Version: placeholder
Release: placeholder
Summary: mommy's here to support you, in any shell~ ❤️
License: Unlicense
URL: https://github.com/FWDekker/mommy
VCS: git+https://github.com/fwdekker/mommy.git
Source: mommy-%{version}.tar.gz
BuildArch: noarch
BuildRequires: make
BuildRequires: glibc-langpack-en

%description
mommy's here to support you! mommy will compliment you if things go well, and
will encourage you if things are not going so well~

mommy is fully customizable, integrates with any shell, works on any system, and
most importantly, loves you very much~ ❤️

%prep
%setup -q

%clean
rm -rf "%{buildroot}"

%build
make build

%install
make prefix="%{buildroot}/%{_prefix}/" install

%files
%{_bindir}/mommy
%{_mandir}/man1/mommy.1.gz
%{_datarootdir}/fish/vendor_completions.d/mommy.fish
%{_datarootdir}/zsh/site-functions/_mommy

%changelog
# Changelog lists changes to the packaging, not to the software.
* Sat Nov 25 2023 Florine W. Dekker 1.2.5-1
- Rewrite script for OpenBuildService.

* Tue Mar 14 2023 Florine W. Dekker 1.2.3-1
- Initial release with rpkg.
7 changes: 4 additions & 3 deletions pkg/fpm/mommy.spec.rpkg → pkg/rpkg/mommy.spec.rpkg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ License: Unlicense
URL: https://github.com/FWDekker/mommy
VCS: {{{ git_repo_vcs }}}
Source: {{{ git_repo_pack }}}
BuildRequires: git
BuildArch: noarch
BuildRequires: make
BuildRequires: git

%global debug_package %{nil}

Expand All @@ -20,7 +21,7 @@ most importantly, loves you very much~ ❤️

%prep
{{{ git_repo_setup_macro }}}
git clone --depth=1 https://github.com/shellspec/shellspec.git
git clone --depth=1 https://github.com/shellspec/shellspec.git "$(pwd)/shellspec/"

%build
make build
Expand All @@ -29,7 +30,7 @@ make build
make prefix="%{buildroot}/%{_prefix}/" install

%check
PATH="$(pwd)/shellspec:$PATH" MOMMY_EXEC="%{buildroot}/%{_prefix}/bin/mommy" make test/unit
MOMMY_EXEC="%{buildroot}/%{_prefix}/bin/mommy" make shellspec_bin="$(pwd)/shellspec/shellspec" test/unit

%files
%{_bindir}/mommy
Expand Down
2 changes: 2 additions & 0 deletions pkg/rpkg/rpkg.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rpkg]
user_macros = "${git_props:root}/pkg/rpkg/rpkg.macros"
File renamed without changes.

0 comments on commit 0d10761

Please sign in to comment.