How to update rpm database regarding removed file of a package?

For Suppose, I have installed a package having files file1, file2 and file3. After installation, I removed the file "file3".

But "rpm -qf file3" is giving the package name, even file3 was not there. And also "rpm -ql package" is also displaying all 3 files.

How can i update rpm database about the package to display only available files i.e. file1 and file2 when queried with "rpm -ql".

I want a shell script to update rpm database so that I can get only file1 and file2 when queried with "rpm -ql".

Anybody is there to help me in this context?

RPM database can be updated only during an installation, thus I think you can not do this.

You can adjust the RPM database contents via a number of undocumented APIs but unless you really know what you are doing I would strongly advise you not to attempt to do so.

Why not rebuild the package without the particular unwanted file and install that custom package instead?

whats my problem is, i am building a combined package for 32-bit and 64-bit using rpmbuild with --noarch

On 64-bit system, all files are getting installed whatever mentioned in the %files section of the spec file.(Both 32-bit and 64-bit files).
On 32-bit system also, all files are getting installed whatever mentioned in the %files section of the spec file but 64-bit files are removed during postinstall(I wrote a code for removal of 64-bit in %post section of spec file).

The problem is, on 32-bit machine, package manager displays all files when queried to display the files installed by the package. So 64-bit files being displayed on 32-bit machine even removing those files during post install.(eg rpm -ql)

Is there any good way to remove 64-bit files on 32-bit machine?

---------- Post updated at 02:47 PM ---------- Previous update was at 11:53 AM ----------

Suggest me any better way to build combined package(for 32-bit and 64-bit architectures) with noarch tag.

Short answer - no. The "correct" method is a build a separate RPM for each architecture or programming model. noarch should only be used for what it is intended - architecture independent files such as documentation and man pages.

Thank you..