Spec URL: https://orion.fedorapeople.org/rust-onenote_parser.spec SRPM URL: https://orion.fedorapeople.org/rust-onenote_parser-0.3.1-1.fc41.src.rpm Description: A parser for Microsoft OneNote® files. Fedora Account System Username: orion This is needed for clamav 1.3.0+ Currently is doesn't build due to changes in the widestring dep: error[E0412]: cannot find type `MissingNulError` in crate `widestring` --> src/errors.rs:54:23 | 54 | impl From<widestring::MissingNulError<u16>> for Error { | ^^^^^^^^^^^^^^^ not found in `widestring` error[E0412]: cannot find type `MissingNulError` in crate `widestring` --> src/errors.rs:55:30 | 55 | fn from(err: widestring::MissingNulError<u16>) -> Self { | ^^^^^^^^^^^^^^^ not found in `widestring` error[E0412]: cannot find type `MissingNulError` in crate `widestring` --> src/errors.rs:131:26 | 131 | err: widestring::MissingNulError<u16>, | ^^^^^^^^^^^^^^^ not found in `widestring` warning: unused import: `Cursor` --> src/onenote/mod.rs:9:32 | 9 | use std::io::{BufReader, Read, Cursor}; | ^^^^^^ | = note: `#[warn(unused_imports)]` on by default For more information about this error, try `rustc --explain E0412`. Help with that would be appreciated.
So my naive patch is: diff -up onenote_parser-0.3.1/src/errors.rs.widestring onenote_parser-0.3.1/src/errors.rs --- onenote_parser-0.3.1/src/errors.rs.widestring 2006-07-23 19:21:28.000000000 -0600 +++ onenote_parser-0.3.1/src/errors.rs 2024-04-22 21:31:52.083264294 -0600 @@ -51,8 +51,8 @@ impl From<std::string::FromUtf16Error> f } } -impl From<widestring::MissingNulError<u16>> for Error { - fn from(err: widestring::MissingNulError<u16>) -> Self { +impl From<widestring::error::MissingNulTerminator> for Error { + fn from(err: widestring::error::MissingNulTerminator) -> Self { ErrorKind::from(err).into() } } @@ -128,6 +128,6 @@ pub enum ErrorKind { #[error("UTF-16 string is missing null terminator: {err}")] Utf16MissingNull { #[from] - err: widestring::MissingNulError<u16>, + err: widestring::error::MissingNulTerminator, }, } diff -up onenote_parser-0.3.1/src/utils.rs.widestring onenote_parser-0.3.1/src/utils.rs --- onenote_parser-0.3.1/src/utils.rs.widestring 2006-07-23 19:21:28.000000000 -0600 +++ onenote_parser-0.3.1/src/utils.rs 2024-04-22 21:41:02.878758421 -0600 @@ -12,7 +12,7 @@ impl Utf16ToString for &[u8] { .map(|v| u16::from_le_bytes([v[0], v[1]])) .collect(); - let value = U16CString::from_vec_with_nul(data)?; + let value = U16CString::from_vec_truncate(data); Ok(value.to_string()?) } I dropped the ? because rust said it couldn't be applied but that led to: error[E0277]: `?` couldn't convert the error to `errors::Error` --> src/utils.rs:17:29 | 17 | Ok(value.to_string()?) | ^ the trait `From<Utf16Error>` is not implemented for `errors::Error`, which is required by `std::result::Result<String, errors::Error>: FromResidual<std::result::Result<Infallible, Utf16Error>>` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = help: the following other types implement trait `From<T>`: <errors::Error as From<uuid::Error>> <errors::Error as From<widestring::error::MissingNulTerminator>> <errors::Error as From<errors::ErrorKind>> <errors::Error as From<std::io::Error>> <errors::Error as From<FromUtf16Error>> = note: required for `std::result::Result<String, errors::Error>` to implement `FromResidual<std::result::Result<Infallible, Utf16Error>>` At this point I'll just say I know nothing about rust and will stop. Help appreciated.
Found that upstream has actually merged some fixes so current version builds okay.
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/onenote_parser-0.3.1/CHANGELOG.md 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", "*No copyright* Mozilla Public License 2.0". 126 files have unknown license. Detailed output of licensecheck in /home/pemensik/fedora/rawhide/2276561-rust- onenote_parser/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. [x]: 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. [x]: Package contains systemd file(s) if in need. [x]: Useful -debuginfo package or justification otherwise. [x]: Package is not known to require an ExcludeArch tag. [x]: 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]: The License field must be a valid SPDX expression. [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 4884 bytes in 2 files. [x]: Packages must not store files under /srv, /opt or /usr/local ===== SHOULD items ===== Generic: [x]: 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). [x]: Fully versioned dependency in subpackages if applicable. Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in onenote_parser , rust-onenote_parser-devel , rust- onenote_parser+default-devel , rust-onenote_parser+backtrace-devel [x]: Package functions as described. [x]: Latest version is packaged. [x]: Package does not include license text files separate from upstream. [x]: Patches link to upstream bugs/comments/lists or are otherwise justified. [-]: Sources are verified with gpgverify first in %prep if upstream publishes signatures. Note: gpgverify is not used. [x]: Package should compile and build into binary rpms on all supported architectures. [x]: %check is present and all tests pass. [x]: 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]: Spec use %global instead of %define unless justified. ===== EXTRA items ===== Generic: [!]: Spec file according to URL is the same as in SRPM. Note: Spec file as given by url is not the same as in SRPM (see attached diff). See: (this test has no URL) [x]: Rpmlint is run on all installed packages. Note: There are rpmlint messages (see attachment). [x]: Large data in /usr/share should live in a noarch subpackage if package is arched. Rpmlint ------- Checking: onenote_parser-0.3.1-1.fc41.x86_64.rpm rust-onenote_parser-devel-0.3.1-1.fc41.noarch.rpm rust-onenote_parser+default-devel-0.3.1-1.fc41.noarch.rpm rust-onenote_parser+backtrace-devel-0.3.1-1.fc41.noarch.rpm rust-onenote_parser-debugsource-0.3.1-1.fc41.x86_64.rpm rust-onenote_parser-0.3.1-1.fc41.src.rpm ========================================================= rpmlint session starts ======================================================== rpmlint: 2.4.0 configuration: /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml /etc/xdg/rpmlint/fedora-legacy-licenses.toml /etc/xdg/rpmlint/fedora-spdx-licenses.toml /etc/xdg/rpmlint/fedora.toml /etc/xdg/rpmlint/scoring.toml /etc/xdg/rpmlint/users-groups.toml /etc/xdg/rpmlint/warn-on-functions.toml rpmlintrc: [PosixPath('/tmp/tmpl38fsd6c')] checks: 31, packages: 6 rust-onenote_parser.src: W: strange-permission 13.patch 660 rust-onenote_parser.src: W: strange-permission onenote_parser-0.3.1.crate 660 rust-onenote_parser.src: W: strange-permission rust-onenote_parser-deps.patch 660 rust-onenote_parser.src: W: strange-permission rust-onenote_parser-updates.patch 660 rust-onenote_parser.src: W: strange-permission rust-onenote_parser.spec 660 onenote_parser.x86_64: W: no-manual-page-for-binary onenote-parse rust-onenote_parser+backtrace-devel.noarch: W: no-documentation rust-onenote_parser+default-devel.noarch: W: no-documentation onenote_parser.x86_64: W: invalid-license # FIXME ========================== 6 packages and 0 specfiles checked; 0 errors, 9 warnings, 0 badness; has taken 0.7 s ========================= Rpmlint (installed packages) ---------------------------- ============================ rpmlint session starts ============================ rpmlint: 2.5.0 configuration: /usr/lib/python3.12/site-packages/rpmlint/configdefaults.toml /etc/xdg/rpmlint/fedora-legacy-licenses.toml /etc/xdg/rpmlint/fedora-spdx-licenses.toml /etc/xdg/rpmlint/fedora.toml /etc/xdg/rpmlint/scoring.toml /etc/xdg/rpmlint/users-groups.toml /etc/xdg/rpmlint/warn-on-functions.toml checks: 32, packages: 5 onenote_parser.x86_64: W: no-manual-page-for-binary onenote-parse rust-onenote_parser+default-devel.noarch: W: no-documentation rust-onenote_parser+backtrace-devel.noarch: W: no-documentation onenote_parser.x86_64: W: invalid-license # FIXME 5 packages and 0 specfiles checked; 0 errors, 4 warnings, 20 filtered, 0 badness; has taken 0.5 s Source checksums ---------------- https://crates.io/api/v1/crates/onenote_parser/0.3.1/download#/onenote_parser-0.3.1.crate : CHECKSUM(SHA256) this package : eeff533445292266865afd73da60b79e748716797634356f1574770b7b1c328b CHECKSUM(SHA256) upstream package : eeff533445292266865afd73da60b79e748716797634356f1574770b7b1c328b Requires -------- onenote_parser (rpmlib, GLIBC filtered): ld-linux-x86-64.so.2()(64bit) libc.so.6()(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libgcc_s.so.1(GCC_3.3)(64bit) libgcc_s.so.1(GCC_4.2.0)(64bit) rtld(GNU_HASH) rust-onenote_parser-devel (rpmlib, GLIBC filtered): (crate(bytes/default) >= 0.5.0 with crate(bytes/default) < 0.6.0~) (crate(encoding_rs/default) >= 0.8.31 with crate(encoding_rs/default) < 0.9.0~) (crate(enum-primitive-derive/default) >= 0.3.0 with crate(enum-primitive-derive/default) < 0.4.0~) (crate(itertools/default) >= 0.12.1 with crate(itertools/default) < 0.13.0~) (crate(num-traits/default) >= 0.2.0 with crate(num-traits/default) < 0.3.0~) (crate(paste/default) >= 1.0.0 with crate(paste/default) < 2.0.0~) (crate(thiserror/default) >= 1.0.0 with crate(thiserror/default) < 2.0.0~) (crate(uuid/default) >= 0.8.0 with crate(uuid/default) < 0.9.0~) (crate(widestring/default) >= 1.1.0 with crate(widestring/default) < 2.0.0~) cargo rust-onenote_parser+default-devel (rpmlib, GLIBC filtered): cargo crate(onenote_parser) rust-onenote_parser+backtrace-devel (rpmlib, GLIBC filtered): cargo crate(onenote_parser) rust-onenote_parser-debugsource (rpmlib, GLIBC filtered): Provides -------- onenote_parser: onenote_parser onenote_parser(x86-64) rust-onenote_parser-devel: crate(onenote_parser) rust-onenote_parser-devel rust-onenote_parser+default-devel: crate(onenote_parser/default) rust-onenote_parser+default-devel rust-onenote_parser+backtrace-devel: crate(onenote_parser/backtrace) rust-onenote_parser+backtrace-devel rust-onenote_parser-debugsource: rust-onenote_parser-debugsource rust-onenote_parser-debugsource(x86-64) Diff spec file in url and in SRPM --------------------------------- --- /home/pemensik/fedora/rawhide/2276561-rust-onenote_parser/srpm/rust-onenote_parser.spec 2024-05-12 00:39:59.324463818 +0200 +++ /home/pemensik/fedora/rawhide/2276561-rust-onenote_parser/srpm-unpacked/rust-onenote_parser.spec 2024-04-25 02:00:00.000000000 +0200 @@ -1,2 +1,12 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.6.3) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 1; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + # Generated by rust2rpm 26 %bcond_without check @@ -104,3 +114,6 @@ %changelog -%autochangelog +## START: Generated by rpmautospec +* Thu Apr 25 2024 Orion Poplawski <orion> - 0.3.1-1 +- Uncommitted changes +## END: Generated by rpmautospec Generated by fedora-review 0.10.0 (e79b66b) last change: 2023-07-24 Command line :/usr/bin/fedora-review -b 2276561 Buildroot used: fedora-rawhide-x86_64 Active plugins: Shell-api, Generic Disabled plugins: SugarActivity, R, C/C++, Haskell, PHP, fonts, Java, Python, Ocaml, Perl Disabled flags: EXARCH, EPEL6, EPEL7, DISTTAG, BATCH
it builds now and references upstream patches. I haven't found anything preventing review passing.
There's some things that look fishy (like 37 compiler warnings, which is *a lot* for Rust crates). But the thing that definitely shouldn't make this pass review are the two FIXME items in the spec that were not addressed. I would recommend to either address the FIXME items or to drop the "onenote_parser" binary if you don't need it.
FYI, I also think the (R) needs to be dropped from the package summary and description. It's not allowed: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_trademarks_in_summary_or_description
I've fixed the FIXME license and removed the copyright symbol. As for the warnings, the vast majority are "fields .* are never read". Which I take to be a fleshing out of data structures for the documents, without there really being any code that yet processes them. The other two are unused imports. So, not great but also nothing that indicates (at least to my inexperienced in rust eyes) worrying issues.
> License: MPL-2.0 > # LICENSE.dependencies contains a full license breakdown This is still not correct. The output of %cargo_license_summary is: ``` # (Apache-2.0 OR MIT) AND BSD-3-Clause # Apache-2.0 OR MIT # MIT # MIT OR Apache-2.0 # MPL-2.0 ``` So the license for the binary subpackage should be: ``` # (Apache-2.0 OR MIT) AND BSD-3-Clause # Apache-2.0 OR MIT # MIT # MIT OR Apache-2.0 # MPL-2.0 License: MPL-2.0 AND BSD-3-Clause AND MIT AND (Apache-2.0 OR MIT) # LICENSE.dependencies contains a full license breakdown ``` Again, do you need the crate for its library interface, or do you have a use for the "onenote-parse" executable too? If the answer is no, it would be easier long-term to not package the executable. Looking at the code, it looks more like a toy example than an actually usable program.
Okay, latest version ditches the executable. Spec URL: https://orion.fedorapeople.org/rust-onenote_parser.spec SRPM URL: https://orion.fedorapeople.org/rust-onenote_parser-0.3.1-1.fc41.src.rpm
Thanks! Petr, do you want to take another look too?
This is an automatic action taken by review-stats script. The ticket reviewer failed to clear the NEEDINFO flag in a month. As per https://fedoraproject.org/wiki/Policy_for_stalled_package_reviews we reset the status and the assignee of this ticket.
It looks like you manually yanked out all the stuff for building the application? But you missed some things, like """ %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies """ There's an official rust2rpm.toml setting available that achieves "don't ship the executable" correctly: ```toml [package] cargo-install-bin = false ``` You also should *only* ever patch Cargo.toml with "rust2rpm -p". Changes to Cargo.toml (obviously) affect the generated .spec file, so they need to be applied *before* the spec file is generated. You can preserve the comment you added for the Cargo.toml patch like this: ```toml [package] cargo-toml-patch-comments = [ "Adjust versions of dependencies", ] You can also persist your patches with rust2rpm.toml settings like these: ```toml [[package.extra-patches]] number = 2 file = "rust-onenote_parser-updates.patch" comments = [ "Upstream bump of dependencies - merged but not yet released", "Modified to remove Cargo.toml changes since it gets reformatted and drop one change not yet present in Fedora:", "https://github.com/msiemens/onenote.rs/pull/9", ] [[package.extra-patches]] number = 3 file = "https://github.com/msiemens/onenote.rs/pull/13.patch" comments = [ "Apply Cisco-Talos patch as this is really only needed for clamav", ] ``` I'll attach a complete rust2rpm.toml file with all these settings.
Created attachment 2046667 [details] suggested rust2rpm.toml config file
Sorry for long delay! I think the second patch should be made when doing rust2rpm -p, so it has common format. That is unfortunately a MUST for Rust packages. Read that at bottom of: https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_rust2rpm Nice, I were to suggest creation of rust2rpm.toml, but did not know how to correctly add extra patches. Fabio is much better with Rust tooling. Anyway, please try creating it with rust2rpm.toml, so rebases later can be done non-interactive way.
Fabio - thank you very much for the instruction in rust2rpm.toml - I had no idea that existed. Spec URL: https://orion.fedorapeople.org/rust-onenote_parser.spec SRPM URL: https://orion.fedorapeople.org/rust-onenote_parser-0.3.1-1.fc42.src.rpm Hopefully that was done properly.
> Fabio - thank you very much for the instruction in rust2rpm.toml - I had no idea that existed. Yeah, it's very useful for storing settings and / or changes that need to persist across re-generations of the spec file. I recently added some docs for it in the "rust2rpm.toml(5)" manpage, I hope they're helpful. You can also use settings to override the Summary and %description (i.e. to persist the removal of the ® symbol). Package looks good to me now! === Package was generated with rust2rpm, simplifying the review. ✅ package contains only permissible content ✅ 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 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: - 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 - add @rust-sig with "commit" access as package co-maintainer (should happen automatically) - set bugzilla assignee overrides to @rust-sig (optional) - track package in koschei for all built branches (should happen automatically once rust-sig is co-maintainer)
The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-onenote_parser
Thanks for the review. Checked in and built.