From 28569f414cf78a3d3f6ce1ea8ed6a6fafff6da9e Mon Sep 17 00:00:00 2001 From: Stefan Fiedler Date: Fri, 2 Nov 2007 13:22:11 +0000 Subject: [PATCH] Stefan Fiedler: coreutils: replace futimens.patch with commands .conf; cleanups add patch from clfs.org for uname to display the cpu type [2007091023133730914] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8721 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- .../coreutils/coreutils-6.9-uname-1.patch | 163 ++++++++++++++++++ package/base/coreutils/coreutils.conf | 27 +-- .../coreutils/dont-run-help2man.patch.cross | 23 --- package/base/coreutils/futimens.patch | 56 ------ 4 files changed, 171 insertions(+), 98 deletions(-) create mode 100644 package/base/coreutils/coreutils-6.9-uname-1.patch delete mode 100644 package/base/coreutils/dont-run-help2man.patch.cross delete mode 100644 package/base/coreutils/futimens.patch diff --git a/package/base/coreutils/coreutils-6.9-uname-1.patch b/package/base/coreutils/coreutils-6.9-uname-1.patch new file mode 100644 index 000000000..a2fae9d3a --- /dev/null +++ b/package/base/coreutils/coreutils-6.9-uname-1.patch @@ -0,0 +1,163 @@ +Copied from www.linuxfromscratch.org to ROCK Linux. + +Submitted By: Jim Gifford +Date: 2006-08-24 +Initial Package Version: 5.97 +Upstream Status: Not Accepted +Origin: Gentoo - http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils +Description: Display CPU Information from /proc/cpuinfo or /proc/sysinfo + +Original Patch by - Matthew Burgess and Scot McPherson + +diff -Naur coreutils-5.97.orig/src/uname.c coreutils-5.97/src/uname.c +--- coreutils-5.97.orig/src/uname.c 2005-09-15 12:57:04.000000000 -0700 ++++ coreutils-5.97/src/uname.c 2006-08-24 15:52:53.000000000 -0700 +@@ -51,6 +51,11 @@ + # include + #endif + ++#if defined (__linux__) ++# define USE_PROCINFO ++# define UNAME_HARDWARE_PLATFORM ++#endif ++ + #include "system.h" + #include "error.h" + #include "quote.h" +@@ -138,6 +143,106 @@ + exit (status); + } + ++#if defined(USE_PROCINFO) ++ ++# if defined(__s390__) || defined(__s390x__) ++# define CPUINFO_FILE "/proc/sysinfo" ++# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c" ++# else ++# define CPUINFO_FILE "/proc/cpuinfo" ++# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c" ++# endif ++ ++# define PROCINFO_PROCESSOR 0 ++# define PROCINFO_HARDWARE_PLATFORM 1 ++ ++static void __eat_cpuinfo_space(char *buf) ++{ ++ /* first eat trailing space */ ++ char *tmp = buf + strlen(buf) - 1; ++ while (tmp > buf && isspace(*tmp)) ++ *tmp-- = '\0'; ++ /* then eat leading space */ ++ tmp = buf; ++ while (*tmp && isspace(*tmp)) ++ tmp++; ++ if (tmp != buf) ++ memmove(buf, tmp, strlen(tmp)+1); ++} ++ ++static int __linux_procinfo (int x, char *fstr, size_t s) ++{ ++ FILE *fp; ++ ++ char *procinfo_keys[] = { ++ /* --processor --hardware-platform */ ++ #if defined(__alpha__) ++ "cpu model", "system type" ++ #elif defined(__arm__) ++ "Processor", "Hardware" ++ #elif defined(bfin) ++ "CPU", "BOARD Name" ++ #elif defined(__cris__) ++ "cpu", "cpu model" ++ #elif defined(__frv__) ++ "CPU-Core", "System" ++ #elif defined(__i386__) || defined(__x86_64__) ++ "model name", "vendor_id" ++ #elif defined(__ia64__) ++ "family", "vendor" ++ #elif defined(__hppa__) ++ "cpu", "model" ++ #elif defined(__m68k__) ++ "CPU", "MMU" ++ #elif defined(__mips__) ++ "cpu model", "system type" ++ #elif defined(__powerpc__) || defined(__powerpc64__) ++ "cpu", "machine" ++ #elif defined(__s390__) || defined(__s390x__) ++ "Type", "Manufacturer" ++ #elif defined(__sh__) ++ "cpu type", "machine" ++ #elif defined(sparc) || defined(__sparc__) ++ "type", "cpu" ++ #elif defined(__vax__) ++ "cpu type", "cpu" ++ #else ++ "unknown", "unknown" ++ #endif ++ }; ++ ++ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) { ++ char key[65], value[257], eol, *ret = NULL; ++ ++ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) { ++ __eat_cpuinfo_space(key); ++ if (!strcmp(key, procinfo_keys[x])) { ++ __eat_cpuinfo_space(value); ++ ret = value; ++ break; ++ } ++ if (eol != '\n') { ++ /* we need two fscanf's here in case the previous ++ * length limit caused us to read right up to the ++ * newline ... doing "%*[^\n]\n" wont eat the newline ++ */ ++ fscanf(fp, "%*[^\n]"); ++ fscanf(fp, "\n"); ++ } ++ } ++ fclose(fp); ++ ++ if (ret) { ++ strncpy(fstr, ret, s); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++#endif ++ + /* Print ELEMENT, preceded by a space if something has already been + printed. */ + +@@ -250,10 +355,14 @@ + if (toprint & PRINT_PROCESSOR) + { + char const *element = unknown; +-#if HAVE_SYSINFO && defined SI_ARCHITECTURE ++#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO) + { + static char processor[257]; ++#if defined(USE_PROCINFO) ++ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor)) ++#else + if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) ++#endif + element = processor; + } + #endif +@@ -306,9 +415,13 @@ + if (element == unknown) + { + static char hardware_platform[257]; ++#if defined(USE_PROCINFO) ++ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform)) ++#else + size_t s = sizeof hardware_platform; + static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM }; + if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0) ++#endif + element = hardware_platform; + } + #endif diff --git a/package/base/coreutils/coreutils.conf b/package/base/coreutils/coreutils.conf index 5b9daab63..4ec4a21d2 100644 --- a/package/base/coreutils/coreutils.conf +++ b/package/base/coreutils/coreutils.conf @@ -1,3 +1,4 @@ +#!/bin/bash # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. @@ -20,16 +21,9 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- - -coreutils_premake() { - # remove man/Makefile.maint as it tries to rebuild man pages - rm -vf man/Makefile.maint - touch man/Makefile.maint -} - coreutils_postmake() { for x in chgrp chmod chown cp dd df ln ls mkdir mknod mv rm rmdir \ - rmdir sync sync date echo false pwd stty true uname sleep \ + rmdir sync date echo false pwd stty true uname sleep \ cat cut sort do for y in usr/bin usr/sbin ; do @@ -49,14 +43,7 @@ coreutils_postmake() { chmod +x $root/usr/bin/shuffle } -premake="coreutils_premake" - -if [ $stagelevel -gt 0 ]; then - postmake="coreutils_postmake" -fi - -# a newer version will be installed by tar later -var_append flist''del '|' "usr/lib/charset.alias" +postmake="coreutils_postmake" # disable some file provided by other packages: # uptime, groups, hostname, kill, su @@ -64,7 +51,9 @@ var_append flist''del '|' "usr/lib/charset.alias" var_append INSTALL_WRAPPER_FILTER "|" "sed -r 's,.*/share/man/.*/(uptime|groups|hostname|kill|su).1\$,$builddir/dummy,'" var_append INSTALL_WRAPPER_FILTER "|" "sed -r 's,.*/bin/(uptime|groups|hostname|kill|su)\$,$builddir/dummy,'" -# allow c99 keywords (such as 'resticted' in coreutils-5.94/lib/time_r.h) -var_append CFLAGS " " "-std=c99" -export CFLAGS +hook_add preconf 5 "echo 'fu_cv_sys_stat_statfs2_bsize=yes' > config.cache ; \ + echo ac_cv_c_restrict=__restrict >> config.cache" +var_append extraconfopt " " "--cache-file=config.cache" +hook_add premake 5 'sed -i "s/futimens/gl_&/" $(grep -lr futimens *); \ + touch man/uname.1 man/touch.1' diff --git a/package/base/coreutils/dont-run-help2man.patch.cross b/package/base/coreutils/dont-run-help2man.patch.cross deleted file mode 100644 index 49ecd3856..000000000 --- a/package/base/coreutils/dont-run-help2man.patch.cross +++ /dev/null @@ -1,23 +0,0 @@ -help2man can fail in stage 1 if the build system's glibc is older than 2.4. -It also fails in cross-builds since it tries to execute cross-built programs. - ---- coreutils-6.9/man/Makefile.in.orig 2007-03-22 22:20:22.000000000 +0100 -+++ coreutils-6.9/man/Makefile.in 2007-06-28 11:58:24.581881000 +0200 -@@ -857,6 +857,7 @@ - 'or inadequate' 1>&2 \ - ;; \ - *) \ -+ if false ; then \ - rm -f $@ \ - && { echo "Updating man page $@"; \ - rm -rf $t; \ -@@ -869,7 +870,8 @@ - } \ - && sed 's|$*\.td/||g' $t/$@ > $@ \ - && chmod a-w $@ \ -- && rm -rf $t ;; \ -+ && rm -rf $t ; \ -+ fi ;; \ - esac - - check-local: check-x-vs-1 check-programs-vs-x diff --git a/package/base/coreutils/futimens.patch b/package/base/coreutils/futimens.patch deleted file mode 100644 index cb90378a6..000000000 --- a/package/base/coreutils/futimens.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ./lib/utimens.h.orig 2007-05-31 08:26:00.000000000 +0200 -+++ ./lib/utimens.h 2007-05-31 08:26:16.000000000 +0200 -@@ -1,3 +1,3 @@ - #include --int futimens (int, char const *, struct timespec const [2]); -+int futimens_local (int, char const *, struct timespec const [2]); - int utimens (char const *, struct timespec const [2]); ---- ./lib/utimens.c.orig 2007-05-31 08:26:00.000000000 +0200 -+++ ./lib/utimens.c 2007-05-31 08:26:23.000000000 +0200 -@@ -75,7 +75,7 @@ - Return 0 on success, -1 (setting errno) on failure. */ - - int --futimens (int fd ATTRIBUTE_UNUSED, -+futimens_local (int fd ATTRIBUTE_UNUSED, - char const *file, struct timespec const timespec[2]) - { - /* Some Linux-based NFS clients are buggy, and mishandle time stamps -@@ -185,5 +185,5 @@ - int - utimens (char const *file, struct timespec const timespec[2]) - { -- return futimens (-1, file, timespec); -+ return futimens_local (-1, file, timespec); - } ---- ./src/touch.c.orig 2007-05-31 08:26:00.000000000 +0200 -+++ ./src/touch.c 2007-05-31 08:26:29.000000000 +0200 -@@ -167,7 +167,7 @@ - - if (amtime_now) - { -- /* Pass NULL to futimens so it will not fail if we have -+ /* Pass NULL to futimens_local so it will not fail if we have - write access to the file, but don't own it. */ - t = NULL; - } -@@ -182,7 +182,7 @@ - t = timespec; - } - -- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0); -+ ok = (futimens_local (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0); - - if (fd == STDIN_FILENO) - { ---- ./src/copy.c.orig 2007-05-31 08:26:00.000000000 +0200 -+++ ./src/copy.c 2007-05-31 08:26:36.000000000 +0200 -@@ -518,7 +518,7 @@ - timespec[0] = get_stat_atime (src_sb); - timespec[1] = get_stat_mtime (src_sb); - -- if (futimens (dest_desc, dst_name, timespec) != 0) -+ if (futimens_local (dest_desc, dst_name, timespec) != 0) - { - error (0, errno, _("preserving times for %s"), quote (dst_name)); - if (x->require_preserve)