Commit graph

374 commits

Author SHA1 Message Date
a15e90542d
patching: fix datetimes in generated patches 2023-02-13 23:18:23 +01:00
8cb17e350b
crate, patching: move processing of source trees into separate modules 2023-02-13 23:11:32 +01:00
0f2e5ab6f2
sysinfo: move os-release parsing into separate module
Any opened files are now also closed after reading them.
2023-02-13 19:50:17 +01:00
04531df43c
distgit: fix check for repository existence 2023-02-13 19:37:39 +01:00
c8d35e0f69
cratesio, distgit: use urllib.parse.urljoin from std directly
This method has been in Python 3 std for years, there is no need to
import it via requests.compat.urljoin.
2023-02-13 19:25:23 +01:00
3e7f4ea556
start moving functionality out of __main__ 2023-02-13 19:16:18 +01:00
ac58d59812
tests: fix arguments for foreign patching test 2023-02-13 18:32:48 +01:00
3eab0fef8e
tests: fix spec generator test and update test fixtures 2023-02-13 18:18:54 +01:00
cbb1ea5ae7
tests: test drop_foreign_dependencies separately from spec generation 2023-02-13 17:53:03 +01:00
387741279c
remove RPM macros and generators (moved to rust-packaging project) 2023-02-11 21:45:28 +01:00
4af8c39fed
remove unused cargo-inspector executable (replaced by cargo2rpm) 2023-02-11 21:42:50 +01:00
f8ea7144d8
account for new dep:foo syntax when patching foreign dependencies 2023-02-11 01:42:00 +01:00
a0b4b78a01
Metadata: determine actually correct list of features 2023-02-11 01:27:42 +01:00
Davide Cavalca
3443c98887 Only enable frame pointers for approved arches 2023-01-26 14:04:12 -08:00
b5c64f585e
rust2rpm: update test fixtures for 2023 2023-01-05 17:49:57 +01:00
Davide Cavalca
c2176f219f Add conditional support for always including frame pointers
If `%_include_frame_pointers` is defined, add
`-Cforce-frame-pointers=yes` to the compiler flags to ensure frame
pointers are always included.

This is in preparation for
https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer

See
https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/230
for the corresponding implementation in redhat-rpm-config.
2022-12-28 12:33:00 -08:00
d9aa58b6cb
rust2rpm: fix edge cases in cfg-expression evaluation
Some cfg-expressions evaluated to "False" because all target_arch
checks were evaluated as "True", but that broke in situations where
the cfg-expression checked for the *absence* of a match for a specific
target_arch.

With this change, cfg-expressions are now evaluated once for every
supported target_arch, and they evaluate to "True" if the expression
evaluated to "True" for *any* value of target_arch.
2022-11-07 20:57:50 +01:00
3dec94dc85
add more tests for version comparisons and reformat with black 2022-11-03 21:40:20 +01:00
Michel Alexandre Salim
6a5931b7dd
Fix CargoSemVer.eval_ KIND_GTE and KIND_LTE comparisons
Just make use of KIND_GT/KIND_LT and KIND_SHORTEQ

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2022-10-31 12:54:37 -05:00
Michel Alexandre Salim
1869f5a7e0
Add tests for CargoSemVer.eval_
There are logic errors in `KIND_GTE` and `KIND_LTE`, surface them with
the new test

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2022-10-31 12:53:38 -05:00
09a496c65e
rust2rpm: fix crash in sorting of binary targets
The "sort" Jinja2 filter doesn't work because the bins are objects,
not strings. This commit changes the sorting to happen correctly,
before binary targets are passed to the template for rendering.
2022-10-31 15:26:11 +01:00
08e54604ce
Version 23 2022-10-27 12:33:41 +02:00
f6cac07c8d
tests: fix regex used for replacing "# Generated by rust2rpm NNN" 2022-10-26 12:30:25 +02:00
ff04186184
rust2rpm: add support for "testrequires" setting in rust2rpm.conf
Dependencies listed as "testrequires" are handled the same as dependencies
that are listed as "buildrequires", except that they are wrapped in an
"%if %{with check}" conditional in the generated spec file.
2022-10-26 11:58:13 +02:00
60dc5dfb99
macros: replace i686 with %{ix86} in %{rust_arches}
This change has been present in downstream Fedora packaging for ages,
let's just merge it upstream.
2022-10-26 11:45:49 +02:00
feab8e6a41
rust2rpm: drop ExclusiveArch: %{rust_arches} on Fedora
RPM will gain a dependency on a Rust component (rpm-sequoia), so all
architectures supported by RPM will by definition be the architectures
supported by Rust, making the ExclusiveArch tag unnecessary.

