Commit graph

136 commits

Author SHA1 Message Date
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
Igor Gnatenko
cd9f892d51 rename cargo-deps.py to cargodeps.py
To allow importing from outside. import cargo-deps doesn't really work.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 23:21:21 +01:00
Igor Gnatenko
1ac75bb703 move arguments parsing under __name__ == __main__ condition
This way we will be able to import this from some place and use other
functions.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 23:16:26 +01:00
Igor Gnatenko
194ee2ce13 add tests for requires and conflicts
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:58 +01:00
Igor Gnatenko
cdec51f22f add couple of tests for Provides
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:57 +01:00
Igor Gnatenko
8a7fbbd245 use name/feature syntax
It's much more common with what cargo people to.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:57 +01:00
Igor Gnatenko
83823845a2 take features into account for Requires/Conflicts
Before:
crate(nom) >= 2.0.0

After:
crate(nom)(verbose-errors) >= 2.0.0
crate(nom)(regexp_macros) >= 2.0.0

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:57 +01:00
Igor Gnatenko
eea2ef7496 print provides for each feature
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:56 +01:00
Igor Gnatenko
62bb483451 don't skip optional requirements
As for now we don't have way to say that it's mandatory if people want
to install featue which lib provides.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:53 +01:00
Igor Gnatenko
f273d7d8f3 skip build/test dependencies to show up in conflicts/requries
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:50 +01:00
Igor Gnatenko
867252db23 add Requires/Conflicts generator
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:45 +01:00
Igor Gnatenko
ec362dd2cb add Provides generator
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:41 +01:00
Igor Gnatenko
7c6e1269bf initial trivial macro
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:23 +01:00
Igor Gnatenko
181bd3c689 add MIT license text
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-01-30 18:46:00 +01:00