[Rpm-maint] [rpm-software-management/rpm] Add real-life examples of Python RPM (PR #3177)

Panu Matilainen notifications at github.com
Mon Jun 24 09:24:41 UTC 2024


@pmatilai commented on this pull request.



> +import rpm
+
+ts = rpm.TransactionSet()
+mi = ts.dbMatch("name", "hello")
+hdr = next(mi, None)
+if hdr:
+    print(
+        f"Name        : {hdr[rpm.RPMTAG_NAME]}\n"
+        f"Version     : {hdr[rpm.RPMTAG_VERSION]}\n"
+        f"Release     : {hdr[rpm.RPMTAG_RELEASE]}\n"
+        f"Architecture: {hdr[rpm.RPMTAG_ARCH]}\n"
+        f"Install Date: {hdr[rpm.RPMTAG_INSTALLTIME]}\n"
+        f"Group       : {hdr[rpm.RPMTAG_GROUP]}\n"
+        f"Size        : {hdr[rpm.RPMTAG_SIZE]}\n"
+        f"License     : {hdr[rpm.RPMTAG_LICENSE]}\n"
+        f"Signature   : TODO\n"

The answer is not a single tag, it's either RPMTAG_RSAHEADER or RPMTAG_DSAHEADER (will cover both original DSA and ECDSA)

Most people prefer the shorter hdr['license'] syntax, but of course using rpm.RPMTAG_* symbols, errors are more up front.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3177#discussion_r1650668500
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3177/review/2135185677 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240624/2bab6dc0/attachment-0001.html>


More information about the Rpm-maint mailing list