Re: [PATCH] Use "kernel-modules = version" style for locating rpms providing driver updates (#508242)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/17/2010 04:25 PM, Martin Sivak wrote:
We used to have kernel-modules-<version>  = anything, but we want to change it to make writing spec files more developer friendly. RPM exports the versions under different tag, so we basicly iterate two loops at once..
---


Hi,

commit msg should have "Related: ...".


  Initrd overlay driverdisc image
  -------------------------------
diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index 8fa950a..71ec279 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -68,13 +68,13 @@ extern uint64_t flags;
   * Provides: userptr
   * we use it to check kernel-modules-<kernelversion>
   */
-int dlabelProvides(const char* dep, void *userptr)
+int dlabelProvides(const char* dep, const char* version, void *userptr)
  {
      char *kernelver = (char*)userptr;

-    logMessage(DEBUGLVL, "Provides: %s\n", dep);
+    logMessage(DEBUGLVL, "Provides: %s = %s", dep, version);

-    return strcmp(dep, kernelver);
+    return version!=NULL || strcmp(dep, "kernel-modules") || strcmp(version, kernelver);

This is probably not what you intended.


  /*
@@ -85,7 +85,7 @@ int dlabelFilter(const char* name, const struct stat *fstat, void *userptr)
  {
      int l = strlen(name);

-    logMessage(DEBUGLVL, "Unpacking %s\n", name);
+    logMessage(DEBUGLVL, "Unpacking %s", name);

neat logs, nice.


      /* we want firmware files */
      if (!strncmp("lib/firmware/", name, 13)) return 0;
@@ -164,9 +164,9 @@ int dlabelUnpackRPMDir(char* rpmdir, char* destination)

      /* get running kernel version */
      rc = uname(&unamedata);
-    checked_asprintf(&kernelver, "kernel-modules-%s",
+    checked_asprintf(&kernelver, "%s",
              rc ? "unknown" : unamedata.release);
-    logMessage(DEBUGLVL, "Kernel version: %s\n", kernelver);
+    logMessage(DEBUGLVL, "Kernel version: %s", kernelver);

      checked_asprintf(&globpattern, "%s/*.rpm", rpmdir);
      glob_t globres;
diff --git a/loader/rpmextract.c b/loader/rpmextract.c
index 2ce0e6b..0d99a38 100644
--- a/loader/rpmextract.c
+++ b/loader/rpmextract.c
@@ -152,45 +152,67 @@ int explodeRPM(const char *source,

      /* Retrieve all dependencies and run them through deps function */
      while (deps) {
-        struct rpmtd_s td;
+        struct rpmtd_s tddep;
+        struct rpmtd_s tdver;
          const char *depname;
+        const char *depversion;

-        if (!headerGet(h, RPMTAG_REQUIRENAME,&td, HEADERGET_MINMEM))
+        if (!headerGet(h, RPMTAG_PROVIDES,&tddep, HEADERGET_MINMEM))
              break;

+        if (!headerGet(h, RPMTAG_PROVIDEVERSION,&tdver, HEADERGET_MINMEM)){
+            rpmtdFreeData(&tddep);
+            break;
+        }
+
          /* iterator */
-        while ((depname = rpmtdNextString(&td))) {
-            if (deps(depname, userptr)) {
+        while ((depname = rpmtdNextString(&tddep))) {
+            depversion = rpmtdNextString(&tdver);
+            if (deps(depname, depversion, userptr)) {
+                rpmtdFreeData(&tddep);
+                rpmtdFreeData(&tdver);
                  Fclose(fdi);
                  return EXIT_BADDEPS;
              }
          }
-        rpmtdFreeData(&td);
+
+        rpmtdFreeData(&tddep);
+        rpmtdFreeData(&tdver);
+
          break;
      }

      /* Retrieve all provides and run them through provides function */
      while (provides) {
-        struct rpmtd_s td;
+        struct rpmtd_s tddep;
+        struct rpmtd_s tdver;
          const char *depname;
+        const char *depversion;
          int found = 0;

-        if (!headerGet(h, RPMTAG_PROVIDES,&td, HEADERGET_MINMEM))
+        if (!headerGet(h, RPMTAG_PROVIDES,&tddep, HEADERGET_MINMEM))
              break;

+        if (!headerGet(h, RPMTAG_PROVIDEVERSION,&tdver, HEADERGET_MINMEM)){
+            rpmtdFreeData(&tddep);
+            break;
+        }
+
          /* iterator */
-        while ((depname = rpmtdNextString(&td))) {
-            if (!provides(depname, userptr)) {
+        while ((depname = rpmtdNextString(&tddep))) {
+            depversion = rpmtdNextString(&tdver);
+            if (!provides(depname, depversion, userptr)) {
                  found++;
              }
          }
-        rpmtdFreeData(&td);

-        if (found<=0) {
+        rpmtdFreeData(&tddep);
+        rpmtdFreeData(&tdver);
+
+        if (found<=0){
              Fclose(fdi);
              return EXIT_BADDEPS;
          }
-
          break;
      }

diff --git a/loader/rpmextract.h b/loader/rpmextract.h
index 53a90cf..20a5cc8 100644
--- a/loader/rpmextract.h
+++ b/loader/rpmextract.h
@@ -32,7 +32,7 @@

  /* both filter functions return 0 - match, 1 - match not found */
  typedef int (*filterfunc)(const char* name, const struct stat *fstat, void *userptr);
-typedef int (*dependencyfunc)(const char* depends, void *userptr);
+typedef int (*dependencyfunc)(const char* depname, const char* depversion, void *userptr);

  int explodeRPM(const char* file,
                 filterfunc filter,

The rest looks good.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux