When a file unpacked from a crate is edited, it is OK to edit it
directly. But when editing something that was already there, we should
make a temporary copy. Let's do this copy next to the file being
edited, so it's easy for the user to open related files.
This adds the possibility to generate the spec file from a rust project
checkout, by specifying either the toml file or just the directory name, without
having a crate at all. This is nice when developing local projects and tweaking
the metadata. The expected way to use this is 'rust2rpm .../project/', look at
the generated spec file, do fixes to source, regenerate spec file, etc.
$ rust2rpm -t fedora --stdout .
(when testing)
or
$ rust2rpm -t fedora /path/to/project
(in the dist-git directory)
Only args that contain "/" are considered local arguments. An special exception
is made for "." and "..", since that's likely to be a common use case and cannot
be mistaken for a remote crate name.
When --patch is used, the filename is changed from name-version-fix-metadata.diff
to name-fix-metadata.diff. This seems more useful, because after the crate
version is updated, the patch file would either stay the same or would just need
to be rebased, and it is not tied to the crate version.
Unfortunately cargo-install doesn't accept --target-dir, so have to pass
setting through envvar.
Also %{shrink:…} them so it looks nicer in build log.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Reason this has not been done before is that cargo-install doesn't
understand --release. Let's just add it to other commands and be done
with it.
Reported-by: Josh Stone <jistone@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
cargo-package automatically strips it out, but we package also some
things directly from git.
Acked-by: Josh Stone <jistone@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
The crate packaging spec file template has been split out into its own file,
and various distro specific modifications to the spec are incorporated as
include files that are conditionally applied based on the target.
Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/46
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
It is quite useful to see all failing tests instead of few of first.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Reviewed-by: Josh Stone <jistone@redhat.com>
We need to translate `x.y.z-foo` to `x.y.z~foo`. We also need to take
care that pre-release semantic versions are only only allowed to match
the same `x.y.z` series.
On systems where rustup is used, simple rpmbuild will use rustc from system,
but rustdoc will be taken from PATH which might be different from system.
Given this, doc-tests or anything related to rustdoc will fail with mis-mathching
rustc version.
Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/38
We should not be using /usr/src because that one is supposed to be used for
"Source code may be placed in this subdirectory, only for reference purposes".
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
That way we don't need to pull any python/whatever stuff from rust itself.
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/30
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Since rustc doesn't allow `-g` and `-Cdebuginfo` options to mix, we need
to make sure we're consistent with the option crates may set in their
own `[profile] debug` settings. Cargo used to send `-g` for that, but
switched to `-Cdebuginfo` in version 0.17.0.
Fixes#32.
Even we don't have epel support at this point, it should be same
as fedora. It doesn't make any sense to rely on target names in
templating.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Those are not completely build-time since we ship source code. We
do need those dependencies to do builds afterwards.
Also use private members to not copy lists.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
cargo package -l lists Cargo.toml.orig and we're installing it anyway,
so let's just do mv -f instead of doing new install.
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Imagine, that:
* A requires 0.6.0 <= X < 0.7.0
* B requires 0.9.0 <= X < 0.10.0
* C requires A and B
If we use Requires + Conflicts, then we just can't build or install
C, because sub-dependencies are conflicting between each other.
Proper syntax is: (X >= 0.6.0 with X < 0.7.0)
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
All background written in upstream cargo GitHub issue[0].
In short, cargo build/install enforces us to have all dev-dependencies
even they are not used for building/installed.
[0] https://github.com/rust-lang/cargo/issues/3732
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>