From d83e351bc73da9fd73e8a4bc74746e7891165fd4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 24 Jul 2021 15:46:42 +0200 Subject: [PATCH] Add script to adjust modules afer dep got migrated the camptocamp/systemd module is now voxpupuli/systemd. I wrote a script to update the namespace in .fixtures.yml, the namespace and upper version in metadata.json and to create a pull request afterwards. Call it like this: ``` export GITHUB_TOKEN=... ./bin/clean-git-checkouts ./bin/systemd_module_migration.sh ``` This script can be adjusted for other modules. None of our modules install the systemd module in spec/spec_helper_acceptance.rb nor spec/acceptance/*, so I didn't implement this. --- bin/systemd_module_migration.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 bin/systemd_module_migration.sh diff --git a/bin/systemd_module_migration.sh b/bin/systemd_module_migration.sh new file mode 100755 index 00000000..b477b883 --- /dev/null +++ b/bin/systemd_module_migration.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +if ! which hub > /dev/null ; then + echo "We require hub later on for the PR" >&2 + exit 1 +fi + +# fix all modules with systemd in .fixtures.yml +sed --in-place 's#camptocamp/puppet-systemd#voxpupuli/puppet-systemd#' modules/voxpupuli/puppet-*/.fixtures.yml + +# identify all modules with systemd from camptocamp in their metadata.json +sed --in-place 's#camptocamp[-,/]systemd#puppet/systemd#' modules/voxpupuli/puppet-*/metadata.json + +# bump the metadata because there was a recent major release +./bin/bump-dependency-upper-bound puppet/systemd 4.0.0 modules/voxpupuli/puppet-*/metadata.json + +# commit and create a PR +for module in modules/voxpupuli/puppet-* ; do + (cd "$module" + git diff --exit-code .fixtures.yml metadata.json + if [ $? != 0 ] ; then + git checkout -b systemd_voxpupuli origin/master + git commit -am 'switch from camptocamp/systemd to voxpupuli/systemd' + git push --set-upstream origin HEAD + # export GITHUB_TOKEN=... https://hub.github.com/hub.1.html + hub pull-request -m 'switch from camptocamp/systemd to voxpupuli/systemd' + fi + ) +done