diff options
29 files changed, 3386 insertions, 70 deletions
diff --git a/conf/checksums.ini b/conf/checksums.ini index 12f0c99f4c..a69b6b03b6 100644 --- a/conf/checksums.ini +++ b/conf/checksums.ini @@ -854,6 +854,10 @@ sha256=f2f80e2a62a039e9a1ffa0fdf58707b2d12b3ff33c56472b46bb6d53f45e083e md5=e81c2f0953aa60f8062c05a4673f2be0 sha256=cf153f10ba6312a8303ceb01bed834a2786d28aa89c7d73dba64714f691628f6 +[http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2] +md5=245db9f1e0f09ab7e0faaa0cf7301011 +sha256=a1cdc4a8f6c1f947ea3b87d097af2db4371019bac941d92c3844124c5694328b + [http://jerakeen.org/files/PythonDaap-0.4.tar.gz] md5=f7672bfd563787a76fb7e9a43c062f18 sha256=5318946df77937e0b601c95a198790f9ba52d4afb4eb153480289350182bb739 @@ -11470,6 +11474,10 @@ sha256=25d45acf19e3acd09745df47581ac7a13e3694ee51fe4e642108f9f228cacca9 md5=a1d0aca33da380d6045c5c0e5002c09d sha256=9e4ab143828fefb3b67ce2bc3ad63a91cacc45d97161822915778683fb80343b +[http://ipython.scipy.org/dist/ipython-0.10.tar.gz] +md5=dd10cd1b622c16c1afca2239fcc0dfdf +sha256=60d602637dc5f078b083a4ca5ab64364ba816bd72439844012ed11a30f88228c + [http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz] md5=8a1bd1a9be272f4ddf4de99e5c1ad0dc sha256=5540bc1a01f11ca66c3d7c31a43af670fd0f0044b8e38d142614872956548006 @@ -11974,6 +11982,10 @@ sha256=6a2efdfc757c518a8185f457799506086084b59498f53db37cfb6728008127e0 md5=481dfdef7273f2cc776c2637f481f017 sha256=27000ba4bc73a5977502b27d7036df24dd6ab94a1c33b8f5d6d54ba62772f0c7 +[http://kernel.org/pub/linux/libs/klibc/Testing/klibc-1.5.15.tar.bz2] +md5=db2152a8a03bd81e21a5f451f537ae3d +sha256=8b5334ef88b075f374b031695181b4302c3e5621bf2737a39fdf28262b0f80f4 + [http://downloads.sourceforge.net/klimt/klimt-src-0.6.1.zip] md5=d12f56384b4ccde11cd756db2b14065c sha256=48ae508d72e453e2a1f5748870362259786b475548c545feaec1aea71d2f8fdb diff --git a/recipes/ipython/ipython_0.10.bb b/recipes/ipython/ipython_0.10.bb new file mode 100644 index 0000000000..7ab8d724e3 --- /dev/null +++ b/recipes/ipython/ipython_0.10.bb @@ -0,0 +1,15 @@ +DESCRIPTION = "Enhanced Python Shell" +HOMEPAGE = "http://ipython.scipy.org/moin/" +SECTION = "devel/python" +LICENSE = "BSD" +DEPENDS = "less" +RDEPENDS = "python-pprint python-io python-shell python-misc python-lang \ + python-stringold python-codecs python-crypt python-threading \ + python-pydoc python-debugger python-textutils python-pickle \ + python-subprocess" + +SRC_URI = "http://ipython.scipy.org/dist/ipython-${PV}.tar.gz" + +inherit distutils + +FILES_${PN} = "/" diff --git a/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch b/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch index b52b3e309b..6eb604e45c 100644 --- a/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch +++ b/recipes/klibc/files/fstype-sane-vfat-and-jffs2-for-1.5.patch @@ -3,17 +3,17 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c --- klibc-1.5.orig/usr/kinit/fstype/fstype.c 2008-02-28 00:48:35.319254938 +0100 +++ klibc-1.5/usr/kinit/fstype/fstype.c 2008-02-28 00:52:20.583257793 +0100 @@ -20,7 +20,7 @@ - #include <endian.h> #include <netinet/in.h> + #include <sys/utsname.h> #include <sys/vfs.h> - +#include <linux/types.h> #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ #include "romfs_fs.h" -@@ -33,6 +33,12 @@ - #include "lvm2_sb.h" - #include "iso9660_sb.h" +@@ -37,6 +37,12 @@ + #include "ocfs2_fs.h" + #include "nilfs_fs.h" +#if __BYTE_ORDER == __BIG_ENDIAN +#include <linux/byteorder/big_endian.h> @@ -24,7 +24,7 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c /* * Slightly cleaned up version of jfs_superblock to * avoid pulling in other kernel header files. -@@ -54,6 +60,27 @@ +@@ -59,6 +65,27 @@ /* Swap needs the definition of block size */ #include "swap_fs.h" @@ -50,14 +50,14 @@ Index: klibc-1.5/usr/kinit/fstype/fstype.c +} + static int gzip_image(const void *buf, unsigned long long *bytes) - { + {277 304 const unsigned char *p = buf; -@@ -277,6 +304,8 @@ +@@ -490,6 +517,8 @@ {1, "ext3", ext3_image}, {1, "ext2", ext2_image}, {1, "minix", minix_image}, + {0, "jffs2", jffs2_image}, + {0, "vfat", vfat_image}, + {1, "nilfs2", nilfs2_image}, + {2, "ocfs2", ocfs2_image}, {8, "reiserfs", reiserfs_image}, - {64, "reiserfs", reiserfs_image}, - {32, "jfs", jfs_image}, diff --git a/recipes/klibc/files/modprobe.patch b/recipes/klibc/files/modprobe.patch index 074b0b6311..61ee340ff9 100644 --- a/recipes/klibc/files/modprobe.patch +++ b/recipes/klibc/files/modprobe.patch @@ -7,16 +7,16 @@ Index: klibc-1.5/usr/utils/Kbuild progs := chroot dd mkdir mkfifo mknod mount pivot_root umount -progs += true false sleep ln nuke minips cat --progs += insmod uname halt kill readlink cpio +-progs += uname halt kill readlink cpio sync dmesg +progs += true false sleep ln nuke minips cat losetup -+progs += insmod uname halt kill readlink cpio modprobe ++progs += uname halt kill readlink cpio sync dmesg modprobe static-y := $(addprefix static/, $(progs)) shared-y := $(addprefix shared/, $(progs)) -@@ -52,7 +52,10 @@ - shared/readlink-y := readlink.o - static/cpio-y := cpio.o +@@ -54,7 +54,10 @@ shared/cpio-y := cpio.o + static/sync-y := sync.o + shared/sync-y := sync.o - +static/modprobe-y := modprobe.o +shared/modprobe-y := modprobe.o diff --git a/recipes/klibc/files/staging.patch b/recipes/klibc/files/staging.patch index 215daad456..390c214f94 100644 --- a/recipes/klibc/files/staging.patch +++ b/recipes/klibc/files/staging.patch @@ -26,13 +26,13 @@ Index: klibc-1.5/scripts/Kbuild.install $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib - $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin - $(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ + $(Q)set -e ; for d in linux asm asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \ $(KLIBCKERNELOBJ)/include2 ; do \ - [ ! -d $$r/$$d ] || \ -- cp -rfL $$r/$$d/. \ -+ cp -rfd $$r/$$d/. \ + [ ! -d $$r/$$d ] && continue; \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ +- cp -rfL $$r/$$d/. \ ++ cp -rfd $$r/$$d/. \ $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ done ; \ done @@ -116,7 +116,7 @@ Index: klibc-1.5/usr/kinit/run-init/Kbuild =================================================================== --- klibc-1.5.orig/usr/kinit/run-init/Kbuild 2007-03-04 02:52:10.000000000 +0100 +++ klibc-1.5/usr/kinit/run-init/Kbuild 2008-02-24 15:13:50.221824559 +0100 -@@ -21,5 +21,3 @@ +@@ -25,5 +25,3 @@ # Cleaning clean-dirs := static shared @@ -136,7 +136,7 @@ Index: klibc-1.5/usr/utils/Kbuild =================================================================== --- klibc-1.5.orig/usr/utils/Kbuild 2007-03-04 02:52:10.000000000 +0100 +++ klibc-1.5/usr/utils/Kbuild 2008-02-24 15:13:50.229824358 +0100 -@@ -64,5 +64,3 @@ +@@ -66,5 +66,3 @@ # Clean deletes the static and shared dir clean-dirs := static shared diff --git a/recipes/klibc/files/wc.patch b/recipes/klibc/files/wc.patch index 296a4f9d92..f54c49d3ab 100644 --- a/recipes/klibc/files/wc.patch +++ b/recipes/klibc/files/wc.patch @@ -8,7 +8,7 @@ Index: klibc-1.5/usr/utils/Kbuild progs := chroot dd mkdir mkfifo mknod mount pivot_root umount -progs += true false sleep ln nuke minips cat losetup +progs += true false sleep ln nuke minips cat losetup wc - progs += insmod uname halt kill readlink cpio modprobe + progs += uname halt kill readlink cpio sync dmesg modprobe static-y := $(addprefix static/, $(progs)) @@ -56,6 +56,9 @@ diff --git a/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch b/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch new file mode 100644 index 0000000000..2ba6d98172 --- /dev/null +++ b/recipes/klibc/klibc-1.5/fstype-sane-vfat-and-jffs2-for-1.5.patch @@ -0,0 +1,63 @@ +Index: klibc-1.5/usr/kinit/fstype/fstype.c +=================================================================== +--- klibc-1.5.orig/usr/kinit/fstype/fstype.c 2008-02-28 00:48:35.319254938 +0100 ++++ klibc-1.5/usr/kinit/fstype/fstype.c 2008-02-28 00:52:20.583257793 +0100 +@@ -20,7 +20,7 @@ + #include <endian.h> + #include <netinet/in.h> + #include <sys/vfs.h> +- ++#include <linux/types.h> + #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ + + #include "romfs_fs.h" +@@ -33,6 +33,12 @@ + #include "lvm2_sb.h" + #include "iso9660_sb.h" + ++#if __BYTE_ORDER == __BIG_ENDIAN ++#include <linux/byteorder/big_endian.h> ++#else ++#include <linux/byteorder/little_endian.h> ++#endif ++ + /* + * Slightly cleaned up version of jfs_superblock to + * avoid pulling in other kernel header files. +@@ -54,6 +60,27 @@ + /* Swap needs the definition of block size */ + #include "swap_fs.h" + ++static int jffs2_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ // Very sloppy! ;-E ++ if (*buf == 0x85 && buf[1] == 0x19) ++ return 1; ++ ++ return 0; ++} ++ ++static int vfat_image(const unsigned char *buf, unsigned long *blocks) ++{ ++ const struct romfs_super_block *sb = ++ (const struct romfs_super_block *)buf; ++ if (!strncmp(buf + 54, "FAT12 ", 8) ++ || !strncmp(buf + 54, "FAT16 ", 8) ++ || !strncmp(buf + 82, "FAT32 ", 8)) ++ return 1; ++ ++ return 0; ++} ++ + static int gzip_image(const void *buf, unsigned long long *bytes) + { + const unsigned char *p = buf; +@@ -277,6 +304,8 @@ + {1, "ext3", ext3_image}, + {1, "ext2", ext2_image}, + {1, "minix", minix_image}, ++ {0, "jffs2", jffs2_image}, ++ {0, "vfat", vfat_image}, + {8, "reiserfs", reiserfs_image}, + {64, "reiserfs", reiserfs_image}, + {32, "jfs", jfs_image}, diff --git a/recipes/klibc/klibc-1.5/modprobe.patch b/recipes/klibc/klibc-1.5/modprobe.patch new file mode 100644 index 0000000000..dceaf6103f --- /dev/null +++ b/recipes/klibc/klibc-1.5/modprobe.patch @@ -0,0 +1,1985 @@ +Index: klibc-1.5/usr/utils/Kbuild +=================================================================== +--- klibc-1.5.orig/usr/utils/Kbuild 2008-03-07 22:01:45.223695348 +0100 ++++ klibc-1.5/usr/utils/Kbuild 2008-03-07 22:48:44.660783243 +0100 +@@ -3,8 +3,8 @@ + # + + progs := chroot dd mkdir mkfifo mknod mount pivot_root umount +-progs += true false sleep ln nuke minips cat +-progs += insmod uname halt kill readlink cpio ++progs += true false sleep ln nuke minips cat losetup ++progs += insmod uname halt kill readlink cpio modprobe + + static-y := $(addprefix static/, $(progs)) + shared-y := $(addprefix shared/, $(progs)) +@@ -52,7 +52,10 @@ + shared/readlink-y := readlink.o + static/cpio-y := cpio.o + shared/cpio-y := cpio.o +- ++static/modprobe-y := modprobe.o ++shared/modprobe-y := modprobe.o ++static/losetup-y := losetup.o ++shared/losetup-y := losetup.o + # Additionally linked targets + always := static/reboot static/poweroff shared/reboot shared/poweroff + +Index: klibc-1.5/usr/utils/list.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ klibc-1.5/usr/utils/list.h 2008-03-07 22:33:22.287688586 +0100 +@@ -0,0 +1,238 @@ ++/* Stolen from Linux Kernel Source's list.h -- GPL. */ ++#ifndef _MODINITTOOLS_LIST_H ++#define _MODINITTOOLS_LIST_H ++ ++#undef offsetof ++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++ ++/** ++ * container_of - cast a member of a structure out to the containing structure ++ * ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ * ++ */ ++#define container_of(ptr, type, member) ({ \ ++ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++ ++/* ++ * Simple doubly linked list implementation. ++ * ++ * Some of the internal functions ("__xxx") are useful when ++ * manipulating whole lists rather than single entries, as ++ * sometimes we already know the next/prev entries and we can ++ * generate better code by using them directly rather than ++ * using the generic single-entry routines. ++ */ ++ ++struct list_head { ++ struct list_head *next, *prev; ++}; ++ ++#define LIST_HEAD_INIT(name) { &(name), &(name) } ++ ++#define LIST_HEAD(name) \ ++ struct list_head name = LIST_HEAD_INIT(name) ++ ++#define INIT_LIST_HEAD(ptr) do { \ ++ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ ++} while (0) ++ ++/* ++ * Insert a new entry between two known consecutive entries. ++ * ++ * This is only for internal list manipulation where we know ++ * the prev/next entries already! ++ */ ++static inline void __list_add(struct list_head *new, ++ struct list_head *prev, ++ struct list_head *next) ++{ ++ next->prev = new; ++ new->next = next; ++ new->prev = prev; ++ prev->next = new; ++} ++ ++/** ++ * list_add - add a new entry ++ * @new: new entry to be added ++ * @head: list head to add it after ++ * ++ * Insert a new entry after the specified head. ++ * This is good for implementing stacks. ++ */ ++static inline void list_add(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head, head->next); ++} ++ ++/** ++ * list_add_tail - add a new entry ++ * @new: new entry to be added ++ * @head: list head to add it before ++ * ++ * Insert a new entry before the specified head. ++ * This is useful for implementing queues. ++ */ ++static inline void list_add_tail(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head->prev, head); ++} ++ ++/* ++ * Delete a list entry by making the prev/next entries ++ * point to each other. ++ * ++ * This is only for internal list manipulation where we know ++ * the prev/next entries already! ++ */ ++static inline void __list_del(struct list_head * prev, struct list_head * next) ++{ ++ next->prev = prev; ++ prev->next = next; ++} ++ ++/** ++ * list_del - deletes entry from list. ++ * @entry: the element to delete from the list. ++ * Note: list_empty on entry does not return true after this, the entry is ++ * in an undefined state. ++ */ ++static inline void list_del(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++} ++ ++/** ++ * list_del_init - deletes entry from list and reinitialize it. ++ * @entry: the element to delete from the list. ++ */ ++static inline void list_del_init(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ INIT_LIST_HEAD(entry); ++} ++ ++/** ++ * list_move - delete from one list and add as another's head ++ * @list: the entry to move ++ * @head: the head that will precede our entry ++ */ ++static inline void list_move(struct list_head *list, struct list_head *head) ++{ ++ __list_del(list->prev, list->next); ++ list_add(list, head); ++} ++ ++/** ++ * list_move_tail - delete from one list and add as another's tail ++ * @list: the entry to move ++ * @head: the head that will follow our entry ++ */ ++static inline void list_move_tail(struct list_head *list, ++ struct list_head *head) ++{ ++ __list_del(list->prev, list->next); ++ list_add_tail(list, head); ++} ++ ++/** ++ * list_empty - tests whether a list is empty ++ * @head: the list to test. ++ */ ++static inline int list_empty(struct list_head *head) ++{ ++ return head->next == head; ++} ++ ++static inline void __list_splice(struct list_head *list, ++ struct list_head *head) ++{ ++ struct list_head *first = list->next; ++ struct list_head *last = list->prev; ++ struct list_head *at = head->next; ++ ++ first->prev = head; ++ head->next = first; ++ ++ last->next = at; ++ at->prev = last; ++} ++ ++/** ++ * list_splice - join two lists ++ * @list: the new list to add. ++ * @head: the place to add it in the first list. ++ */ ++static inline void list_splice(struct list_head *list, struct list_head *head) ++{ ++ if (!list_empty(list)) ++ __list_splice(list, head); ++} ++ ++/** ++ * list_splice_init - join two lists and reinitialise the emptied list. ++ * @list: the new list to add. ++ * @head: the place to add it in the first list. ++ * ++ * The list at @list is reinitialised ++ */ ++static inline void list_splice_init(struct list_head *list, ++ struct list_head *head) ++{ ++ if (!list_empty(list)) { ++ __list_splice(list, head); ++ INIT_LIST_HEAD(list); ++ } ++} ++ ++/** ++ * list_entry - get the struct for this entry ++ * @ptr: the &struct list_head pointer. ++ * @type: the type of the struct this is embedded in. ++ * @member: the name of the list_struct within the struct. ++ */ ++#define list_entry(ptr, type, member) \ ++ container_of(ptr, type, member) ++ ++/** ++ * list_for_each - iterate over a list ++ * @pos: the &struct list_head to use as a loop counter. ++ * @head: the head for your list. ++ */ ++#define list_for_each(pos, head) \ ++ for (pos = (head)->next; pos != (head); pos = pos->next) ++ ++/** ++ * list_for_each_prev - iterate over a list backwards ++ * @pos: the &struct list_head to use as a loop counter. ++ * @head: the head for your list. ++ */ ++#define list_for_each_prev(pos, head) \ ++ for (pos = (head)->prev; pos != (head); pos = pos->prev) ++ ++/** ++ * list_for_each_safe - iterate over a list safe against removal of list entry ++ * @pos: the &struct list_head to use as a loop counter. ++ * @n: another &struct list_head to use as temporary storage ++ * @head: the head for your list. ++ */ ++#define list_for_each_safe(pos, n, head) \ ++ for (pos = (head)->next, n = pos->next; pos != (head); \ ++ pos = n, n = pos->next) ++ ++/** ++ * list_for_each_entry - iterate over list of given type ++ * @pos: the type * to use as a loop counter. ++ * @head: the head for your list. ++ * @member: the name of the list_struct within the struct. ++ */ ++#define list_for_each_entry(pos, head, member) \ ++ for (pos = list_entry((head)->next, typeof(*pos), member); \ ++ &pos->member != (head); \ ++ pos = list_entry(pos->member.next, typeof(*pos), member)) ++ ++#endif +Index: klibc-1.5/usr/utils/modprobe.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ klibc-1.5/usr/utils/modprobe.c 2008-03-08 03:05:51.847688952 +0100 +@@ -0,0 +1,1710 @@ ++/* modprobe.c: insert a module into the kernel, intelligently. ++ Copyright (C) 2001 Rusty Russell. ++ Copyright (C) 2002, 2003 Rusty Russell, IBM Corporation. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++*/ ++#define _GNU_SOURCE /* asprintf */ ++ ++#include <sys/utsname.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <sys/mman.h> ++#include <fcntl.h> ++#include <stdarg.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <ctype.h> ++#include <string.h> ++#include <errno.h> ++#include <unistd.h> ++#include <dirent.h> ++#include <limits.h> ++#include <elf.h> ++#include <getopt.h> ++#include <fnmatch.h> ++#include <asm/unistd.h> ++#include <sys/wait.h> ++#include <syslog.h> ++#include <zlib.h> ++ ++#define streq(a,b) (strcmp((a),(b)) == 0) ++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) ++ ++#include "list.h" ++static inline void try_old_version(const char *progname, char *argv[]) ++{ ++} ++extern long init_module(void *, unsigned long, const char *); ++extern long delete_module(const char *, unsigned int); ++ ++struct module { ++ struct list_head list; ++ char *modname; ++ char filename[0]; ++}; ++ ++#ifndef MODULE_DIR ++#define MODULE_DIR "/lib/modules" ++#endif ++ ++typedef void (*errfn_t)(const char *fmt, ...); ++ ++/* Do we use syslog or stderr for messages? */ ++static int log; ++ ++static void message(const char *prefix, const char *fmt, va_list *arglist) ++{ ++ char *buf, *buf2; ++ ++ vasprintf(&buf, fmt, *arglist); ++ asprintf(&buf2, "%s%s", prefix, buf); ++ ++ if (log) ++ syslog(LOG_NOTICE, "%s", buf2); ++ else ++ fprintf(stderr, "%s", buf2); ++ free(buf2); ++ free(buf); ++} ++void *grab_contents(gzFile *gzfd, unsigned long *size) ++{ ++ unsigned int max = 16384; ++ void *buffer = malloc(max); ++ int ret; ++ ++ if (!buffer) ++ return NULL; ++ ++ *size = 0; ++ while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) { ++ *size += ret; ++ if (*size == max) { ++ buffer = realloc(buffer, max *= 2); ++ if (!buffer) ++ return NULL; ++ } ++ } ++ if (ret < 0) { ++ free(buffer); ++ buffer = NULL; ++ } ++ return buffer; ++} ++ ++void *grab_fd(int fd, unsigned long *size) ++{ ++ gzFile gzfd; ++ ++ gzfd = gzdopen(fd, "rb"); ++ if (!gzfd) ++ return NULL; ++ ++ /* gzclose(gzfd) would close fd, which would drop locks. ++ Don't blame zlib: POSIX locking semantics are so horribly ++ broken that they should be ripped out. */ ++ return grab_contents(gzfd, size); ++} ++void release_file(void *data, unsigned long size) ++{ ++ free(data); ++} ++ ++ ++static int warned = 0; ++static void warn(const char *fmt, ...) ++{ ++ va_list arglist; ++ warned++; ++ va_start(arglist, fmt); ++ message("WARNING: ", fmt, &arglist); ++ va_end(arglist); ++} ++ ++static void fatal(const char *fmt, ...) ++{ ++ va_list arglist; ++ va_start(arglist, fmt); ++ message("FATAL: ", fmt, &arglist); ++ va_end(arglist); ++ exit(1); ++} ++ ++ ++static void grammar(const char *cmd, const char *filename, unsigned int line) ++{ ++ warn("%s line %u: ignoring bad line starting with '%s'\n", ++ filename, line, cmd); ++} ++ ++static void *do_nofail(void *ptr, const char *file, int line, const char *expr) ++{ ++ if (!ptr) { ++ fatal("Memory allocation failure %s line %d: %s.\n", ++ file, line, expr); ++ } ++ return ptr; ++} ++ ++#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__, #ptr) ++ ++static void print_usage(const char *progname) ++{ ++ fprintf(stderr, ++ "Usage: %s [-v] [-V] [-C config-file] [-n] [-i] [-q] [-b] [-o <modname>] <modname> [parameters...]\n" ++ "%s -r [-n] [-i] [-v] <modulename> ...\n" ++ "%s -l -t <dirname> [ -a <modulename> ...]\n", ++ progname, progname, progname); ++ exit(1); ++} ++ ++static int fgetc_wrapped(FILE *file, unsigned int *linenum) ++{ ++ for (;;) { ++ int ch = fgetc(file); ++ if (ch != '\\') ++ return ch; ++ ch = fgetc(file); ++ if (ch != '\n') ++ return ch; ++ if (linenum) ++ (*linenum)++; ++ } ++} ++ ++static char *getline_wrapped(FILE *file, unsigned int *linenum) ++{ ++ int size = 1024; ++ int i = 0; ++ char *buf = NOFAIL(malloc(size)); ++ for(;;) { ++ int ch = fgetc_wrapped(file, linenum); ++ if (i == size) { ++ size *= 2; ++ buf = NOFAIL(realloc(buf, size)); ++ } ++ if (ch < 0 && i == 0) { ++ free(buf); ++ return NULL; ++ } ++ if (ch < 0 || ch == '\n') { ++ if (linenum) ++ (*linenum)++; ++ buf[i] = '\0'; ++ return NOFAIL(realloc(buf, i+1)); ++ } ++ buf[i++] = ch; ++ } ++} ++ ++static struct module *find_module(const char *filename, struct list_head *list) ++{ ++ struct module *i; ++ ++ list_for_each_entry(i, list, list) { ++ if (strcmp(i->filename, filename) == 0) ++ return i; ++ } ++ return NULL; ++} ++ ++/* Convert filename to the module name. Works if filename == modname, too. */ ++static void filename2modname(char *modname, const char *filename) ++{ ++ const char *afterslash; ++ unsigned int i; ++ ++ afterslash = strrchr(filename, '/'); ++ if (!afterslash) ++ afterslash = filename; ++ else ++ afterslash++; ++ ++ /* Convert to underscores, stop at first . */ ++ for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) { ++ if (afterslash[i] == '-') ++ modname[i] = '_'; ++ else ++ modname[i] = afterslash[i]; ++ } ++ modname[i] = '\0'; ++} ++ ++static int lock_file(const char *filename) ++{ ++ int fd = open(filename, O_RDWR, 0); ++ ++ if (fd >= 0) { ++ struct flock lock; ++ lock.l_type = F_WRLCK; ++ lock.l_whence = SEEK_SET; ++ lock.l_start = 0; ++ lock.l_len = 1; ++ fcntl(fd, F_SETLKW, &lock); ++ } else ++ /* Read-only filesystem? There goes locking... */ ++ fd = open(filename, O_RDONLY, 0); ++ return fd; ++} ++ ++static void unlock_file(int fd) ++{ ++ /* Valgrind is picky... */ ++ close(fd); ++} ++ ++static void add_module(char *filename, int namelen, struct list_head *list) ++{ ++ struct module *mod; ++ ++ /* If it's a duplicate: move it to the end, so it gets ++ inserted where it is *first* required. */ ++ mod = find_module(filename, list); ++ if (mod) ++ list_del(&mod->list); ++ else { ++ /* No match. Create a new module. */ ++ mod = NOFAIL(malloc(sizeof(struct module) + namelen + 1)); ++ memcpy(mod->filename, filename, namelen); ++ mod->filename[namelen] = '\0'; ++ mod->modname = NOFAIL(malloc(namelen + 1)); ++ filename2modname(mod->modname, mod->filename); ++ } ++ ++ list_add_tail(&mod->list, list); ++} ++ ++/* Compare len chars of a to b, with _ and - equivalent. */ ++static int modname_equal(const char *a, const char *b, unsigned int len) ++{ ++ unsigned int i; ++ ++ if (strlen(b) != len) ++ return 0; ++ ++ for (i = 0; i < len; i++) { ++ if ((a[i] == '_' || a[i] == '-') ++ && (b[i] == '_' || b[i] == '-')) ++ continue; ++ if (a[i] != b[i]) ++ return 0; ++ } ++ return 1; ++} ++ ++/* Fills in list of modules if this is the line we want. */ ++static int add_modules_dep_line(char *line, ++ const char *name, ++ struct list_head *list) ++{ ++ char *ptr; ++ int len; ++ char *modname; ++ ++ /* Ignore lines without : or which start with a # */ ++ ptr = strchr(line, ':'); ++ if (ptr == NULL || line[strspn(line, "\t ")] == '#') ++ return 0; ++ ++ /* Is this the module we are looking for? */ ++ *ptr = '\0'; ++ if (strrchr(line, '/')) ++ modname = strrchr(line, '/') + 1; ++ else ++ modname = line; ++ ++ len = strlen(modname); ++ if (strchr(modname, '.')) ++ len = strchr(modname, '.') - modname; ++ if (!modname_equal(modnam |
