The infrastracture to translate the license remains in place.
We can remove it later, when all users are gone. I'm keeping
the behaviour for Mageia unchanged for now. I assume that they'll
want to follow the change in Fedora later too.
We still want to do syntax cleanup with translate_slashes().
Fixes#193.
The code is complicated by passing behaviour options through multiple
levels. This is already hard to read because the names are different
at different levels. Let's just pass args, so that it's easy to add
new options in the future.
I don't have enough energy to do this for all functions, but I'll try
to add some docs as I look at the code. The project is growing and it's
harder to remember what all the parts do.
This new setting works the same way as the `--all-features` CLI flag
when set to `true`. This makes it possible to set it to `true` permanently,
without having to remember to use the CLI flag when running rust2rpm.
Using .rust2rpm.conf is confusing to new users, because they never see
these files in existing packages and are only seeing magic happen.
This commit changes the default location of the configuration file to
./rust2rpm.conf, and will rename existing .rust2rpm.conf or _rust2rpm.conf
files to the new name if they already exist.
I have also added a little more documentation about the config file itself
to the README.
When store_true or store_false are used, the default default changes
from None to a boolean. I didn't know about this, and I wrote the code
to assume args.rpmautospec would be None. rpmautospec detection was
effectively always disabled.
The Fedora Packaging Guidelines are clear on this:
> If the base package name ends with a digit, a single underscore (_)
> MUST be appended to the name, and the version MUST be appended to
> that, in order to avoid confusion over where the name ends and the
> version begins.
>
> If the base package name does not end with a digit, the version MUST
> be directly appended to the package name with no intervening
> separator.
Fixes#180.
%build_rustflags was used in %cargo_prep, which is executed in %prep,
when %buildsubdir is not set yet. To avoid this, insertion of flags is
moved to an environment variable that is set for %cargo_build and
%cargo_test.
The linker flag gets passed to rustc, and resulting binaries seem to have
note as expected.
I'm keeping this separate becuase it's logically a seperate change.
In the -devel package, we installed the files once. I think it's nice
to mark them as %doc, so that it shows up correctly when filtered
by rpm attributes.
After a mock build with the changes here:
$ rpm -Vv -p /var/lib/mock/fedora-rawhide-x86_64/result/rust-rust-ini-devel-0.17.0-6.fc37.noarch.rpm
...
missing /usr/share/cargo/registry/rust-ini-0.17.0
missing /usr/share/cargo/registry/rust-ini-0.17.0/.cargo-checksum.json
missing /usr/share/cargo/registry/rust-ini-0.17.0/Cargo.toml
missing l /usr/share/cargo/registry/rust-ini-0.17.0/LICENSE
missing d /usr/share/cargo/registry/rust-ini-0.17.0/README.rst
missing /usr/share/cargo/registry/rust-ini-0.17.0/examples
missing /usr/share/cargo/registry/rust-ini-0.17.0/examples/test.rs
missing /usr/share/cargo/registry/rust-ini-0.17.0/rustfmt.toml
missing /usr/share/cargo/registry/rust-ini-0.17.0/src
missing /usr/share/cargo/registry/rust-ini-0.17.0/src/lib.rs
Before, we'd use the same pattern for the main package (if present),
and the -devel files:
%license LICENSE1 LICENSE2
Since the create usually also installs the license files to %create_instdir,
we end up with duplicated files in -devel.
It seems reasonable to reuse the file that is already present in
%create_instdir. Fedora packaging guidelines only say that "%license
must be used for license files", and doesn't say anything about the
location. And in fact, you can't assume any fixed location, because
packages will often use a common license directory, so the only
reliable way to list license files is to look at the %license mark.
And in our particular case, -devel files are not installed on user
systems, so we can assume that users will not manually search for
license files by browsing /usr/share/licenses/<package-name>. We can't
remove the license file from %{create_instdir}, because the crate might
be need it, for example to display the license text internally. Thus,
I think reasonable and not against the guidelines to "reuse" the license
file present under %{create_instdir}.
For the main package though, it seems better to keep the existing
location. Those packages *are* installed on end-user systems, and also
it'd be strange to suddently have one file under /usr/share/cargo/registry/.
So this patch uses absolute paths under %create_instdir for -devel,
and the relative path (effectively under /usr/share/licenses) for the
main package.
It is possible to opt-out of the new behaviour with --relative-license-paths.
Fixes#176.
Fixes#41.
The template is adjusted to use the new macro. This will only work
if the macro is defined, thus the required version of rust-packaging
is bumped.
- 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.