Coder Social home page Coder Social logo

gentoo / cargo-ebuild Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 10.0 273 KB

[MIRROR] cargo extension that can generate ebuilds using the in-tree eclasses

Home Page: https://gitweb.gentoo.org/proj/cargo-ebuild.git

License: Apache License 2.0

Rust 100.00%

cargo-ebuild's People

Contributors

altf02 avatar cardoe avatar gibix avatar gyakovlev avatar kpcyrd avatar leonardohn avatar lu-zero avatar miezhiko avatar pdemonaco avatar telans avatar winny- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cargo-ebuild's Issues

Hangs when trying to process rust-bindgen v0.63.0

Running cargo-ebuild ebuild --noaudit in the cloned https://github.com/rust-lang/rust-bindgen.git repo with tag v0.63.0 checked-out causes cargo-ebuild to hang indefinitely without producing any output.

If I run it through ltrace, I see:

[pid 18249] SYS_write(2, "waiting for file lock on package"..., 38 <unfinished ...>
[pid 18248] SYS_read(6 <unfinished ...>
[pid 18249] <... SYS_write resumed> )                                                                 = 38 <0.000063>
[pid 18248] <... SYS_read resumed> , "waiting for file lo", 19)                                       = 19 <0.000024>
[pid 18249] SYS_write(2, "\n", 1 <unfinished ...>
[pid 18248] SYS_read(6 <unfinished ...>
[pid 18249] <... SYS_write resumed> )                                                                 = 1 <0.000029>
[pid 18248] <... SYS_read resumed> , "ck on package cache\n", 32)                                     = 20 <0.000026>
[pid 18249] SYS_flock(3, 2, 1, 0x7e8b5237b929f181 <unfinished ...>
[pid 18248] SYS_read(6 <no return ...>
error: maximum array length seems negative
, "", 12)                                                                                             = -11 <0.000016>
[pid 18248] SYS_poll(0x7ffdaff412d8, 2, -1

โ€ฆ whereupon it hangs until interrupted. This happens with releases 0.5.1 & 0.5.2.

It would be handy if a --verbose option could be added to give more visibility into what is happening internally (what files are being read, what crates have been discovered on the fly, etc.)!

Unable to perform ebuild with dependencies

For some unknown reason unable to install ebuild. Manifest gets generated properly.

Repository: https://github.com/bohdaq/rust-tls-server

Ebuild:

# Copyright 2017-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Auto-Generated by cargo-ebuild 0.3.1

EAPI=7

CRATES="
autocfg-1.1.0
base64-0.13.1
bitflags-1.3.2
bumpalo-3.11.1
cc-1.0.78
cfg-if-1.0.0
foreign-types-0.3.2
foreign-types-shared-0.1.1
js-sys-0.3.60
libc-0.2.139
log-0.4.17
once_cell-1.16.0
openssl-0.10.45
openssl-macros-0.1.0
openssl-src-111.24.0+1.1.1s
openssl-sys-0.9.80
pem-1.1.0
pkg-config-0.3.26
proc-macro2-1.0.49
quote-1.0.23
rcgen-0.10.0
ring-0.16.20
rust-web-server-8.0.6
serde-1.0.152
spin-0.5.2
syn-1.0.107
time-0.3.17
time-core-0.1.0
unicode-ident-1.0.6
untrusted-0.7.1
vcpkg-0.2.15
wasm-bindgen-0.2.83
wasm-bindgen-backend-0.2.83
wasm-bindgen-macro-0.2.83
wasm-bindgen-macro-support-0.2.83
wasm-bindgen-shared-0.2.83
web-sys-0.3.60
winapi-0.3.9
winapi-i686-pc-windows-gnu-0.4.0
winapi-x86_64-pc-windows-gnu-0.4.0
yasna-0.5.1
"

inherit cargo

DESCRIPTION="rust-tls-server is a web server capable of serving static content over https."
# Double check the homepage as the cargo_metadata crate
# does not provide this value so instead repository is used
HOMEPAGE="https://github.com/bohdaq/rust-web-server"
SRC_URI="https://github.com/bohdaq/rust-tls-server/archive/refs/tags/8.0.6.tar.gz"
RESTRICT="mirror"
# License set may be more restrictive as OR is not respected
# use cargo-license for a more accurate license picture
LICENSE="(MIT Apache-2.0 Apache-2.0) CC-BY-4.0 ISC LGPL-3.0-or-later MIT Unicode-DFS-2016"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

DEPEND=""
RDEPEND=""

Ebuild clean install merge:

localhost /home/bohdan_tsap/rts/rust-tls-server/rts/rust-tls-server # ebuild rust-tls-server-8.0.6.ebuild clean install merge
Appending /home/bohdan_tsap/rts/rust-tls-server to PORTDIR_OVERLAY...
!!! Repository 'x-rust-tls-server' is missing masters attribute in '/home/bohdan_tsap/rts/rust-tls-server/metadata/layout.conf'
!!! Set 'masters = gentoo' in this file for future compatibility
 * 8.0.6.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                     [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                                                                            [ ok ]
>>> Unpacking source...
>>> Unpacking 8.0.6.tar.gz to /var/tmp/portage/rts/rust-tls-server-8.0.6/work
...
>>> Source unpacked in /var/tmp/portage/rts/rust-tls-server-8.0.6/work
>>> Preparing source in /var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6 ...
 * cargo build --release
error: no matching package named `openssl` found
location searched: registry `crates-io`
required by package `rts v8.0.6 (/var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
 * ERROR: rts/rust-tls-server-8.0.6::x-rust-tls-server failed (compile phase):
 *   cargo build failed
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_compile
 *   environment, line 1449:  Called cargo_src_compile
 *   environment, line  573:  Called die
 * The specific snippet of code:
 *       "${@}" || die "cargo build failed"
 * 
 * If you need support, post the output of `emerge --info '=rts/rust-tls-server-8.0.6::x-rust-tls-server'`,
 * the complete build log and the output of `emerge -pqv '=rts/rust-tls-server-8.0.6::x-rust-tls-server'`.
 * The complete build log is located at '/var/tmp/portage/rts/rust-tls-server-8.0.6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/rts/rust-tls-server-8.0.6/temp/environment'.
 * Working directory: '/var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6'
 * S: '/var/tmp/portage/rts/rust-tls-server-8.0.6/work/rust-tls-server-8.0.6'

Manual build works properly:

localhost /home/bohdan_tsap/rts/rust-tls-server # cargo build --release >> manual_build.log
   Compiling cc v1.0.78
   Compiling proc-macro2 v1.0.49
   Compiling libc v0.2.139
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling autocfg v1.1.0
   Compiling pkg-config v0.3.26
   Compiling openssl-src v111.24.0+1.1.1s
   Compiling syn v1.0.107
   Compiling time-core v0.1.0
   Compiling once_cell v1.16.0
   Compiling openssl-sys v0.9.80
   Compiling ring v0.16.20
   Compiling time v0.3.17
   Compiling untrusted v0.7.1
   Compiling openssl v0.10.45
   Compiling spin v0.5.2
   Compiling foreign-types-shared v0.1.1
   Compiling base64 v0.13.1
   Compiling pem v1.1.0
   Compiling foreign-types v0.3.2
   Compiling yasna v0.5.1
   Compiling openssl-macros v0.1.0
   Compiling cfg-if v1.0.0
   Compiling bitflags v1.3.2
   Compiling rcgen v0.10.0
   Compiling rust-web-server v8.0.6
   Compiling rts v8.0.6 (/home/bohdan_tsap/rts/rust-tls-server)
    Finished release [optimized] target(s) in 45.61s

As a side note I'm able to build and install ebuild for a project without dependencies: https://github.com/bohdaq/rws-gentoo-ebuild
rts.zip

Setting CARGO_HOME breaks build

For some versions, gnome-base/librsvg has been failing to build on my system with doas emerge librsvg, because I've set CARGO_HOME=${XDG_DATA_HOME}/cargo in my environment.

access denied: open_wr ~/.local/share/cargo/. package_cache

From my understanding, the ebuild should clean the environment before trying to build it.

Running CARGO_HOME='' doas emerge librsvg works fine.

print information about --noaudit when calling /usr/bin/cargo-ebuild --help

/usr/bin/cargo-ebuild defaults to fetching data for audit, to warn about vulnerable crates.

While this is a good thing I believe, it can cause tricky to debug segfaults as reported in #20 , or just flake with an error.

Trying to learn more about this feature via /usr/bin/cargo-ebuild --help doesn't give much of an result:

/usr/bin/cargo-ebuild --help
cargo-ebuild 0.5.0
Doug Goldstein <[email protected]>
Generates an ebuild for a given Cargo project

USAGE:
    cargo <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    ebuild    Generates an ebuild for a given Cargo project
    help      Prints this message or the help of the given subcommand(s)

and /usr/bin/cargo ebuild --help shows the option, but without any informations:

/usr/bin/cargo ebuild --help
cargo-ebuild 0.5.0
Generates an ebuild for a given Cargo project

USAGE:
    cargo ebuild [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
        --noaudit    
    -V, --version    Prints version information

OPTIONS:
        --package-name <PACKAGE>      Desired package name from cargo workspace
        --manifest-path <PATH>        Path to Cargo.toml
    -T, --template-path <TEMPLATE>    Non-standard template

so maybe you can add a few lines to the code with short info, what this flag actually does for the user.

handle GIT_CRATES

cargo.eclass will now support GIT_CRATES

see gentoo/gentoo#29289

cargo_ebuild could pre-fill such information. or at least provide data for templating engine to fill it via template.

Support license mapping

cargo uses spdx license identifiers.
we could use a map file that translates between names found in license and official SPDX names.

also, there has been a discussion to add such a map file to ::gentoo repo, if it happens we could re-use the file without maintaining own copy.

`cargo ebuild` does not escape or sanitize DESCRIPTION

$ cargo ebuild on https://github.com/Michael-F-Bryan/mdbook-linkcheck generates among other things this snippet:

# ...
DESCRIPTION="A backend for `mdbook` which will check your links for you."
# ...

Note the mdbook. That at best fails sourcing:

$ pkgcheck scan .
app-text/mdbook-linkcheck
  SourcingError: version 0.7.7: failed sourcing ebuild: external commands disallowed during metadata regen: 'mdbook'

One of the options would be to drop suspicious characters, escape them or convert to something safer.

Thanks!

segfault at 0 ip 00007f0e90558f10 sp 00007fff6783e430 error 4 in libgit2.so.1.4.0[7f0e904ca000+d3000]

hey everyone,

I'm using the cargo-ebuild-0.5.0 from gentoo tree to get a working ebuild for cargo-xbuild. Tried v.0.6.5 and v.0.5.35 from their repo at https://github.com/rust-osdev/cargo-xbuild

cargo-ebuild ebuild gives me a plain segfault, and dmesg is full of these:

[ 2137.252281] cargo-ebuild[6743]: segfault at 0 ip 00007fe931f9ff10 sp 00007ffd36958810 error 4 in libgit2.so.1.4.0[7fe931f11000+d3000]
[ 2137.252286] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 2170.621534] rsync (6550) used greatest stack depth: 12096 bytes left
[ 2444.842331] cargo-ebuild[11796]: segfault at 0 ip 00007fb943945f10 sp 00007fffa67557e0 error 4 in libgit2.so.1.4.0[7fb9438b7000+d3000]
[ 2444.842336] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 2550.576053] cargo-ebuild[31966]: segfault at 0 ip 00007f0e6cbe8f10 sp 00007ffef1945130 error 4 in libgit2.so.1.4.0[7f0e6cb5a000+d3000]
[ 2550.576058] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 2556.259708] cargo-ebuild[32142]: segfault at 0 ip 00007fe6b60fdf10 sp 00007ffdf196db10 error 4 in libgit2.so.1.4.0[7fe6b606f000+d3000]
[ 2556.259713] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 2811.261943] cargo-ebuild[32494]: segfault at 0 ip 00007fe4373b2f10 sp 00007fffa9425250 error 4 in libgit2.so.1.4.0[7fe437324000+d3000]
[ 2811.261947] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 2817.048280] cargo-ebuild[32501]: segfault at 0 ip 00007f0e90558f10 sp 00007fff6783e430 error 4 in libgit2.so.1.4.0[7f0e904ca000+d3000]
[ 2817.048284] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f
[ 3187.799107] cargo-ebuild[6505]: segfault at 0 ip 00007f8121a12f10 sp 00007fff048d93e0 error 4 in libgit2.so.1.4.0[7f8121984000+d3000]
[ 3187.799112] Code: 4c 24 08 48 85 c9 74 71 48 8b 80 b0 00 00 00 4c 89 6c 24 28 45 31 e4 48 8d 2d cc e9 07 00 49 89 c5 66 0f 1f 84 00 00 00 00 00 <4f> 8b 7c e5 00 be 0d 00 00 00 4c 89 ff e8 be 2c f7 ff 48 85 c0 0f

tried removing the linking against systems libssh2+libgit2 from the ebuild, to no effect.

Handle missing whitespace around parentheses in license strings

Noticed on https://files.pythonhosted.org/packages/13/dd/a9608b7aebe5d2dc0c98a4b2090a6b815628efa46cc1c046b89d8cd25f4c/cryptography-38.0.3.tar.gz

WARNING: unknown license "(MIT", please correct manually
WARNING: unknown license "Apache-2.0)", please correct manually
WARNING: unknown license "Unicode-DFS-2016", please correct manually
Wrote: cryptography-rust-0.1.0.ebuild

I'm guessing that one of the crates doesn't follow SPDX strictly and didn't add whitespace around parentheses in the license string. That said, it'd be nice if cargo-ebuild actually said which crate caused that.

add tests

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests (target/debug/deps/cargo_ebuild-9fb62095b3a574f7)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests cargo_ebuild

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

0 tests is not ok =)

Support live ebuilds

There should be a flag to generate live ebuilds or at least some extra code in the current template to allow the maintainer to rename and use as a 9999 ebuild.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.