Page MenuHomePureOS Tracker

Please provide scripts to create downstream forks
Open, NormalPublic


Currently creating a downstream fork seems to go like:

  • go to salsa and find the repo
  • import that into gitlab via the web-ui
  • tweak repo settings (fast-forward-merges, repo public, protected branches, ...) via the web-ui
  • create a pureos/master || pureos/latest branch
  • create a personal fork
  • pureos busy work (d/gbp.conf, d/control (VCS, maintainers), gitlab-ci
  • make pureos specific changes
  • create a merge request

I see two parts here:

  • gitlab
  • local repo

automating either of these woudl help. Automating the gitlab part would lead to more consistency since we could use the same thing to check existing repos (some are private, branch/tag protection isn't consistent, ...)

Event Timeline

guido renamed this task from Please provide scripts to manager downstream forks to Please provide scripts to create downstream forks.Mar 2 2021, 02:33
guido created this task.

I am not fluent in Gitlab, but for the local repo part, I use this:


set -eu

# Examples:
# * debian/
# * debian/control-in

# Examples:
# * ^:debian:
# * '^(?::debian:)?'



perl -i -pe 's/'$PREFIX'Maintainer:\K/ PureOS Maintainers <pureos-project\>\nXSBC-Original-Maintainer:/' "$CONTROL"
git commit -m "fork for PureOS: set PureOS Maintainers as maintainer, leaving original as XSBC-Original-Maintainer" "$CONTROL"
if grep -q "${PREFIX}Uploaders:" "$CONTROL"; then
	perl -i -0777 -pe 's/'$PREFIX'Uploaders:.*(?:\n\h.*)*\n//m' "$CONTROL"
	git commit -m "fork for PureOS: drop uploaders (unused by PureOS Maintainers)" "$CONTROL" || true
perl -i -0777 -pe 's/'$PREFIX'Vcs-([^ :]+:).*(?:\n\h.*)*\n//gm' "$CONTROL"
URL="$GIT_AREA/$(basename $(pwd))" perl -i -0777 -pe 's,\n\n,\nVcs-Git: $ENV{URL}.git\nVcs-Browser: $ENV{URL}\n\n,m' "$CONTROL"
git commit -m "fork for PureOS: replace Vcs-* fields" "$CONTROL"
if [ -f "$GBP_CONF" ]; then
	if grep -q "^debian-branch" "$GBP_CONF"; then
		perl -i -pe "s,^debian-branch\s*=\s*\K.*,pureos/\Q$SUITE\E," "$GBP_CONF"
		git commit -m "fork for PureOS: adapt git-buildpackage debian-branch" "$GBP_CONF"
	elif grep -q '^\[DEFAULT\]' "$GBP_CONF"; then
		perl -i -0777 -pe "s,^\[DEFAULT\]\h*\K,\ndebian-branch = pureos/\Q$SUITE\E,m" "$GBP_CONF"
		git commit -m "fork for PureOS: add git-buildpackage setting debian-branch" "$GBP_CONF"
		echo 'ERROR: failed to add debian-branch to git-buildpackage config'
		exit 1
	cat <<EOF > "$GBP_CONF"
# Configuration file for git-buildpackage and friends

pristine-tar = True
sign-tags = True
filter = */.git*
debian-branch = pureos/$SUITE
	git add "$GBP_CONF"
	git commit -m "fork for PureOS: add git-buildpackage config" "$GBP_CONF"

See also which contains above script + my notes on surrounding tasks that I have so far been unable to automate, because I have so far found to it too variable across packages.

jonas.smedegaard triaged this task as Normal priority.May 25 2021, 10:19