- add the new -only SPDX identifiers
- note that the ones without -only are now deprecated
Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
[\.] is the same as [.], and [-] matches the dash, no need for backclash-escaping.
Also, let's shorten the patches by using alternatives for the common parts.
Before we would match any prefix, even though the matches were clearly intended
to cover the whole file name. Let's use fullmatch to make it clear that the whole
string must be matched.
Fixes https://pagure.io/fedora-rust/rust2rpm/issue/165.
the following workflow wasn't well supported by the check:
- request compat package repo
- fedpkg clone it
- try to run rust2rpm for it
- Get this message:
Crate tiny_http0.6 is already packaged in Fedora (...)
Re-run with --no-existence-check if you still want to convert it.
The documentation files are already included once in installation paths
underneath the crate directory. We need them there because the package might
use them in some way, and anyway we don't want to mess with the crate contents.
Adding them a second time under /usr/share/doc creates duplication. People
generally don't install rust-*-devel packages, and it doesn't make much sense
to provide documentation.
Fixes https://pagure.io/fedora-rust/rust2rpm/issue/164.
This is mainly targeted to the crates using `rust-cc`, where we want to
apply system-wide compiler flags when invoking the compiler. `cc`
supports CFLAGS and CXXFLAGS, but we never set those.
Defining that per project is not possible, as we have no way to inherit
any build context from a dependency package.
Possibly also affects: `bindgen`, `cxx`, any other crate that invokes
the C/C++ compiler and passes the CFLAGSS
Proper fix is quite complex and given we do not package pre-release
versions very often (and esp. not multiple versions of them), this is
good enough (not nice though).
Signed-off-by: Igor Raits <igor.raits@gmail.com>
Fixes https://pagure.io/fedora-rust/rust2rpm/issue/70.
This adds a NEWS file with retroactive entries. We used to add this
information in tag descriptions, but a NEWS file is much easier to
access for users.
$ cargo-inspector -n zola
Traceback (most recent call last):
File "/usr/bin/cargo-inspector", line 33, in <module>
sys.exit(load_entry_point('rust2rpm==18', 'console_scripts', 'cargo-inspector')())
File "/home/zbyszek/python/rust2rpm/rust2rpm/inspector.py", line 78, in main
files = [_cargo_toml(args.path, f) for f in files]
File "/home/zbyszek/python/rust2rpm/rust2rpm/inspector.py", line 78, in <listcomp>
files = [_cargo_toml(args.path, f) for f in files]
File "/home/zbyszek/python/rust2rpm/rust2rpm/inspector.py", line 50, in _cargo_toml
raise FileNotFoundError(f'Cargo.toml not found for binary {binary_or_cargo_toml}')
FileNotFoundError: Cargo.toml not found for binary zola
becomes
$ cargo-inspector -n zola
FileNotFoundError: Cargo.toml not found for binary zola
afbee03f26 tried to suppress tracebacks, but I was testing it by calling
'PYTHONPATH=… python -m rust2rpm' and completely missed the fact that the
setuptools entrypoint wrapper calls main() directly and is not covered by
this.
Also, the same should be done for cargo-inspector.
Fedora's Software Good Licenses List:
https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses
has had CDDL-1.0 and CDDL-1.1 distinguished from each other since 2017.
Update our mapping - and remove the incorrect text that CDDL 1.1 might
not be acceptable.
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
This commit add basic support for crate vendoring in Rust. The user will
use something like `cargo vendor` to create a vendor directory (that can
later be deployed as a tgz) that contains all the dependencies.
This patch will analyze the output of `cargo manifest` to calculate the
closure of dependencies, and via the new parameter `--provides-vendor`,
print all the 'bundled(crate(NAME/FEATURE)) = 0.0.0' provided by the
binary.
The algorithm is not perfect, as today it will include all the features
resolved for the crate (not all the availables, tho), but basically is
something like:
1.- A dependency generator macro, cargo_bundled, will call
cargo-inspector like this:
# In STDIN we will provide the name of the binary
cargo-inspector --provides-vendor --path %{_builddir}
2.- cargo-inspector will search inside the 'path' tree a Cargo.toml that
generate the binary name send via STDIN.
3.- From this point, we go up to the tree to find the top-most
Cargo.toml, as this will be the directory where .cargo/config is living.
We make this directory our `cwd`.
4.- Using the metadata from `cargo manifest`, we generate the closure of
dependencies required by this binary. To simplify the problem, the
current code do not resolve the features, and accept the one resolved by
cargo as valid. Most of the time this will be OK, maybe will include
some extra features needed for other binaries.
5.- Print the 'bundled()' data.
This code will only be executed in the directory 'vendor' is present in
the top-most directory found on step 3.
We shouldn't crash when network communication fails, or when a subprocess fails.
The traceback is unsightly, and causes bug reports to be files. Let's just print
the error.
$ PYTHONPATH=$HOME/python/rust2rpm python -m rust2rpm ./asdfasdf.asdf
error: the manifest-path must be a path to a Cargo.toml file
Subcommand failed with code 101: cargo read-manifest --manifest-path=./asdfasdf.asdf
$ PYTHONPATH=$HOME/python/rust2rpm python -m rust2rpm asdfasdf
Failed to download metadata: 404 Client Error: Not Found for url: https://crates.io/api/v1/crates/asdfasdf/versionsFixes#145.
(This does the relatively easy thing of printing the original message. In
principle we could try to figure out what the exact error was and print uniform
error messages. But that'd be quite a lot of work, and fairly brittle, because
we'd need to cover all possible errors. So let's do this thing which should
be good enough in 95% of cases.)