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

Panu Matilainen notifications at github.com
Thu Aug 22 10:11:45 UTC 2024


@pmatilai commented on this pull request.



> +        if what == rpm.RPMCALLBACK_INST_OPEN_FILE:
+            nvr, path = mydata
+            fd = os.open(path, os.O_RDONLY)
+            self.fdnos[nvr] = fd
+            return fd
+
+        elif what == rpm.RPMCALLBACK_INST_CLOSE_FILE:
+            nvr, path = mydata
+            os.close(self.fdnos[nvr])
+
+
+ts = rpm.TransactionSet()
+for path in sys.argv[1:]:
+    with open(path, "r") as fp:
+        hdr = ts.hdrFromFdno(fp.fileno())
+        ts.addInstall(hdr, (hdr.nvr, path), "i")

You'll want to use "u" in there (making this the equivalent of 'rpm -U' instead). -i is rather special case operation that is best left to people who know to look for it. Sorry for missing this earlier.

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

Message ID: <rpm-software-management/rpm/pull/3177/review/2254093091 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240822/4af8bb78/attachment.html>


More information about the Rpm-maint mailing list