Skip to content

Commit 352a9e9

Browse files
committed
github-actionify.sh: eliminate xmllint dependency
Let's just use our old friend grep instead. It's good enough, it's smart enough, and people like it.
1 parent a85e193 commit 352a9e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

github-actionify.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ process() {
6767

6868
# -- Git sanity checks --
6969

70-
repoSlug=$(xmllint --xpath '//*[local-name()="project"]/*[local-name()="scm"]/*[local-name()="connection"]' pom.xml | sed 's_.*github.com[:/]\(.*\)<.*_\1_')
70+
repoSlug=$(grep '<connection>' pom.xml | sed 's;.*github.com[/:]\(.*/.*\)</connection>.*;\1;')
7171
test "$repoSlug" && info "Repository = $repoSlug" || die 'Could not determine GitHub repository slug'
7272
case "$repoSlug" in
7373
*.git)
@@ -88,7 +88,7 @@ process() {
8888

8989
# -- POM sanity checks --
9090

91-
parent=$(xmllint --xpath '//*[local-name()="project"]/*[local-name()="parent"]/*[local-name()="artifactId"]' pom.xml | sed 's/[^>]*>//' | sed 's/<.*//')
91+
parent=$(grep -A4 '<parent>' pom.xml | grep '<artifactId>' | sed 's;.*<artifactId>\(.*\)</artifactId>.*;\1;')
9292
if [ -z "$SKIP_PARENT_CHECK" ]
9393
then
9494
test "$parent" = "pom-scijava" ||
@@ -221,7 +221,7 @@ EOL
221221
# Upgrade version of pom-scijava.
222222
if [ -z "$SKIP_PARENT_CHECK" ]
223223
then
224-
version=$(xmllint --xpath '//*[local-name()="project"]/*[local-name()="parent"]/*[local-name()="version"]' pom.xml | sed 's/[^>]*>//' | sed 's/<.*//')
224+
version=$(grep -A4 '<parent>' pom.xml | grep '<version>' | sed 's;.*<version>\(.*\)</version>.*;\1;')
225225
# HACK: Using a lexicographic comparison here is imperfect.
226226
if [ "$version" \< "$pomMinVersion" ]
227227
then
@@ -292,7 +292,7 @@ secrets to your GitHub organization if they aren't already present.
292292
EOL
293293

294294
# call check method to verify prerequisites
295-
check git sed perl xmllint
295+
check git grep sed perl
296296

297297
# parse arguments
298298
EXEC=:

0 commit comments

Comments
 (0)