Commit graph

244 commits

Author SHA1 Message Date
a41e9755ec Fix packager identity detection to use fallbacks properly
Setting 'None' to the 'packager' field caused generated
spec files to have the packager identity of "None" instead
of using the fallbacks as specified in the spec template.

This adjustment makes the spec template fallbacks for the
packager identity work as expected.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2019-05-04 20:43:54 -04:00
Igor Gnatenko
c54d2409da
Remove temporary Cargo.toml.deps
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-28 07:47:06 +02:00
Igor Gnatenko
ecc850755e
macros: Use %{build_rustflags} convention
But keep %__global_rustflags around for compatibility.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-23 21:14:51 +02:00
Igor Gnatenko
3076bbaa3a
macros: Pass -Ccodegen-units=1 in RUSTFLAGS
This has good impact on performance and binary size at cost of
compilation time. As nice side effect, it fixes bug which breaks
compilation of binaries in Fedora Rawhide.

For example, ffsend binary went from 107M to 70M.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1701339
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-23 21:14:51 +02:00
Igor Gnatenko
bbd8cb71d3
buildsys: release++
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-23 15:58:16 +02:00
Igor Gnatenko
b8e44897fa
Drop rustcfg req
We don't need it right now since we don't support filtering unneeded
dependencies on cargo level.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-23 15:58:16 +02:00
Igor Gnatenko
ea5fcb0dfe
Read '_rust2rpm.conf' as well
OBS doesn't allow importing files starting with `.` so we need another
file name.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2019-04-23 15:52:35 +02:00
f83b3dd937 Allow controlling packager identity through environment variables
In order to support more flexible automation mechanisms, allow
injecting the packager identity through environment variables as an
override from the regular detection mechanisms.

Moreover, there are cases where we want to force the fallback identity,
so we now have a way to force that through an environment variable.

These are intended to be used with multi-user automation systems so
that the correct identity is set regardless of what the host system
is actually configured with.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2019-04-23 09:27:37 -04:00
Igor Gnatenko
c57afa88aa
Add support for %generate_buildrequires
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-04-16 11:46:27 +02:00
60bfd2da89 Fix the URL to the openSUSE Bugzilla for openSUSE spec headers
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2019-03-16 12:26:34 -04:00
Igor Gnatenko
95c1954a06
Use new-style date in changelog (with TZ) for Fedora
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-16 15:51:26 +01:00
Igor Gnatenko
dd7e794e51
Use UTC for patch files
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-16 15:49:36 +01:00
Igor Gnatenko
2b20b9e369
trivial: Use same codestyle
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-16 15:15:49 +01:00
Igor Gnatenko
47597fcad7
Add support for --all-features
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-16 15:08:43 +01:00
Igor Gnatenko
5d7a0b2444
Do not pull optional dependencies
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-14 10:37:37 +01:00
Igor Gnatenko
f53b3e3188
templates: Use %{_description} for %{crate}
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-14 10:36:34 +01:00
Igor Gnatenko
7f0a499ff3
data: Escape \n properly
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-03-10 10:14:28 +01:00
Igor Gnatenko
84a73bfa24
data: Cargo doesn't escape paths with space
When building matrixmultiply v0.2.2:

