Skip to content

Commit

Permalink
Rework cargo pattern use
Browse files Browse the repository at this point in the history
In cases where a package has both a Makefile and a Cargo.toml try and
use the make pattern (the options.conf flag for cargo vendor still
needs to be changed). When the cargo pattern is being used, use cargo
install as well. More complex cases likely should just be patched into
a Makefile and perhaps submitted upstream.

Signed-off-by: William Douglas <william.douglas@intel.com>
  • Loading branch information
bryteise committed Jan 3, 2025
1 parent 5424026 commit f4a13a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion autospec/buildreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ def scan_for_configure(self, dirn, tname, config):
for dirpath, _, files in os.walk(dirn):
default_score = 2 if dirpath == dirn else 1

if "Cargo.toml" in files:
if "Cargo.toml" in files and 'Makefile' not in files:
config.set_build_pattern('cargo', default_score)

if "CMakeLists.txt" in files and "configure.ac" not in files:
Expand Down
13 changes: 5 additions & 8 deletions autospec/specfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,14 +2067,11 @@ def write_cargo_pattern(self):
self.write_license_files()
if self.config.subdir:
self._write_strip("pushd " + self.config.subdir)
if self.config.install_macro:
self._write_strip(self.config.install_macro)
else:
self._write_strip("cargo install --path .")
self._write_strip("mkdir -p %{buildroot}/usr/bin")
self._write_strip('pushd "${HOME}/.cargo/bin/"')
self._write_strip("mv * %{buildroot}/usr/bin/")
self._write_strip("popd")
self._write_strip("cargo install --path .")
self._write_strip("mkdir -p %{buildroot}/usr/bin")
self._write_strip('pushd "${HOME}/.cargo/bin/"')
self._write_strip("mv * %{buildroot}/usr/bin/")
self._write_strip("popd")
if self.config.subdir:
self._write_strip("popd")
self.write_install_append()
Expand Down

0 comments on commit f4a13a5

Please sign in to comment.