[Rpm-maint] [rpm-software-management/rpm] Add "local_generator" (PR #2734)

Panu Matilainen notifications at github.com
Tue Feb 6 12:03:00 UTC 2024


@pmatilai commented on this pull request.



> -	    bn[strlen(bn)-strlen(".attr")] = '\0';
-	    fc->atypes[i] = rpmfcAttrNew(bn);
+	nfiles = argvCount(files);
+    }
+    char * local_attr_names = rpmExpand("%{?__local_file_attrs}", NULL);
+    ARGV_t local_attrs = argvSplitString(local_attr_names, ":", ARGV_SKIPEMPTY);
+    nlocals = argvCount(local_attrs);
+    fc->atypes = xcalloc(nfiles + nlocals + 1, sizeof(*fc->atypes));
+
+    for (int i = 0; i < nfiles; i++) {
+	char *bn = basename(files[i]);
+	bn[strlen(bn)-strlen(".attr")] = '\0';
+	// skip file attrs found in __local_file_attrs for now
+	for (j=0; (j < nlocals) && strcmp(bn, local_attrs[j]); j++);
+	if (j < nlocals) {
+	    free(bn);

Might be more readable to just toss all basenames into a new argv with argvAddUniq() , which frees us from having to care about these details here.

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

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


More information about the Rpm-maint mailing list