Commit graph

263 commits

Author SHA1 Message Date
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
Igor Gnatenko
ebe839e50b always include %cargo_build into spec
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 22:33:34 +01:00
Igor Gnatenko
05a494edfd adapt to %cargo_install change
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 22:33:13 +01:00
Igor Gnatenko
c12df7d085 %cargo_install is now smart to handle libs and bins
So far we had %cargo_install (for binaries) and %cargo_install_crate
(for libraries) which is a bit awkward and requires us to put
additional arguments for latter one.

We can do all the magic behind the scene.

Closes: https://pagure.io/fedora-rust/rust2rpm/issue/7
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 22:17:45 +01:00
Igor Gnatenko
5607956af4 expose name/version from cargodeps
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 21:07:17 +01:00
Igor Gnatenko
7551fcba64 scan metadata for targets
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-10 20:19:28 +01:00
Igor Gnatenko
0038452903 Makefile: install cargodeps without extension
Otherwise RPM bytecompile script will try to create bytecompiled
code and will fail.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 22:48:41 +01:00
Igor Gnatenko
a63ea7f3ed Makefile: create leading directories
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 22:23:41 +01:00
Igor Gnatenko
df2468eefb test on py33 and py34 as well
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 21:08:10 +01:00
Igor Gnatenko
8155c69e38 use python API for tests
Before:
real	0m4.807s
user	0m3.817s
sys	0m0.920s

After:
real	0m1.236s
user	0m1.011s
sys	0m0.222s

Multiply by number of testcases we didn't implement yet and by
python versions we want to test on.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 21:06:40 +01:00
Igor Gnatenko
67a12b527f distribute cargodeps and rust2rpm as zipapp
With zipapp we bundle all our sources into one file and don't care.
Since we use common files from both, it's easier for us.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 20:54:10 +01:00
Igor Gnatenko
70e062fbd9 move common parts into subdirectory
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 18:15:28 +01:00
Igor Gnatenko
74beb9388f move RPM stuff into subdirectory
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 18:15:28 +01:00
Igor Gnatenko
309afe53dc add tox.ini
We need to test somehow on multiple python versions.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 14:59:18 +01:00
Igor Gnatenko
4218fda17c add requirements.txt
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 14:58:18 +01:00
Igor Gnatenko
fca2a88ad9 support py35
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 14:56:05 +01:00
Igor Gnatenko
1cad2e9d6f remove dead code
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 14:23:39 +01:00
Igor Gnatenko
14124034bf show progress when downloading crate
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 14:23:29 +01:00
Igor Gnatenko
619f221cc0 save cache into $XDG_CACHE_HOME/rust2rpm
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 13:58:20 +01:00
Igor Gnatenko
281f6f3c89 use jinja default() operator
It's much shorter ;)

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 12:10:50 +01:00
Igor Gnatenko
d2aad3723f try to automatically generate license out of metadata
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-05 12:07:49 +01:00
Igor Gnatenko
38ca0bf280 use Metadata directly instead of calling subprocess
Subprocesses are slow and we have to pass too many different parameters
for rendering. It's better to pass just metadata object and use Python
interface.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-03 10:39:37 +01:00
Igor Gnatenko
3c354a3b91 trivial: fix indent
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-03 10:39:06 +01:00
Igor Gnatenko
7399ebee0e allow creating Metadata from file or json
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-03 10:38:49 +01:00
Igor Gnatenko
c946648932 generate BuildRequires/BuildConflicts
Closes: https://pagure.io/fedora-rust/rust2rpm/issue/8
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-03 10:05:26 +01:00
Igor Gnatenko
a101585005 fix syntax error
Traceback (most recent call last):
  File "/home/brain/Projects/upstream/rust2rpm/cargodeps.py", line 140, in <module>
    md = Metadata(f)
  File "/home/brain/Projects/upstream/rust2rpm/cargodeps.py", line 43, in __init__
    self._parse_metadata(json.loads(metadata))
  File "/home/brain/Projects/upstream/rust2rpm/cargodeps.py", line 92, in _parse_metadata
    self._provides = [Dependency(name, version)]
NameError: name 'name' is not defined

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-03 09:42:57 +01:00
Igor Gnatenko
e2f321d603 expose name/version from metadata class
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-31 22:41:45 +01:00
Igor Gnatenko
4ff91cb101 refactor metadata parser to class
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-31 22:38:54 +01:00
Igor Gnatenko
99f6926156 don't try to group requires/conflicts
We can't reliably get mappings between requires and conflicts, so
just split the out to not confuse people.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-31 00:54:56 +01:00
Igor Gnatenko
f33bf0ddec initial implementation of rust2rpm
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-31 00:44:25 +01:00