scripts/README.md

57 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2023-02-20 14:27:24 +01:00
Scripts to sync git submodules of a project via pull requests
The git repo in the current directory is expected to have at least
one remote pointing to the target project. If that repo is not
writable, another one can be used for pushing.
create a config file `.settings` in the top level directory of the git submodule project:
```
# name of the remote to push to as repored by `git remote`
PUSH_REMOTE="joesix"
# username on gitea
PR_SRC_USER="joesix"
# target project for pull requests
PR_PROJECT="mold"
# target repo on gitea
PR_REPO="core"
# token
TOKEN="deadbeef"
# the url for cloning the project. Packages may use an url relative
to that.
PACKAGE_BASE_URL="https://gitea.opensuse.org/mold/core.git"
# relative url for new packages
PACKAGE_RELATIVE_URL="../../rpm"
# remote to to send pull requests to
REMOTE="origin"
# base branch of the target remote
BASE_BRANCH="main"
# optional: fixed date or a filename prefixed with @ to get a stable date for testing
DATE="@token"
2023-03-06 16:20:50 +01:00
# optional: OBS projects with a list of packages
OBS_PROJECTS="openSUSE:Factory:Rings:0-Bootstrap"
2023-02-20 14:27:24 +01:00
```
Scripts:
All scripts use getopt, --help may not always be up to date though
:-)
2023-03-06 16:20:50 +01:00
- obspkglist: given obs projects, prints all packages in those projects that
are also in gitea
2023-02-20 14:27:24 +01:00
- updatemodules: checks all submodules for updates. For packages
that need to be updated creates `refs/pq/$packagename`. The
updated refence there updates the submodule commit reference for
updates. It also adds or removes entries from/to `.gitmodules` if
needed. There's also a `--single` option which produces a single
reference for all updates. The `--status` option show the current
2023-03-06 16:20:50 +01:00
state. Use --packages-from to read a package list produced by `obspkglist`.
With the list the script can also add or drop packages.
2023-02-20 14:27:24 +01:00
- pusher: compares the references created by the `updatemodules`
script with the specified remote. Pushed pending refs to an
`update_$packagename` ref. Gitea doesn't seem to support refs in
subdirs other than `heads`, that's why. Unless the `--dry` option
is specified, the `pusher` script also creates pull requests for
pending refs.
- gitea-pulls: dialog based script to list, view, merge or close
pull requests from the command line.