Skip to content

Commit f57755c

Browse files
authored
Merge pull request #29 from yast/alts-alternatives
Added support for `alts` alternatives as a replacement for the `update-alternatives`. See https://en.opensuse.org/openSUSE:Update-alternatives_migration
2 parents 4614b3b + f3ab1cf commit f57755c

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# A special non-standard configuration for the `shfmt` tool which matches any
7+
# file with a shell hashbang on the first line, it does not need the *.sh
8+
# extension in the file name (needs shfmt >= 3.8.0).
9+
#
10+
# To reformat all files run `shfmt -w -l .` at the top-level directory.
11+
[[shell]]
12+
indent_style = space
13+
indent_size = 2
14+
switch_case_indent = true
15+
space_redirects = true
16+
trim_trailing_whitespace = true

package/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
FROM opensuse/tumbleweed
77

88
# do not install the files marked as documentation (use "rpm --excludedocs")
9-
RUN sed -i -e "s/^.*rpm.install.excludedocs.*/rpm.install.excludedocs = yes/" /etc/zypp/zypp.conf
9+
RUN zypper --non-interactive install --no-recommends zypp-excludedocs
1010

1111
# import the YaST OBS GPG key
1212
COPY YaST:Head.pub /usr/share/gpg-keys/

package/yast-ci-ruby

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function set_defaults() {
5858
RUN_RUBOCOP=1
5959
else
6060
RUN_RUBOCOP=0
61-
fi;
61+
fi
6262

6363
if [ -e .spell.yml ]; then
6464
RUN_CHECK_SPELLING=1
@@ -126,6 +126,7 @@ function exclude() {
126126
echo "ERROR: Unknown step: '$1'"
127127
echo "Known steps: $ALL_STEPS"
128128
exit 1
129+
;;
129130
esac
130131
EXCLUDE_USED=1
131132
}
@@ -168,6 +169,7 @@ function run_only() {
168169
echo "ERROR: Unknown step: '$1'"
169170
echo "Known steps: $ALL_STEPS"
170171
exit 1
172+
;;
171173
esac
172174
RUN_ONLY_USED=1
173175
}
@@ -188,7 +190,17 @@ function dump_settings() {
188190
function set_rubocop_version() {
189191
# here we need to set path exactly as update-alternatives needs, so find proper path from its output
190192
RUBOCOP_PATH=$(update-alternatives --display rubocop | sed "/^[^[:space:]]\+$1"'/!d;s/^\([^[:space:]]\+\).*$/\1/')
191-
update-alternatives --set rubocop "$RUBOCOP_PATH"
193+
if [ -n "$RUBOCOP_PATH" ]; then
194+
update-alternatives --set rubocop "$RUBOCOP_PATH"
195+
else
196+
RUBOCOP_PATH=$(alts -l rubocop | grep "Target:" | sed "s/^.*Target:\s*\(\S.*\)$/\1/" | grep "$1")
197+
if [ -n "$RUBOCOP_PATH" ]; then
198+
alts -s -n rubocop "$RUBOCOP_PATH"
199+
else
200+
echo "ERROR: Cannot set the default Rubocop version to $1"
201+
exit 1
202+
fi
203+
fi
192204
}
193205

194206
# run parallel rubocop if it is available,
@@ -212,11 +224,11 @@ function check_perl() {
212224
# Perl allows checking the syntax only for one file at once, we need to use -n1
213225
# xargs option, to speed it up run the checks in parallel (-P option).
214226
# If you need to specify an additional search path use the PERL5LIB environment variable.
215-
find . -type f -name '*.p[ml]' -print0 \
216-
| xargs -0 -P"$(nproc)" -n1 perl -I src/modules -I /usr/share/YaST2/modules -w -c
227+
find . -type f -name '*.p[ml]' -print0 |
228+
xargs -0 -P"$(nproc)" -n1 perl -I src/modules -I /usr/share/YaST2/modules -w -c
217229
}
218230

219-
# initializa the defaults and parse the command line options
231+
# initialize the defaults and parse the command line options
220232

221233
set_defaults
222234

0 commit comments

Comments
 (0)