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

Use File.exist? for Ruby 3.2 compatibility #1216

Merged
merged 2 commits into from
Jan 20, 2023

Conversation

voxik
Copy link
Contributor

@voxik voxik commented Jan 4, 2023

Preparing Ruby 3.2 for Fedora, I have noticed that sdformat package build fails:

... snip ...

[  4%] Running xml schema compiler on actor.sdf
cd /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/sdf/1.6 && /usr/bin/ruby /builddir/build/BUILD/sdformat-6.0.0/tools/xmlschema.rb -s /builddir/build/BUILD/sdformat-6.0.0/sdf/1.6 -i /builddir/build/BUILD/sdformat-6.0.0/sdf/1.6/actor.sdf -o /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/sdf/1.6 [  5%] Building CXX object src/CMakeFiles/sdformat.dir/Exception.cc.o
cd /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/src && /usr/bin/g++ -Dsdformat_EXPORTS -DBUILDING_DLL -I/builddir/build/BUILD/sdformat-6.0.0/test/gtest/include -I/builddir/build/BUILD/sdformat-6.0.0/include -I/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build -I/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/include -isystem /usr/include/ignition/math4 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1   -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Waddress -Warray-bounds -Wcomment -Wformat -Wnonnull -Wparentheses -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var -Wextra -Wno-long-long -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wfloat-equal -Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic -Wno-pragmas -Wc++11-compat -DNDEBUG -fPIC   -fPIC -MD -MT src/CMakeFiles/sdformat.dir/Exception.cc.o -MF CMakeFiles/sdformat.dir/Exception.cc.o.d -o CMakeFiles/sdformat.dir/Exception.cc.o -c /builddir/build/BUILD/sdformat-6.0.0/src/Exception.cc
/builddir/build/BUILD/sdformat-6.0.0/tools/xmlschema.rb:268:in `<main>': undefined method `exists?' for File:Class (NoMethodError)

elsif !File.exists?(infile)
           ^^^^^^^^
Did you mean?  exist?
gmake[2]: *** [sdf/1.6/CMakeFiles/schema1_6.dir/build.make:130: sdf/1.6/actor.xsd] Error 1 gmake[2]: Leaving directory '/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build' gmake[1]: *** [CMakeFiles/Makefile2:1675: sdf/1.6/CMakeFiles/schema1_6.dir/all] Error 2 gmake[1]: *** Waiting for unfinished jobs....
[  5%] Building CXX object src/CMakeFiles/sdformat.dir/Filesystem.cc.o

... snip ...

This is due to this change in Ruby:

https:/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/NEWS.md?plain=1#L589

Please note that I have not tested this patch in any way. Just thought that it will be better to sent PR instead of opening ticket :)

Preparing Ruby 3.2 for Fedora, I have noticed that sdformat package
build fails:

~~~
... snip ...

[  4%] Running xml schema compiler on actor.sdf
cd /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/sdf/1.6 && /usr/bin/ruby /builddir/build/BUILD/sdformat-6.0.0/tools/xmlschema.rb -s /builddir/build/BUILD/sdformat-6.0.0/sdf/1.6 -i /builddir/build/BUILD/sdformat-6.0.0/sdf/1.6/actor.sdf -o /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/sdf/1.6
[  5%] Building CXX object src/CMakeFiles/sdformat.dir/Exception.cc.o
cd /builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/src && /usr/bin/g++ -Dsdformat_EXPORTS -DBUILDING_DLL -I/builddir/build/BUILD/sdformat-6.0.0/test/gtest/include -I/builddir/build/BUILD/sdformat-6.0.0/include -I/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build -I/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build/include -isystem /usr/include/ignition/math4 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1   -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Waddress -Warray-bounds -Wcomment -Wformat -Wnonnull -Wparentheses -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var -Wextra -Wno-long-long -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wfloat-equal -Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic -Wno-pragmas -Wc++11-compat -DNDEBUG -fPIC   -fPIC -MD -MT src/CMakeFiles/sdformat.dir/Exception.cc.o -MF CMakeFiles/sdformat.dir/Exception.cc.o.d -o CMakeFiles/sdformat.dir/Exception.cc.o -c /builddir/build/BUILD/sdformat-6.0.0/src/Exception.cc
/builddir/build/BUILD/sdformat-6.0.0/tools/xmlschema.rb:268:in `<main>': undefined method `exists?' for File:Class (NoMethodError)

elsif !File.exists?(infile)
           ^^^^^^^^
Did you mean?  exist?
gmake[2]: *** [sdf/1.6/CMakeFiles/schema1_6.dir/build.make:130: sdf/1.6/actor.xsd] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/sdformat-6.0.0/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:1675: sdf/1.6/CMakeFiles/schema1_6.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[  5%] Building CXX object src/CMakeFiles/sdformat.dir/Filesystem.cc.o

... snip ...
~~~

This is due to this change in Ruby:

https:/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/NEWS.md?plain=1#L589

Signed-off-by: Vít Ondruch <[email protected]>
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Jan 4, 2023
Copy link
Collaborator

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Merging #1216 (c463536) into sdf13 (897fe9c) will not change coverage.
The diff coverage is n/a.

❗ Current head c463536 differs from pull request most recent head 95b39d5. Consider uploading reports for the commit 95b39d5 to get more accurate results

@@           Coverage Diff           @@
##            sdf13    #1216   +/-   ##
=======================================
  Coverage   87.20%   87.20%           
=======================================
  Files         124      124           
  Lines       16229    16229           
=======================================
  Hits        14152    14152           
  Misses       2077     2077           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@voxik
Copy link
Contributor Author

voxik commented Jan 5, 2023

The macOS failure seems to be unrelated

@azeey azeey merged commit 09e9f94 into gazebosim:sdf13 Jan 20, 2023
@azeey
Copy link
Collaborator

azeey commented Jan 20, 2023

After I merged, I noticed the logs say sdformat-6.0.0. Are you actually building v6.0.0? That version is no longer supported, FYI.

@voxik
Copy link
Contributor Author

voxik commented Jan 20, 2023

After I merged, I noticed the logs say sdformat-6.0.0. Are you actually building v6.0.0? That version is no longer supported, FYI.

Thx for heads up. That might very well by the case, but I'll leave the update to sdformat Fedora maintainer.

@azeey azeey mentioned this pull request Jan 25, 2023
8 tasks
scpeters pushed a commit that referenced this pull request Jan 25, 2023
`File.exists?` has been deprecated and is now removed in Ruby 3.2. 

https:/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/NEWS.md?plain=1#L58

Signed-off-by: Vít Ondruch <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
scpeters pushed a commit that referenced this pull request Jan 26, 2023
`File.exists?` has been deprecated and is now removed in Ruby 3.2. 

https:/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/NEWS.md?plain=1#L58

Signed-off-by: Vít Ondruch <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
mjcarroll pushed a commit that referenced this pull request Feb 9, 2023
`File.exists?` has been deprecated and is now removed in Ruby 3.2. 

https:/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/NEWS.md?plain=1#L58

Signed-off-by: Vít Ondruch <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants