-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add detection of %posttrans and %pretrans scriptlet from rpm header #427
Conversation
Could you rewrite the commit message? "add posttrans and pretrans for parsehdr" is not good because that's already visible in the code. Instead use the text you wrote into the pull request text. The commit message should document a reason why it commit exists. |
@ppisar done |
Thanks for the commit message. Handling RPMSENSE_PRETRANS as RPMSENSE_PREREQ is fine. But I'm not sure whether RPMSENSE_POSTTRANS should be exported into XML with "pre" attribute. RPM documents the distinction:
Notice that posttrans can be satisfied by installing a package during that transaction. Exporting the dependency with "pre" attribute is stronger. I don't say RPMSENSE_POSTTRANS should not be recorded in the XML output. But marking the with "pre" attribute does not seem right to me. I can see that RPMSENSE_SCRIPT_POST is marked with "pre" attribute. I feel that it's actually a bug. We need it find someone more knowledgeable in this area. |
@j-mracek, have you an idea what "<rpm:entry pre=1/>" attribute in the primary.xml means? Is using that attribute for RPMSENSE_POSTTRANS dependencies correct? I cannot find anything about post dependencies in libsolv. |
By the way. @wswsmao, this feature should have a test. There is test_xmlfile_add_pkg() in tests/python/tests/test_xml_file.py and tests/testdata/specs/fake-Archer.spec which could be enhanced. Look for "foof" dependency. |
I was thinking about it and maybe the semantics of "pre" attribute is different for the package mangers. Maybe libsolv does not care which package is installed first and which later. Maybe libsolv only cares about a state before and after the transaction, it does not hassle with the order. Maybe it uses "pre" attribute to mark packages which must be present during the installation, but can be uninstalled after the transaction. (Computing the exact order is then left to RPM.) If this theory is correct, then it you patch is also correct. |
Hi @ppisar , I have enhanced the test,but I get this error:
Is there any other file need be updated ? |
First of all, please rebase your branch to current master. Your branch is missing 25 recent commit and therefore it does not build for me. |
@ppisar rebase done |
It reason is that the tests use pregenerated RPM packages from tests/testdata/packages directory without rebuilding them from spec files located in tests/testdata/specs. That means you need to manually rebuild tests/testdata/packages/Archer-3.4.5-6.x86_64.rpm from tests/testdata/specs/fake-Archer.spec and add that binary package into the commit. When you build the package, make sure it keeps using Xz compression (a synthetic run-time dependency on "rpmlib(PayloadIsXz)"). The compression is controlled with _binary_payload macro. That helps you to proceed with the tests. You will get two new failures on an unexpected size of primary.xml and a package ID of Archer-3.4.5-6.x86_64.rpm. After correcting them, the tests could pass. |
ok,i will try it |
1ca263d
to
52fb5c7
Compare
Hi @ppisar , I think I have adapted enough files, but there is still error like this:
what's more, is there any tools or script coud simply this work? |
That piece of test checks for an SHA-256 checksum of an uncompressed content of the primary.xml file. A name of the file is stored in "path" variable. I don't think there is a script for updating the tests. Just use the "d447983b39363a6519067ce477a7fc64409b4900e0160da68d66b25207a0408d" value. You can get it when you spawn an interactive shell from the test and run something like "zcat /tmp/createrepo_ctest-r5x4jlba/primary.xml.gz | sha256sum -b". (I think that some tests like the checksum are pointless and that the rest should be automated, so the packages are built from spec files automatically and package checksums retrieved automatically. However, I'm not an author, nor long-term maintainer of createrepo_c.) |
In specs files, user may use %posttrans and %pretrans scriptlet like this: Requires(pretrans): test_pkg Requires(posttrans): test_pkg This commit add detection to the above special scriptlet Signed-off-by: Shuo Wang <[email protected]>
@ppisar done |
Thanks for the tests. They look good. I believe the single failure in testing-farm:fedora-40-x86_64:createrepo_c-tests is unrelated. I only rerun that test to see whether the failure is random or deterministic. I talked to other DNF developers and they think that handling post-dependencies with pre="1" attribute is fine because libsolv indeed uses it as a dependency on a package which must be present, but can be removed later. |
f02f17a
into
rpm-software-management:master
In specs files, user may use %posttrans and %pretrans scriptlet like this:
Requires(pretrans): test_pkg
Requires(posttrans): test_pkg
This commit add detection to the above special scriptlet