Spec URL: https://eclipseo.fedorapeople.org/for-review/rust-gag.spec SRPM URL: https://eclipseo.fedorapeople.org/for-review/rust-gag-1.0.0-1.fc36.src.rpm Description: Redirect, or hold stdout/stderr output. Currently only *nix operating systems are supported. Fedora Account System Username: eclipseo
Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=88984845
Unofficial Review: Package Review ============== Legend: [x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated [ ] = Manual review needed Issues: ======= - Package does not contain duplicates in %files. Note: warning: File listed twice: /usr/share/cargo/registry/gag-1.0.0/LICENSE See: https://docs.fedoraproject.org/en-US/packaging- guidelines/#_duplicate_files ===== MUST items ===== Generic: [x]: Package is licensed with an open-source compatible license and meets other legal requirements as defined in the legal section of Packaging Guidelines. [x]: License field in the package spec file matches the actual license. Note: Checking patched sources after %prep for licenses. Licenses found: "Unknown or generated", "MIT License". 11 files have unknown license. Detailed output of licensecheck in /home/FedoraPackaging/rust-gag/2103367-rust- gag/licensecheck.txt [x]: License file installed when any subpackage combination is installed. [x]: %build honors applicable compiler flags or justifies otherwise. [x]: Package contains no bundled libraries without FPC exception. [x]: Changelog in prescribed format. [x]: Sources contain only permissible code or content. [-]: Package contains desktop file if it is a GUI application. [x]: Development files must be in a -devel package [x]: Package uses nothing in %doc for runtime. [x]: Package consistently uses macros (instead of hard-coded directory names). [x]: Package is named according to the Package Naming Guidelines. [x]: Package does not generate any conflict. [x]: Package obeys FHS, except libexecdir and /usr/target. [-]: If the package is a rename of another package, proper Obsoletes and Provides are present. [x]: Requires correct, justified where necessary. [x]: Spec file is legible and written in American English. [-]: Package contains systemd file(s) if in need. [x]: Package is not known to require an ExcludeArch tag. [?]: Package complies to the Packaging Guidelines [x]: Package successfully compiles and builds into binary rpms on at least one supported primary architecture. [x]: Package installs properly. [x]: Rpmlint is run on all rpms the build produces. Note: There are rpmlint messages (see attachment). [x]: If (and only if) the source package includes the text of the license(s) in its own file, then that file, containing the text of the license(s) for the package is included in %license. [x]: Package requires other packages for directories it uses. [x]: Package must own all directories that it creates. [x]: Package does not own files or directories owned by other packages. [x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT [x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the beginning of %install. [x]: Macros in Summary, %description expandable at SRPM build time. [x]: Dist tag is present. [x]: Permissions on files are set properly. [x]: Package must not depend on deprecated() packages. [x]: Package use %makeinstall only when make install DESTDIR=... doesn't work. [x]: Package is named using only allowed ASCII characters. [x]: Package does not use a name that already exists. [x]: Package is not relocatable. [x]: Sources used to build the package match the upstream source, as provided in the spec URL. [x]: Spec file name must match the spec package %{name}, in the format %{name}.spec. [x]: File names are valid UTF-8. [x]: Large documentation must go in a -doc subpackage. Large could be size (~1MB) or number of files. Note: Documentation size is 0 bytes in 0 files. [x]: Packages must not store files under /srv, /opt or /usr/local ===== SHOULD items ===== Generic: [-]: If the source package does not include license text(s) as a separate file from upstream, the packager SHOULD query upstream to include it. [x]: Final provides and requires are sane (see attachments). [?]: Fully versioned dependency in subpackages if applicable. Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in rust- gag-devel , rust-gag+default-devel [?]: Package functions as described. [x]: Latest version is packaged. [x]: Package does not include license text files separate from upstream. [-]: Sources are verified with gpgverify first in %prep if upstream publishes signatures. Note: gpgverify is not used. [x]: %check is present and all tests pass. [?]: Packages should try to preserve timestamps of original installed files. [x]: Reviewer should test that the package builds in mock. [x]: Buildroot is not present [x]: Package has no %clean section with rm -rf %{buildroot} (or $RPM_BUILD_ROOT) [x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin. [x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file [x]: Sources can be downloaded from URI in Source: tag [x]: SourceX is a working URL. [x]: Package should compile and build into binary rpms on all supported architectures. [x]: Spec use %global instead of %define unless justified. ===== EXTRA items ===== Generic: [x]: Rpmlint is run on all installed packages. Note: There are rpmlint messages (see attachment). [x]: Spec file according to URL is the same as in SRPM. Rpmlint ------- Cannot parse rpmlint output: Rpmlint (installed packages) ---------------------------- Cannot parse rpmlint output: Source checksums ---------------- https://crates.io/api/v1/crates/gag/1.0.0/download#/gag-1.0.0.crate : CHECKSUM(SHA256) this package : a713bee13966e9fbffdf7193af71d54a6b35a0bb34 997cd6c9519ebeb5005972 CHECKSUM(SHA256) upstream package : a713bee13966e9fbffdf7193af71d54a6b35a0bb34 997cd6c9519ebeb5005972 Requires -------- rust-gag-devel (rpmlib, GLIBC filtered): (crate(filedescriptor/default) >= 0.8.0 with crate(filedescriptor/default) < 0.9.0~) (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~) cargo rust-gag+default-devel (rpmlib, GLIBC filtered): cargo crate(gag) Provides -------- rust-gag-devel: crate(gag) rust-gag-devel rust-gag+default-devel: crate(gag/default) rust-gag+default-devel Generated by fedora-review 0.8.0 (e988316) last change: 2022-04-07 Command line :/usr/bin/fedora-review -b 2103367 Buildroot used: fedora-rawhide-x86_64 Active plugins: Shell-api, Generic Disabled plugins: Python, Ocaml, SugarActivity, Java, PHP, Perl, R, C/C++, fonts , Haskell Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH Comments: 1) The package has documentation, https://docs.rs/gag/latest/src/gag/lib.rs.html#1-131 is it possible to package this? Related issue https://github.com/Stebalien/gag-rs/issues/9 rustdoc seems to download from the internet and create a website with embedded javascript and fonts that are not great to package, though output of Json seems to be in progress. It seems possible to use pandoc to generate documentation that is suitable for the terminal https://github.com/brotzeit/rustic#rust-docs-in-org-mode . Using pandoc on html generated by rustdoc creates output that could be fed into https://github.com/rust-cli/man . For the current package, a pandoc generated markdown file contains the following Expand description ::: docblock Temporarily redirect stdout/stderr. For example, one can temporarily throw away stdout output: ::: example-wrap ``` {.rust .rust-example-rendered} use gag::Gag; println!("Hello world!"); { let print_gag = Gag::stdout().unwrap(); println!("No one will see this!"); println!("Or this!"); } println!("But they will see this!"); ``` ::: You can also temporarily un-gag by dropping the gag: ::: example-wrap ``` {.rust .rust-example-rendered} use gag::Gag; let mut print_gag = Gag::stdout().unwrap(); println!("No one will see this!"); if true { drop(print_gag); println!("They will see this..."); print_gag = Gag::stdout().unwrap(); println!("Not this..."); } println!("Nor this."); ``` ::: However, you can't open multiple Gags/Redirects/Holds for the same output at once: ::: example-wrap ``` {.rust .rust-example-rendered} use gag::Gag; // Multiple stdout gags let gag_a = Gag::stdout().unwrap(); let gag_b_result = Gag::stdout(); assert!(gag_b_result.is_err()); assert_eq!(gag_b_result.err().expect("Expected an error").kind(), std::io::ErrorKind::AlreadyExists); // However, you can still gag stderr: let gag_c = Gag::stderr().unwrap(); ``` ::: If you don't want to throw away stdout, you can write it to a file: ::: example-wrap ``` {.rust .rust-example-rendered} use std::fs::OpenOptions; use std::io::{Read, Write, Seek, SeekFrom}; use gag::Redirect; use dirs::data_local_dir; fn get_temp_filepath() -> String { #[cfg(windows)] return data_local_dir() .unwrap() .join("Temp") .join("my_log.log") .to_string_lossy() .into(); #[cfg(unix)] return "/tmp/my_log.log".into(); } println!("Displayed"); // Open a log let log = OpenOptions::new() .truncate(true) .read(true) .create(true) .write(true) .open(get_temp_filepath()) .unwrap(); let print_redirect = Redirect::stdout(log).unwrap(); println!("Hidden"); // Extract redirect let mut log = print_redirect.into_inner(); println!("Displayed"); let mut buf = String::new(); log.seek(SeekFrom::Start(0)).unwrap(); log.read_to_string(&mut buf).unwrap(); assert_eq!(&buf[..], "Hidden\n"); ``` ::: Alternatively, you can buffer stdout to a temporary file. On linux 3.11+, this file is guarenteed to be stored in-memory. ::: example-wrap ``` {.rust .rust-example-rendered} use std::io::Read; use gag::BufferRedirect; let mut buf = BufferRedirect::stdout().unwrap(); println!("Hello world!"); let mut output = String::new(); buf.read_to_string(&mut output).unwrap(); assert_eq!(&output[..], "Hello world!\n"); ``` ::: Finally, if you just want to temporarily hold std output, you can use `Hold` to hold the output until dropped: ::: example-wrap ``` {.rust .rust-example-rendered} use gag::Hold; let hold = Hold::stdout().unwrap(); println!("first"); println!("second"); drop(hold); // printing happens here! ``` ::: ::: ## [Structs](#structs) {#structs .section-header} ::: item-table ::: item-row ::: {.item-left .module-item} [Buffer](struct.Buffer.html "gag::Buffer struct"){.struct} ::: ::: {.item-right .docblock-short} An in-memory read-only buffer into which BufferRedirect buffers output. ::: ::: ::: item-row ::: {.item-left .module-item} [BufferRedirect](struct.BufferRedirect.html "gag::BufferRedirect struct"){.struc t} ::: ::: {.item-right .docblock-short} Buffer output in an in-memory buffer. ::: ::: ::: item-row ::: {.item-left .module-item} [Gag](struct.Gag.html "gag::Gag struct"){.struct} ::: ::: {.item-right .docblock-short} Discard output until dropped. ::: ::: ::: item-row ::: {.item-left .module-item} [Hold](struct.Hold.html "gag::Hold struct"){.struct} ::: ::: {.item-right .docblock-short} Hold output until dropped. On drop, the held output is sent to the stdout/stderr. ::: ::: ::: item-row ::: {.item-left .module-item} [Redirect](struct.Redirect.html "gag::Redirect struct"){.struct} ::: ::: {.item-right .docblock-short} Redirect stderr/stdout to a file. ::: ::: ::: item-row ::: {.item-left .module-item} [RedirectError](struct.RedirectError.html "gag::RedirectError struct"){.struct} ::: ::: {.item-right .docblock-short} 2) An empty package rust-gag+default-devel-1.0.0-1.fc37.noarch.rpm is created 3) File timestamps are 1 January 1970, probably due to how automated packaging from a crate works. 4)
For explanation: > 1) The package has documentation, https://docs.rs/gag/latest/src/gag/lib.rs.html#1-131 is it possible to package this? Short answer: no. As you noted, the documentation built with rustdoc has all the same problems as other doc generation tools (sphinx, ruby / rdoc, etc.) in that it bundles fonts, JavaScript, etc. into them, which is typically not acceptable for a Fedora package. Additionally, there's a central location for documentation for all published Rust crates. In this case, documentation for all (also historical versions of the "gag" crate would be available at https://docs.rs/gag > 2) An empty package rust-gag+default-devel-1.0.0-1.fc37.noarch.rpm is created It's not empty, it contains RPM metadata that is required to make dependency resolution work correctly for Rust packages. > 3) File timestamps are 1 January 1970, probably due to how automated packaging from a crate works. That's probably a problem on the developer's system (i.e. they're using Windows to publish sources, or something). === Actual review: Package was generated with rust2rpm, simplifying the review. - package builds and installs without errors on rawhide - test suite is run and all unit tests pass - latest version of the crate is packaged - license matches upstream specification (MIT) and is acceptable for Fedora - license file is included with %license in %files - package complies with Rust Packaging Guidelines Package APPROVED. === Recommended post-import rust-sig tasks: - add @rust-sig with "commit" access as package co-maintainer - set bugzilla assignee overrides to @rust-sig (optional) - set up package on release-monitoring.org: project: $crate homepage: https://crates.io/crates/$crate backend: crates.io version scheme: semantic version filter: alpha;beta;rc;pre distro: Fedora Package: rust-$crate - track package in koschei for all built branches === Since you offered review swaps, could you review https://bugzilla.redhat.com/show_bug.cgi?id=2089436 in return? This missing package blocks updates of syn, proc-macro2, etc.
Thanks for the feedback, in particular on rust-gag+default-devel-1.0.0-1.fc37.noarch.rpm, still learning about packaging. Two comments (can post on devel list to get further feedback if required): a) Rdoc can generate RI[1] files which do not have packaging problems. It would be good to have other documentation tools also generate this kind of documentation, particularly for command line tools. b) There was also the warning: warning: File listed twice: /usr/share/cargo/registry/gag-1.0.0/LICENSE See: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_duplicate_files Is that something that needs to be fixed in rust2rpm or in the packaging guidelines? go2rpm also does the same. 1] https://github.com/ruby/rdoc/blob/master/RI.rdoc
> a) Rdoc can generate RI[1] files which do not have packaging problems. It would be good to have other documentation tools also generate this kind of documentation, particularly for command line tools. In contrast to ruby packages, which are actually used at runtime and installed on users' systems, Rust packages (for libraries) are only ever installed in temporary build environments. I'm not sure providing a -docs subpackage would actually provide any value. Ignoring that, that's all not a problem with our tooling, but with rustdoc itself, which is outside the scope of this review :) > b) There was also the warning: warning: File listed twice: /usr/share/cargo/registry/gag-1.0.0/LICENSE Yeah, that's only a warning. It should not cause any problems with the packages. It would also be rather cumbersome and error-prone to work around this in our packaging tools, so we just let it be a warning. And given that those packages are only ever installed in throw-away mock chroots ... meh.
Thanks Benson and Fabio!
(fedscm-admin): The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-gag
I went ahead and submitted builds so fixing rust-just can move forward: https://bodhi.fedoraproject.org/updates/FEDORA-2022-92a05ca67e https://bodhi.fedoraproject.org/updates/FEDORA-2022-55d452bf80 https://bodhi.fedoraproject.org/updates/FEDORA-2022-ad65a915ba https://bodhi.fedoraproject.org/updates/FEDORA-2022-b802d1c152