Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os-autoinst-obs-auto-submit: Do not fail on expected diff output #372

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

baierjan
Copy link
Member

@baierjan baierjan commented Feb 3, 2025

@@ -129,7 +129,7 @@ generate_os-autoinst-distri-opensuse-deps_changelog() {
echo "-------------------------------------------------------------------"
echo "$(LANG=c date -u) - Dominik Heidler <[email protected]>"
echo
diff -u "$package"-factory.spec "$dir"/"$package"/_service:obs_scm:"$package".spec \
{ diff -u "$package"-factory.spec "$dir"/"$package"/_service:obs_scm:"$package".spec || :; } \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh can we extract that into a function to prevent the confusion about the duplicate code? Like

spec_has_changes_in_requires() {
    local dir="$1"
    local package="$2"
    { diff -u "$package"-factory.spec "$dir"/"$package"/_service:obs_scm:"$package".spec || :; } | grep "^[+-]Requires"
}
…
-    { diff -u "$package"-factory.spec "$dir"/"$package"/_service:obs_scm:"$package".spec || :; } | grep "^[+-]Requires"
+    spec_has_changes_in_requires $dir $package

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even notice it is indeed diffing the very same files. Yes that's a good candidate for refactor then. Will try to do that.

@baierjan
Copy link
Member Author

baierjan commented Feb 3, 2025

I added a new commit which extracts the common code into a new function.

@mergify mergify bot merged commit 56cd1f2 into master Feb 3, 2025
6 checks passed
@mergify mergify bot deleted the diff_exit_code branch February 3, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants