Description of problem: When setting up chroot environments from the outside, rpm assumes that the chroot-environment has the same architecture as the host-environment. This is very bad when e.g. host is an i686 and the target-system an arm or i586. Since bug #84055 was refused, there is needed another way to do this. IMO, with using environment variables, this can be reached without much effort. Version-Release number of selected component (if applicable): rpm-4.2.1-0.30
Created attachment 94057 [details] rpm-platform.patch patch is untested but on the first glance, it should be compilable.
This seems a bit of a half baked solution, although I can understand you don't want to touch /etc/rpm/platform every time. A real fix would be a command line switch (--targetarch). Now how about adding a patch for that ;) ?
Why half baked? Configuration through environment variables is an often used and very effective solution (e.g. think on all the *_proxy variables or TERM or TZ or ...). A CLI switch does not really help since tools like apt or yum would not know how to use it. AFAIR, reading of /etc/rpm/platform happens *very* early and before CLI options are evaluated. The latter fact makes it impossible too, to use a %macro for it.
I guess you are right. Your argumentation completely convinced me ;-) .
No way is rpm arch going to be set from an RPM_PLATFORM environment variable. Teaching install/erase/upgrade modes about --target (which has already been done for --query --specedit) is an alternative. Deferred until somewhen ...