# **`phpmyadmin`**

## Description
`phpmyadmin` is a MySQL & MariaDB web administration tool.

## Installation

Add the [compositiv GmbH](https://www.compositiv.com) apt repository:

```bash
apt update && apt -y install apt-transport-https gnupg lsb-release sudo curl
curl -fsSL https://deb.cmpsrv.com/key.pub | gpg --dearmor > gpg --dearmor -o /usr/share/keyrings/compositiv.gpg
cat >/etc/apt/sources.list.d/compositiv.list <<EOF
### /etc/apt/sources.list.d/compositiv.list
# 

deb [signed-by=/usr/share/keyrings/compositiv.gpg] https://deb.cmpsrv.com/compositiv/ $(lsb_release -cs) main
EOF
```

Install the package:

```bash
apt update && apt install phpmyadmin
```

## Packaging
To update the software package, fetch the current stable release from the [GitHub repository](https://github.com/phpmyadmin/phpmyadmin) and create a local branch to apply packaging changes:

```bash
git remote add -t STABLE upstream https://github.com/phpmyadmin/phpmyadmin.git                # add remote if necessary
git fetch upstream                                                                            # fetch remote data
git switch master                                                                             # switch to master branch
git log --format='%h %ae: %s' --perl-regexp --author='.+(compositiv|winterstein).*' | tac     # show commits by compositiv users
commits=$(git log --format='%h' --perl-regexp --author='.+(compositiv|winterstein).*' | tac)  # save hashes of commits by compositiv users
git checkout upstream/STABLE                                                                  # check out current stable version
git describe --tags --match="RELEASE*" --abbrev=0                                             # get latest release tag in current branch
git switch -c <version>-cmp                                                                   # create a new local branch for current version, replace <version>, i.e. 5.2.0-cmp
for commit in $commits; do git cherry-pick $commit; done                                      # cherry-pick all commits by compositiv users
```

After applying all compositiv changes, you need to add an entry to [`debian/changelog`](debian/changelog). You can either use the `dch` tool (available from the `devscripts` software package) or manually edit the file. Please retain the versioning syntax:  
`<upstream version number>+cmp.<compositiv patch level>~REPLACE_DIST`  
Only fill in `<upstream version number>` and `<compositiv patch level>` (starting with `0`). `REPLACE_DIST` will automatically be replaced with the respective distribution names during the build process.

The build process for the `.deb` package is automated with the [Gitlab CI/CD tools](https://docs.gitlab.com/ee/ci/) via [.gitlab-ci.yml](.gitlab-ci.yml), which contains the three stages `build`, `test` and `deploy`.  
Building and testing is triggered automatically with each `git push`.  
If those stages finish successfully, the package can be manually deployed to the apt repository on the [CI/CD](https://gitlab.compositiv.com/deb/pma/-/pipelines) page by clicking the rightmost of the three buttons and then starting the deploy jobs for each distribution via the respective `>` buttons on the right.  
The new package version is then published to the `aptly` service on `deb.cmpsrv.com`.
