Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit be39fd1

Browse files
committedAug 13, 2021
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.
1 parent 2f5249d commit be39fd1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
 

‎bin/systemd_module_migration.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
if ! which hub > /dev/null ; then
4+
echo "We require hub later on for the PR" >&2
5+
exit 1
6+
fi
7+
8+
# fix all modules with systemd in .fixtures.yml
9+
sed -i 's#camptocamp/puppet-systemd#voxpupuli/puppet-systemd#' modules/voxpupuli/puppet-*/.fixtures.yml
10+
11+
# identify all modules with systemd from camptocamp in their metadata.json
12+
while read -r file; do
13+
sed -i 's#camptocamp[-,/]systemd#puppet/systemd#' "${file}"
14+
done < <(grep -l "camptocamp[-,/]systemd" modules/voxpupuli/puppet-*/metadata.json)
15+
16+
# bump the metadata because there was a recent major release
17+
./bin/bump-dependency-upper-bound puppet/systemd 4.0.0 modules/voxpupuli/puppet-*/metadata.json
18+
19+
# commit and create a PR
20+
for module in modules/voxpupuli/puppet-* ; do
21+
(cd "$module"
22+
git diff --exit-code .fixtures.yml metadata.json
23+
if [ $? != 0 ] ; then
24+
git checkout -b systemd_voxpupuli origin/master
25+
git commit -am 'switch from camptocamp/systemd to voxpupuli/systemd'
26+
git push --set-upstream origin HEAD
27+
# export GITHUB_TOKEN=... https://hub.github.com/hub.1.html
28+
hub pull-request -m 'switch from camptocamp/systemd to voxpupuli/systemd'
29+
fi
30+
)
31+
done

0 commit comments

Comments
 (0)
Please sign in to comment.