c.f. https://pagure.io/fedora-rust/rust2rpm/issue/228
c.f. https://pagure.io/packaging-committee/issue/1220
2022-10-26 11:38:11 +02:00
69b5574ce0
Add %cargo_license and %cargo_license_summary macros 2022-10-19 11:39:20 +02:00
23523b5fdc
rust2rpm: fall back to latest pre-release if there is no stable release
This situation can occur in two ways:
- either the crate has published only pre-releases so far, or
- all previously published stable releases were yanked
2022-10-11 14:19:08 +02:00
93e10cba84
spec template: sort listed binaries in %files listing 2022-10-11 13:03:21 +02:00
5bc8840a67
rust2rpm: only remove optional target-specific deps from features 2022-10-09 21:24:57 +02:00
c026764e94
Adapt cfg-expression evaluation for the new wasm64 target_arch 2022-09-05 17:20:43 +02:00
55998b3bd2
Ensure both generated and manual patches affect spec generation
Previous to this change, if there were no manual changes, the automatically
generated patch would not affect the calculated metadata, and result in
broken .spec files.
2022-07-26 12:13:47 +02:00
f0d04b09e8
Ensure rust2rpm doesn't autogenerate architecture-dependent patches
The logic in the cfg-expression evaluator checked *too many cases*,
some of which would have resulted in generation of broken patches
and packages. We need to ensure that the evaluation is independent
of the host architecture (i.e. we need to keep *all* dependencies
that are valid on *any* of our build targets, even if they end up
being unused on *some* of them).
2022-07-25 12:09:43 +02:00
cc4e5fd341
Version 22 2022-07-24 18:55:35 +02:00
a16df5f90f
Enforce consistent formatting with black 2022-07-24 18:47:09 +02:00
f31fd721f5
Ensure rust2rpm reads crate metadata is read from the patched file
When the automatic patching step was implemented, the metadata started
being read from the original Cargo.toml file instead of from the one
with manually applied changes.
2022-07-24 13:01:40 +02:00
c4488a3fe8
Prettify and slightly reformat printed log messages 2022-07-24 12:52:09 +02:00
67c878e32a
Implement simple logging; ensure rust2rpm --stdout still works 2022-07-24 11:21:30 +02:00
a090caaa62
Adapt diff files generated by rust2rpm v22 to be more like those from v21
- change file names of written patches to match the old one
- don't leak the name of temporary directories into the diff
2022-07-24 10:07:33 +02:00
1763c73dfa
Ensure exactly one trailing newline in rendered spec files 2022-07-24 00:54:18 +02:00
53d07c28ad
Drop false claims of support Python 3.8 or 3.9
Recent changes (in particular, use of the new "structural pattern
matching" syntax, which was introduced in Python 3.10) were already
incompatible with Python <3.10, but neither the tox settings nor
the project metadata had been updated to reflect this fact.

Fedora 35, the oldest currently supported branch of Fedora, already
ships with Python 3.10 by default, so we don't drop support for any
current Fedora releases.
2022-07-23 19:41:48 +02:00
407e56c606
Update tox environments to match supported Python versions 2022-07-23 18:58:24 +02:00
1209f5f08f
Port to declarative setuptools configuration 2022-07-22 17:45:04 +02:00
c464cecfff
Add missing pyparsing dependency to setup.py install_requires 2022-07-22 16:51:33 +02:00
c834a9658a
Update tox settings to work with the latest changes 2022-07-22 15:48:14 +02:00
fb78d645d6 README: add brief note about testing 2022-07-21 13:11:13 +02:00
aa7e1310d2
minor code fixes and cleanups all around 2022-07-20 20:53:36 +02:00
6e9bbc14e5 Declare compatiblity with python3.11
Tested with python3-3.11.0~b3-8.fc37.x86_64, seems to work fine.
2022-07-15 15:05:30 +02:00
6712419366 cfg: rename variable for clarity 2022-07-15 15:05:30 +02:00
d231aa7d0b cfg: fix compatibility with pyparsing 2.4.7
I was developing this with 3.0.1. Seems to work fine after some simple
adjustments.
2022-07-15 15:05:27 +02:00