BUILDSTDERR: /usr/bin/cp: cannot stat 'spare': No such file or directory
BUILDSTDERR: /usr/bin/cp: failed to get attributes of 'kernels': No such file or directory

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-02-17 17:19:25 +01:00
Igor Gnatenko
00c0c5cec9 Add support for prerelease versions
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-01-28 09:15:18 +00:00
b0d2756917 licensing: rename EPL to EPL-1.0 and add EPL-2.0
According to https://fedoraproject.org/wiki/Licensing:Main#Software_License_List
EPL-1.0 and EPL-2.0 are the short tags that should be used now.
(C.f. https://spdx.org/licenses/EPL-2.0.html.)

Fixes #64.
2019-01-26 11:22:31 +00:00
7c00b0f290 licensing: fix zlib license translation
The file was mangled, and something about "teeworlds" was inserted
into the line for zlib. The spdx database doesn't list "teeworlds
license", so let's just remove that part.
Both [1] and [2] agree that "zlib" and "zlib license" are the same thing.

[1] https://spdx.org/licenses/Zlib
[2] https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses

Fixes #61.
2019-01-26 11:22:31 +00:00
Josh Stone
a04e95bc4f Set the install root in .cargo/config 2018-12-07 13:59:03 -08:00
Josh Stone
b4e2503829 Set CARGO_HOME to the local .config 2018-12-07 13:58:41 -08:00
294c6f571c Add option to not generate a default changelog entry
For Rust packages created through the OBS source service, the
changelog is managed by an external <pkg>.changes file that is
transformed into an RPM changelog and appended to the spec file
automatically by the Open Build Service.

Having a default entry means that the changelog handling will not
always work correctly and package builds may fail due to changelog
entries not being in reverse chronological order.

This also is a future enabler for other workflows for external
changelog management in automated package builds.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-11-11 11:06:27 -05:00
Igor Gnatenko
83ea3796cd
trivial: use f-strings everywhere
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-11-03 21:45:04 +01:00
Igor Gnatenko
197150ee2e
add support for feeding user configuration
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-11-03 21:45:04 +01:00
Igor Gnatenko
a1d3a84645
add support for dependencies with same name
Reported-by: Josh Stone <jistone@redhat.com>
References: https://internals.rust-lang.org/t/optional-dependencies-with-same-name/8728
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-11-03 21:45:04 +01:00
Igor Gnatenko
2cac5e5ad5
split features into subpackages
References: https://discussion.fedoraproject.org/t/rfc-new-crates-packaging-design-features-have-their-own-subpackages/563?u=ignatenkobrain
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-11-03 21:45:04 +01:00
5a1cde5b8d Throw an error if -s is used without a crate
In the future we might want to be smarter and find the crate, but let's at least
not ignore the option completely.
2018-09-24 11:09:52 +02:00
2f12c83d14 Remove half-downloaded crate on ^C
Subsequent invocations would fail with an error about a corrupted file.
We don't have support for resuming a failed download, so let's remove the
partial download results.
2018-09-24 11:09:52 +02:00
Igor Gnatenko
e6e9cbbb71
remove pre-3.6 leftovers
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-09-11 14:49:53 +02:00
Igor Gnatenko
2050880140
do better for renamed crates
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-09-11 00:35:46 +02:00
Igor Gnatenko
561280a0ea
generate %doc statements
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-09-10 23:40:18 +02:00
Igor Gnatenko
0dc9fc182e
name spec/patch_file by real crate name
When renaming using patch file, we really want to change file names too.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-09-10 23:37:40 +02:00
Igor Gnatenko
72c0a79dde
buildsys: release++
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-09-02 18:23:55 +02:00
7f2885fbfd Add rust2rpm --show-license-map
This is helpful when debugging the list.
2018-08-16 16:16:02 +02:00
d5d78d9fb1 Use fedora tags also for megeia 2018-08-16 16:16:02 +02:00
73998d6adc Translate SPDX licenses to Fedora license tags, warn about "/"
"/" is deprecated everywhere, so warn about that.
Translation from SPDX is only used for fedora or epel targets.

The Fedora license list coalesces various license variants that have different
SPDX license tags into a single license tag. Most notably, this is done for the
39 BSD variants and 18 MIT variants on the Fedora good licenses list. When a
spdx→fedora mapping exists, it should always be unambiguous, because SPDX
considers any change in the license text to be a unique license, and Fedora is
more permissive in that regard.

To make a review of the translation easy, debug info is output to stdout, and
comments are inserted into the spec when some translation is required or when
there are problems with the upstream licensing.

The license list is pulled from the spdx project:
$ curl 'https://docs.google.com/spreadsheets/d/1LUJuzGKC5K2yYuAg8S-2VYbS2dmg_4IlFdpqj7n9Ghg/export?format=csv&id=1LUJuzGKC5K2yYuAg8S-2VYbS2dmg_4IlFdpqj7n9Ghg&gid=138634715' > rust2rpm/spdx_to_fedora.csv

v2:
- apply "/" replacement always

v3:
- print to stderr
- use csv.DictReader
- filter out empty license lines
2018-08-16 16:16:02 +02:00
9b64a6fd9f Filter dependencies using the cfg language 2018-08-16 15:38:51 +02:00
4f234e09ca
add option to copy crate to current working directory
This is needed to support the rust2rpm OBS source service.

Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/52

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-08-15 19:57:38 +02:00
Luca Bruno
2c1e19f4eb
main: create intermediate directories for cachedir
Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/50
Merges: https://pagure.io/fedora-rust/rust2rpm/pull-request/56
2018-08-15 18:48:22 +02:00
Igor Gnatenko
0e3c6e777c
setup.py: update classifiers
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-08-14 09:07:52 +02:00
Igor Gnatenko
1de3953e88
trivial: replace single quotes by double quotes
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-08-14 08:59:21 +02:00
Igor Gnatenko
9e15b0197f
tox: update envlist
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-08-14 08:56:48 +02:00
3637450520 Do not clobber real files when creating a patch
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.
2018-08-13 20:42:37 +02:00
2233404f98 Allow generating the spec file from rust project checkout
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.
2018-08-13 20:36:30 +02:00
Anders Blomdell
b5647abe0f First shot at handling local crates 2018-08-13 20:14:01 +02:00
9ff9f2e1bd Make nested function non-nested
This is slow and hard to debug and there is no need to do it.
2018-08-13 20:14:01 +02:00
Igor Gnatenko
80237720ae
macros: remove support for target-dir
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-06-22 21:53:09 +02:00
Igor Gnatenko
c9ce952e26
macros: make %cargo_* macros parametric
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>
2018-06-22 21:05:42 +02:00