jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.09k stars 1.07k forks source link

Python test fails when fpm project directory is read-only #1995

Open jordansissel opened 1 year ago

jordansissel commented 1 year ago

This impacts development only, I think, as it is only a failing test.

I'm running this in a podman container with the fpm git workspace mounted from the host as read-only.

Test output that fails:

  1) FPM::Package::Python when :python_downcase_name? is false when :python_fix_name? is true and :python_package_name_prefix is nil/default should prefix the package with 'python-'
     Failure/Error: subject.input(example_dir)
     FPM::Util::ProcessFailed:
       python3 failed (exit code 1). Full command was:["python3", "setup.py", "install", "--root", "/tmp/package-python-staging-cbb6c2174c90e42dba2d8febe734ba8efe9ae04fa34d6647a8c560525ea6"]
     # ./lib/fpm/util.rb:194:in `safesystem'
     # ./lib/fpm/package/python.rb:373:in `block in install_to_staging'
     # ./lib/fpm/package/python.rb:334:in `chdir'
     # ./lib/fpm/package/python.rb:334:in `install_to_staging'
     # ./lib/fpm/package/python.rb:112:in `input'
     # ./spec/fpm/package/python_spec.rb:61:in `block (5 levels) in <top (required)>'

Finished in 14.27 seconds (files took 1.02 seconds to load)
173 examples, 1 failure, 47 pending

Reproducing the test with the fpm command-line, capturing the file activity with trace:

[jls@fpm]~/projects/fpm% strace -fo /tmp/x -e trace=file bundle exec bin/fpm -s python --python-bin=python3 -t deb --no-python-fix-name --verbose spec/fixtures/python/
Setting workdir {:workdir=>"/tmp", :level=>:info}
fetching package metadata {:setup_cmd=>"env PYTHONPATH=/home/jls/projects/fpm/lib/fpm/package:$PYTHONPATH python3 setup.py --command-packages=pyfpm get_metadata --output=/tmp/package-python-build-fbe67cf5773573482c5385591a61265cb511d9821c8ad55cb663118c8437/metadata.json", :level=>:info}
running get_metadata {:level=>:info}
object output of get_metadata {:json=>{"name"=>"Example", "version"=>"1.0", "author"=>"sample author <sample email>", "description"=>"sample description", "license"=>nil, "url"=>"sample url", "architecture"=>"all", "dependencies"=>["Dependency1", "dependency2", "rtxt-dep4"]}, :level=>:info}
running install {:level=>:info}
/usr/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. {:level=>:info}
  warnings.warn( {:level=>:info}
running build {:level=>:info}
running install_egg_info {:level=>:info}
running egg_info {:level=>:info}
error: [Errno 13] Permission denied {:level=>:info}
Process failed: python3 failed (exit code 1). Full command was:["python3", "setup.py", "install", "--root", "/tmp/package-python-staging-d1b2971dbf17e31e619cd51bfdba0da1962e6b03e7ade170f81b44acb8a8"] {:level=>:error}

Possibly relevant trace:

1057  newfstatat(AT_FDCWD, "Example.egg-info", {st_mode=S_IFDIR|0755, st_size=224, ...}, 0) = 0
1057  utimensat(AT_FDCWD, "Example.egg-info", NULL, 0) = -1 EACCES (Permission denied)
1057  +++ exited with 1 +++

For some reason python setuptools(?) is trying to modify the file timestamp of things in the directory where the fpm's sample python module lives.