[through-able] poudriere: I don't want to rebuild rust with PORTREVISION bump of curl

From: Tatsuki Makino <tatsuki_makino_at_hotmail.com>
Date: Fri, 20 Jan 2023 08:40:33 UTC
This is an unimportant topic that may or may not be useful and can be skipped :)

Today, our poudriere would have output the following

[00:01:24] [Dry Run] Deleting rust-1.66.1.pkg: missing dependency: curl-7.87.0

This causes my poudriere to spend 4 hours rebuilding rust.
Not long ago, my poudriere spent 6.5 hours rebuilding gcc12 because of mpfr :)

I experimented with ways around this.

tar -x -v -f /usr/local/poudriere/data/packages/jailname-default/All/rust-1.66.1.pkg -C /tmp/ -- +COMPACT_MANIFEST +MANIFEST
# Substitute 7.87.0 and 7.87.0_1 in curl
# If 7.87.0 only appeared once, it might be easy to do using sed or something, but here I did it with vi to be sure :)
# Create a new package... somewhat strange command :)
tar -c -f - --exclude +\*MANIFEST @/usr/local/poudriere/data/packages/jailname-default/All/rust-1.66.1.pkg | tar -c -v -f /tmp/rust-1.66.1.pkg -J -C /tmp/ +COMPACT_MANIFEST +MANIFEST @-
# Copy owner and permissions
chmod `stat -f %Mp%Lp /usr/local/poudriere/data/packages/jailname-default/All/rust-1.66.1.pkg` /tmp/rust-1.66.1.pkg
chown `stat -f %u:%g /usr/local/poudriere/data/packages/jailname-default/All/rust-1.66.1.pkg` /tmp/rust-1.66.1.pkg
# Move the completed package
mv /tmp/rust-1.66.1.pkg /usr/local/poudriere/data/packages/jailname-default/All/

The replaced rust-*.pkg is no longer included in rebuild queue :)
And after this, the build of graphics/librsvg2-rust succeeded without any problems.

It uses the following behavior:
poudriere uses the following command to check dependencies
pkg query -F somepackage-0.pkg '%do %dn-%dv'
The -F option of pkg-query opens the package with pkg_open2 function in pkg-1.19.0/libpkg/pkg.c.
+COMPACT_MANIFEST and +MANIFEST are read in priority to the nearest the beginning of the package archive.

If you break a RUST package, give up and rebuild it :)
poudriere bulk -j jailname -C lang/rust
... 4 hours :)

Thank you for reading :)