Commit graph

92 commits

Author SHA1 Message Date
Igor Gnatenko
cd63296353 macros: remove spurious whitespace
Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48
Reported-by: Josh Stone <jistone@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-09 06:52:36 +01:00
Igor Gnatenko
5313b35271 macros: remove Cargo.lock
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>
2018-01-09 00:00:04 +01:00
Igor Gnatenko
813d8efc58 buildsys: release++
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 20:15:07 +01:00
Neal Gompa
3aeaf2ba06 gitignore: add /build/
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-01-08 20:08:43 +01:00
Igor Gnatenko
045dd9358e read os-release using configparser
It is much safer.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 20:08:38 +01:00
Neal Gompa
0cd2ec0298 detect default distribution target based on os-release(5)
Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/46
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-01-08 20:08:16 +01:00
Neal Gompa
3feda71385 add support for Mageia and (open)SUSE
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>
2018-01-08 20:08:04 +01:00
Igor Gnatenko
09a434b55a make 'rlib' first-class citizen
Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/47
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 19:09:54 +01:00
Igor Gnatenko
4b31b3e594 macros: search for whole string
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 19:09:10 +01:00
Igor Gnatenko
c9e7cf51e4 optional dependencies are also features
References: https://github.com/rust-lang/cargo/issues/4911
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 14:37:29 +01:00
Igor Gnatenko
47b6c3ef80 macros.crago: pass --no-fail-fast
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>
2017-12-05 13:03:41 +01:00
Igor Gnatenko
c848eae92d generate spec using latest non-yanked version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-11-13 21:36:18 +01:00
Igor Gnatenko
59809d4940 use cp instead of install
We want to preserve original modes and so on.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-11-04 15:32:39 +01:00
Igor Gnatenko
45a5caf300 inspector: inject rust-packaging dependency in buildtime
For consistency with previous commit.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-10-21 09:54:36 +02:00
Igor Gnatenko
9e0a872ece inspector: inject cargo dependency in runtime
Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/42
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-10-21 09:54:36 +02:00
Igor Gnatenko
600c75796f handle versions like 1.*.*
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-07-07 23:46:40 +02:00
Josh Stone
67ca805fda Write pre-release tags with ~ for rpm
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.
2017-07-07 23:46:40 +02:00
Martin Sehnoutka
2c556e1473 macros: explicitly set rustdoc
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
2017-06-23 13:41:42 +02:00
Igor Gnatenko
cce3d7bc92 macros: switch to /usr/share/cargo/registry
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>
2017-06-20 23:10:28 +02:00
Igor Gnatenko
b9ceb10ac2 buildsys: release++
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-05-18 00:31:21 +02:00
Josh Stone
3fc7ade708 Use cargo read-manifest instead of metadata
The `read-manifest` json output is a subset of `metadata` for the
current `Cargo.toml` only, even tighter than `--no-deps` provides.
2017-05-17 15:19:52 -07:00
Igor Gnatenko
8757161c11 use rust-packaging for BuildRequires
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>
2017-05-17 12:45:48 +02:00
Josh Stone
23b334286c Switch rustflags from -g to -Cdebuginfo=2
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.
2017-03-30 10:37:25 -07:00
Igor Gnatenko
1e87d552eb always name main package with rust-
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-03-11 13:21:12 +01:00
Igor Gnatenko
d3433da3a8 add empty line at EOF in spec
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-03-06 16:51:31 +01:00
Igor Gnatenko
bfae101f92 generate changelog automagically
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-03-06 16:48:19 +01:00
Igor Gnatenko
6caf4e5785 remove unused imports
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-03-06 16:34:45 +01:00
Igor Gnatenko
034ac98d65 parse target before templating
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>
2017-02-26 23:43:49 +01:00
Igor Gnatenko
548d835441 inspector: print buildrequires into requires as well
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>
2017-02-26 23:24:25 +01:00
Igor Gnatenko
8a9813f3e2 metadata: add support for wildcards in version
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/6
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-26 17:06:24 +01:00
Igor Gnatenko
a254693cde Revert "macros: move Cargo.toml.orig inplace"
Somehow this doesn't really work. No time for investigation.

This reverts commit fc12436f25.
2017-02-25 21:51:08 +01:00
Igor Gnatenko
86d06ae613 macros: strip all dev-dependencies sections
Even [dev-dependencies.foo].

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-25 21:45:24 +01:00
Igor Gnatenko
fc12436f25 macros: move Cargo.toml.orig inplace
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>
2017-02-25 19:21:40 +01:00
Igor Gnatenko
f487983d6c use rich dependencies to fullfill requirements
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>
2017-02-25 10:02:05 +01:00
Igor Gnatenko
a6d8213e64 include license file into main package as well
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-19 19:55:19 +01:00
Igor Gnatenko
3b87345449 trivial: remove unused variables/imports
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-19 19:28:13 +01:00
Igor Gnatenko
fea1b6af49 buildsys: release++
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 20:16:35 +01:00
Igor Gnatenko
e834debc6a add support for proc-macro kind
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/19
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 19:53:08 +01:00
Igor Gnatenko
d4334a2ee7 macros: automatically strip dev-dependencies
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>
2017-02-18 16:10:50 +01:00
Igor Gnatenko
ee68fab15b macros: don't define %cargo_build/test as functions
There are only problems from this.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 02:25:21 +01:00
Igor Gnatenko
69c7ba1d28 save to real files by default instead of stdout
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 01:54:02 +01:00
Igor Gnatenko
7fb08b9515 prepare all metadata in python rather than in jinja
We need to know things like name of package in order to create
properly named spec file.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 01:45:35 +01:00
Igor Gnatenko
98b6cc73d5 respect VISUAL/EDITOR variables and fallback to vi
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 00:42:27 +01:00
Igor Gnatenko
ce5a8204d4 add support for initial patching of Cargo.toml
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/20
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 00:42:27 +01:00
Igor Gnatenko
e880b5031d summary is like description, but not multiline
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 00:11:04 +01:00
Igor Gnatenko
1282937913 metadata: parse description
New cargo exposes description, so we can even generate summary out
of it.

We will need to do some pre-processing in future, but good enough for
the beginning.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-14 18:43:51 +01:00
Igor Gnatenko
2fbb50e1dc distribute rust2rpm in PyPI via setuptools
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-12 11:35:45 +01:00
Igor Gnatenko
6923fb107d add support for generating spec files with binaries
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/11
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-11 19:24:30 +01:00
Igor Gnatenko
baceedccbd sort dependencies by name
If we want readable and reproducible results, we should sort our
dependency list.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-11 19:04:30 +01:00
Igor Gnatenko
593a5aaf4d disable debuginfo subpackage
We definitely don't need it for our packaging, but if we include
%build section, then RPM assumes that it should generate debuginfo.

Seems like hack, yes.

Signed-off-by: Josh Stone <jistone@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 23:06:17 +01:00