module-init-tools: 3.4 -> 3.16

svn path=/nixpkgs/branches/stdenv-updates/; revision=28621
This commit is contained in:
David Guibert 2011-08-16 18:20:59 +00:00
parent e861fb2bcd
commit 05a530fd10
3 changed files with 167 additions and 157 deletions

View File

@ -26,6 +26,7 @@ ensureDir $out/lib/modules/"$version"
for module in $closure; do for module in $closure; do
target=$(echo $module | sed "s^/nix/store/.*/lib/modules/^$out/lib/modules/^") target=$(echo $module | sed "s^/nix/store/.*/lib/modules/^$out/lib/modules/^")
if test -e "$target"; then continue; fi if test -e "$target"; then continue; fi
if test \! -e "$module"; then continue; fi # XXX: to avoid error with "cp builtin builtin"
mkdir -p $(dirname $target) mkdir -p $(dirname $target)
echo $module echo $module
cp $module $target cp $module $target

View File

@ -1,24 +1,24 @@
{stdenv, fetchurl}: {stdenv, fetchurl}:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "module-init-tools-3.4"; name = "module-init-tools-3.16";
src = [ src = [
(fetchurl { (fetchurl {
url = mirror://kernel/linux/utils/kernel/module-init-tools/module-init-tools-3.4.tar.bz2; url = mirror://kernel/linux/utils/kernel/module-init-tools/module-init-tools-3.16.tar.bz2;
sha256 = "11rxcdr915skc1m6dcavavw8dhcsy24wpi56sw1m4akj2frs3iwn"; sha256 = "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1";
}) })
# Upstream forgot to include the generated manpages. Thankfully # Upstream forgot to include the generated manpages. Thankfully
# the Gentoo people fixed this for us :-) # the Gentoo people fixed this for us :-)
(fetchurl { (fetchurl {
url = mirror://gentoo/distfiles/module-init-tools-3.4-manpages.tar.bz2; url = mirror://gentoo/distfiles/module-init-tools-3.16-man.tar.bz2;
sha256 = "0jid24girjhr30mrdckylkcz11v4in46nshhrqv18yaxm6506v6j"; sha256 = "1j1nzi87kgsh4scl645fhwhjvljxj83cmdasa4n4p5krhasgw358";
}) })
]; ];
patches = [./module-dir.patch]; patches = [./module-dir.patch];
postInstall = "rm $out/sbin/insmod.static"; # don't need it postInstall = "rm $out/sbin/insmod.static"; # don't need it
# We don't want bash (and therefore glibc) in the closure of the # We don't want bash (and therefore glibc) in the closure of the

View File

