Skip to content

Commit

Permalink
Add script to adjust modules afer dep got migrated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bastelfreak committed Jul 1, 2023
1 parent b1e668c commit d83e351
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bin/systemd_module_migration.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d83e351

Please sign in to comment.