FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 05-18-2010, 08:16 AM
Martin Sivak
 
Default Use "kernel-modules = version" style for locating rpms providing driver updates

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 over two arrays at once..

Related: rhbz#508242
---
docs/driverdisc.txt | 2 +-
loader/driverdisk.c | 19 +++++++++++--------
loader/rpmextract.c | 46 ++++++++++++++++++++++++++++++++++------------
loader/rpmextract.h | 2 +-
4 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/docs/driverdisc.txt b/docs/driverdisc.txt
index 5075989..779e71e 100644
--- a/docs/driverdisc.txt
+++ b/docs/driverdisc.txt
@@ -76,7 +76,7 @@ any anaconda's supported filesystem (vfat, squashfs, ext2 and ext3).
| /... - any other architecture the DD provides drivers for

There is a special requirement for the RPMs used to update drivers. Anaconda
-picks up only RPMs which provide kernel-modules-<running kernel version>.
+picks up only RPMs which provide "kernel-modules = <running kernel version>".

Initrd overlay driverdisc image
-------------------------------
diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index 8fa950a..b7e2d82 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -65,16 +65,19 @@ extern uint64_t flags;

/*
* check if the RPM in question provides
- * Provides: userptr
- * we use it to check kernel-modules-<kernelversion>
+ * Provides: <dep> = <version>
+ * we use it to check if 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
", dep);
+ logMessage(DEBUGLVL, "Provides: %s = %s", dep, version);

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

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

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

/* we want firmware files */
if (!strncmp("lib/firmware/", name, 13)) return 0;
@@ -164,9 +167,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
", 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,
--
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-18-2010, 08:46 AM
Ales Kozumplik
 
Default Use "kernel-modules = version" style for locating rpms providing driver updates

On 05/18/2010 10:16 AM, 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 over two arrays at once..

Related: rhbz#508242
---



Ack.

Ales

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

Thread Tools




All times are GMT. The time now is 04:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org