@ -1,152 +1,161 @@
diff -rc module-init-tools-3.4-orig/depmod.c module-init-tools-3.4/depmod.c commit cf2c95edb7918bc658f6cae93793c1949fc9cb6e
*** module-init-tools-3.4-orig/depmod.c 2007-10-07 23:51:46.000000000 +0200 Author: David Guibert <david.guibert@gmail.com>
--- module-init-tools-3.4/depmod.c 2008-08-11 12:03:14.000000000 +0200 Date: Fri Aug 5 14:20:12 2011 +0200
***************
*** 1066,1071 **** introduce module-dir
--- 1066,1072 ----
*system_map = NULL; diff --git a/depmod.c b/depmod.c
struct module *list = NULL; index a1d2f8c..9362a35 100644
int i; --- a/depmod.c
+ char *module_dir; +++ b/depmod.c
const char *config = NULL; @@ -48,9 +48,6 @@
struct module_search *search = NULL;
struct module_overrides *overrides = NULL; #include "testing.h"
***************
*** 1148,1157 **** -#ifndef MODULE_DIR
if (optind == argc) -#define MODULE_DIR "/lib/modules/"
all = 1; -#endif
dirname = NOFAIL(malloc(strlen(basedir) #ifndef MODULE_BUILTIN_KEY
! + strlen(MODULE_DIR) #define MODULE_BUILTIN_KEY "built-in"
+ strlen(version) + 1)); @@ -1516,6 +1513,7 @@ static int parse_config_file(const char *filename,
! sprintf(dirname, "%s%s%s", basedir, MODULE_DIR, version); char *line;
unsigned int linenum = 0;
if (maybe_all) { FILE *cfile;
if (!doing_stdout && !depfile_out_of_date(dirname))
--- 1149,1162 ----
if (optind == argc)
all = 1;
+ if((module_dir = getenv("MODULE_DIR")) == NULL) {
+ module_dir = "/lib/modules/";
+ }
+
dirname = NOFAIL(malloc(strlen(basedir)
! + strlen(module_dir)
+ strlen(version) + 1));
! sprintf(dirname, "%s%s%s", basedir, module_dir, version);
if (maybe_all) {
if (!doing_stdout && !depfile_out_of_date(dirname))
Only in module-init-tools-3.4/: depmod.c~
Only in module-init-tools-3.4/: depmod.c.rej
diff -rc module-init-tools-3.4-orig/modinfo.c module-init-tools-3.4/modinfo.c
*** module-init-tools-3.4-orig/modinfo.c 2007-10-07 23:51:46.000000000 +0200
--- module-init-tools-3.4/modinfo.c 2008-08-11 12:07:55.000000000 +0200
***************
*** 18,27 ****
#define streq(a,b) (strcmp((a),(b)) == 0)
#define strstarts(a,start) (strncmp((a),(start), strlen(start)) == 0)
- #ifndef MODULE_DIR
- #define MODULE_DIR "/lib/modules"
- #endif
-
static int elf_endian;
static int my_endian;
--- 18,23 ----
***************
*** 278,283 ****
--- 274,280 ----
char *data;
struct utsname buf;
char *depname, *p;
+ char *module_dir; + char *module_dir;
data = grab_file(name, size); cfile = fopen(filename, "r");
if (data) { if (!cfile) {
*************** @@ -1525,6 +1523,10 @@ static int parse_config_file(const char *filename,
*** 290,301 **** return 0;
return NULL; }
}
+ if((module_dir = getenv("MODULE_DIR")) == NULL) {
/* Search for it in modules.dep. */ + module_dir = "/lib/modules/";
if (kernel) { + }
! asprintf(&depname, "%s/%s/modules.dep", MODULE_DIR, kernel); +
} else { while ((line = getline_wrapped(cfile, &linenum)) != NULL) {
uname(&buf); char *ptr = line;
! asprintf(&depname, "%s/%s/modules.dep", MODULE_DIR, char *cmd, *modname;
buf.release); @@ -1550,7 +1552,7 @@ static int parse_config_file(const char *filename,
} continue;
data = grab_file(depname, size); }
--- 287,302 ---- nofail_asprintf(&dirname, "%s%s%s/%s", basedir,
return NULL; - MODULE_DIR, kernelversion, search_path);
} + module_dir, kernelversion, search_path);
len = strlen(dirname);
+ if((module_dir = getenv("MODULE_DIR")) == NULL) { *search = add_search(dirname, len, *search);
+ module_dir = "/lib/modules"; free(dirname);
+ } @@ -1565,7 +1567,7 @@ static int parse_config_file(const char *filename,
+ continue;
/* Search for it in modules.dep. */
if (kernel) { nofail_asprintf(&pathname, "%s%s%s/%s/%s.ko", basedir,
! asprintf(&depname, "%s/%s/modules.dep", module_dir, kernel); - MODULE_DIR, kernelversion, subdir, modname);
} else { + module_dir, kernelversion, subdir, modname);
uname(&buf);
! asprintf(&depname, "%s/%s/modules.dep", module_dir, *overrides = add_override(pathname, *overrides);
buf.release); free(pathname);
} @@ -1737,6 +1739,7 @@ int main(int argc, char *argv[])
data = grab_file(depname, size); char *basedir = "", *dirname, *version;
Only in module-init-tools-3.4/: modinfo.c~ char *system_map = NULL, *module_symvers = NULL;
Only in module-init-tools-3.4/: modinfo.c.rej int i;
diff -rc module-init-tools-3.4-orig/modprobe.c module-init-tools-3.4/modprobe.c + char *module_dir;
*** module-init-tools-3.4-orig/modprobe.c 2007-10-07 23:57:23.000000000 +0200 const char *config = NULL;
--- module-init-tools-3.4/modprobe.c 2008-08-11 12:06:54.000000000 +0200
*************** if (native_endianness() == 0)
*** 55,64 **** @@ -1832,7 +1835,11 @@ int main(int argc, char *argv[])
char filename[0]; if (optind == argc)
}; all = 1;
- #ifndef MODULE_DIR - nofail_asprintf(&dirname, "%s%s%s", basedir, MODULE_DIR, version);
- #define MODULE_DIR "/lib/modules" + if((module_dir = getenv("MODULE_DIR")) == NULL) {
- #endif + module_dir = "/lib/modules/";
- + }
typedef void (*errfn_t)(const char *fmt, ...); +
+ nofail_asprintf(&dirname, "%s%s%s", basedir, module_dir, version);
/* Do we use syslog or stderr for messages? */
--- 55,60 ---- if (maybe_all) {
*************** if (!doing_stdout && !depfile_out_of_date(dirname))
*** 1433,1438 **** @@ -1850,7 +1857,7 @@ int main(int argc, char *argv[])
--- 1429,1435 ---- size_t len;
char *newname = NULL;
char *aliasfilename, *symfilename; nofail_asprintf(&dirname, "%s%s%s/updates", basedir,
errfn_t error = fatal; - MODULE_DIR, version);
+ char *module_dir = NULL; + module_dir, version);
int flags = O_NONBLOCK|O_EXCL; len = strlen(dirname);
search = add_search(dirname, len, search);
/* Prepend options from environment. */ }
*************** diff --git a/modinfo.c b/modinfo.c
*** 1559,1566 **** index 1dd8469..67b1041 100644
if (argc < optind + 1 && !dump_only && !list_only && !remove) --- a/modinfo.c
print_usage(argv[0]); +++ b/modinfo.c
@@ -19,9 +19,6 @@
! dirname = NOFAIL(malloc(strlen(buf.release) + sizeof(MODULE_DIR) + 1)); #include "zlibsupport.h"
! sprintf(dirname, "%s/%s", MODULE_DIR, buf.release); #include "testing.h"
aliasfilename = NOFAIL(malloc(strlen(dirname)
+ sizeof("/modules.alias"))); -#ifndef MODULE_DIR
sprintf(aliasfilename, "%s/modules.alias", dirname); -#define MODULE_DIR "/lib/modules"
--- 1556,1567 ---- -#endif
if (argc < optind + 1 && !dump_only && !list_only && !remove)
print_usage(argv[0]); struct param
{
! if((module_dir = getenv("MODULE_DIR")) == NULL) { @@ -193,6 +190,11 @@ static struct elf_file *grab_module(const char *name,
! module_dir = "/lib/modules"; struct utsname buf;
! } char *depname, *p, *moddir;
! struct elf_file *module;
! dirname = NOFAIL(malloc(strlen(buf.release) + strlen(module_dir) + 2)); + char *module_dir;
! sprintf(dirname, "%s/%s", module_dir, buf.release); +
aliasfilename = NOFAIL(malloc(strlen(dirname) + if((module_dir = getenv("MODULE_DIR")) == NULL) {
+ sizeof("/modules.alias"))); + module_dir = "/lib/modules/";
sprintf(aliasfilename, "%s/modules.alias", dirname); + }
Only in module-init-tools-3.4/: modprobe.c~
Only in module-init-tools-3.4/: modprobe.c.rej if (strchr(name, '.') || strchr(name, '/')) {
module = grab_elf_file(name);
@@ -207,9 +209,9 @@ static struct elf_file *grab_module(const char *name,
kernel = buf.release;
}
if (strlen(basedir))
- nofail_asprintf(&moddir, "%s/%s/%s", basedir, MODULE_DIR, kernel);
+ nofail_asprintf(&moddir, "%s/%s/%s", basedir, module_dir, kernel);
else
- nofail_asprintf(&moddir, "%s/%s", MODULE_DIR, kernel);
+ nofail_asprintf(&moddir, "%s/%s", module_dir, kernel);
/* Search for it in modules.dep. */
nofail_asprintf(&depname, "%s/%s", moddir, "modules.dep");
diff --git a/modprobe.c b/modprobe.c
index 5464f45..d9fbf9d 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -86,10 +86,6 @@ typedef enum
} modprobe_flags_t;
-#ifndef MODULE_DIR
-#define MODULE_DIR "/lib/modules"
-#endif
-
/**
* print_usage - output the prefered program usage
*
@@ -2136,6 +2132,7 @@ int main(int argc, char *argv[])
struct modprobe_conf conf = {};
recursion_depth = 0;
+ char *module_dir = NULL;
/* Prepend options from environment. */
argv = merge_args(getenv("MODPROBE_OPTIONS"), argv, &argc);
@@ -2233,7 +2230,11 @@ int main(int argc, char *argv[])
if (argc < optind + 1 && !dump_config && !list_only)
print_usage(argv[0]);
- nofail_asprintf(&dirname, "%s%s/%s", basedir, MODULE_DIR, buf.release);
+ if((module_dir = getenv("MODULE_DIR")) == NULL) {
+ module_dir = "/lib/modules";
+ }
+
+ nofail_asprintf(&dirname, "%s%s/%s", basedir, module_dir, buf.release);
/* Old-style -t xxx wildcard? Only with -l. */
if (list_only) {