Thanks very much for the help. There are a lot of thins which prevented me from 
doing what I need, though I managed to do it eventually. As a sort of thanks, 
here is what I had problem with and what needed to do:

Problems:
1. I don't need to remove immutability from headers for modifying them. Even if 
I had needed, it would have segfaulted all the time in `qsort` call somewhere 
in `headerGet`.
2. I don't need to mimick `lib/pack.c` or `sig/rpmgensig.c`'s package modifier 
functions because all of these manipulations are not applicable just for 
changing some header tag value. The reason of that is that the function which 
is called in both of these places, `rpmGenerateSignature` uses `rpmtd` inside 
it and I found (after spending a lot of time, of course) that it actually 
writes more than needed, all the time, and corrupts the header located after it 
(I got header read errors - bad magic all the time). I decided not to use this 
at all and to regenerate header's SHA1 hash and manually putting it inside my 
signature header with just `headerDel`/`headerPutString` functions without any 
`rpmtd` objects and everything worked fine.

I needed to patch an existing rpm by adding a certificate inside it. It seemed 
to be an easy task but the code in the rpm looks very complicated to me and I 
spent like 2+ weeks doing this easy thing: adding a header enum value and 
patching and rpm. I wish the librpm be not so useless for developers (it is 
just like nothing for a developer because he can't do anything with it).

Thank you again for spending time on my questions.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/478#issuecomment-410246821
_______________________________________________
Rpm-maint mailing list
[email protected]
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to