coreutils: upgrade to latest GPLv2 version (6.9)

Before adding latest coreutils GPLv3 version, first we upgrade existing
recipe to latest GPLv2 version here.

To ensure a clean process, all bits are coded from scratch including
patches and recipe, except that in recipe lines about update-alternative
are reused from previous 5.3.0. All new patches are licensed under
GPLv2.

Tested simple features with most coreutils commands

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Kevin Tian
2010-08-18 12:55:21 +08:00
committed by Richard Purdie
parent 7303807ef1
commit 03df313715
10 changed files with 125 additions and 194 deletions

View File

@@ -1,44 +0,0 @@
Index: coreutils-5.3.0/lib/utimens.c
===================================================================
--- coreutils-5.3.0.orig/lib/utimens.c 2005-01-03 22:19:15.000000000 +0000
+++ coreutils-5.3.0/lib/utimens.c 2007-07-01 19:12:32.000000000 +0000
@@ -55,8 +55,8 @@
If TIMESPEC is null, set the time stamps to the current time. */
int
-futimens (int fd ATTRIBUTE_UNUSED,
- char const *file, struct timespec const timespec[2])
+gl_futimens (int fd ATTRIBUTE_UNUSED,
+ char const *file, struct timespec const timespec[2])
{
/* There's currently no interface to set file timestamps with
nanosecond resolution, so do the best we can, discarding any
@@ -117,5 +117,5 @@
int
utimens (char const *file, struct timespec const timespec[2])
{
- return futimens (-1, file, timespec);
+ return gl_futimens (-1, file, timespec);
}
Index: coreutils-5.3.0/lib/utimens.h
===================================================================
--- coreutils-5.3.0.orig/lib/utimens.h 2004-11-23 20:54:33.000000000 +0000
+++ coreutils-5.3.0/lib/utimens.h 2007-07-01 19:12:37.000000000 +0000
@@ -1,3 +1,3 @@
#include "timespec.h"
-int futimens (int, char const *, struct timespec const [2]);
+int gl_futimens (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
Index: coreutils-5.3.0/src/touch.c
===================================================================
--- coreutils-5.3.0.orig/src/touch.c 2004-11-23 20:54:35.000000000 +0000
+++ coreutils-5.3.0/src/touch.c 2007-07-01 19:11:52.000000000 +0000
@@ -191,7 +191,7 @@
t = timespec;
}
- ok = (futimens (fd, file, t) == 0);
+ ok = (gl_futimens (fd, file, t) == 0);
if (fd != -1)
ok &= (close (fd) == 0);

View File

@@ -1,27 +0,0 @@
--- src/install.c~ 2003-08-09 18:46:45.000000000 +0100
+++ src/install.c 2004-03-27 18:38:45.000000000 +0000
@@ -516,7 +516,14 @@
strip (const char *path)
{
int status;
- pid_t pid = fork ();
+ pid_t pid;
+ char *strip_name;
+
+ strip_name = getenv ("STRIP");
+ if (strip_name == NULL)
+ strip_name = "strip";
+
+ pid = fork ();
switch (pid)
{
@@ -524,7 +531,7 @@
error (EXIT_FAILURE, errno, _("fork system call failed"));
break;
case 0: /* Child. */
- execlp ("strip", "strip", path, NULL);
+ execlp (strip_name, "strip", path, NULL);
error (EXIT_FAILURE, errno, _("cannot run strip"));
break;
default: /* Parent. */

View File

@@ -1,42 +0,0 @@
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#
--- coreutils-5.3.0/configure.ac~man
+++ coreutils-5.3.0/configure.ac
@@ -237,6 +237,20 @@
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION(0.13.1)
+AC_MSG_CHECKING([whether to build man pages])
+AC_ARG_WITH(manpages,
+ AS_HELP_STRING([--with-manpages],
+ [Enable building of manpages (default=yes)]),
+ [cu_cv_build_manpages=$enableval],
+ [cu_cv_build_manpages=yes])
+# help2man doesn't work when crosscompiling, as it needs to run the
+# binary that was built.
+if test x"$cross_compiling" = x"yes"; then
+ cu_cv_build_manpages=no
+fi
+AC_MSG_RESULT($cu_cv_build_manpages)
+AM_CONDITIONAL(ENABLE_MANPAGES, test x"$cu_cv_build_manpages" = x"yes")
+
AC_CONFIG_FILES(
Makefile
doc/Makefile
--- coreutils-5.3.0/Makefile.am~man
+++ coreutils-5.3.0/Makefile.am
@@ -1,6 +1,11 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
+if ENABLE_MANPAGES
SUBDIRS = lib src doc man po tests
+else
+SUBDIRS = lib src doc po tests
+endif
+
EXTRA_DIST = Makefile.cfg Makefile.maint GNUmakefile \
.kludge-stamp .prev-version THANKS-to-translators THANKStt.in \
.x-sc_space_tab .x-sc_sun_os_names \

View File

@@ -1,33 +0,0 @@
Glibc 2.5 has a function called tee which conflicts with the same function
in coreutils. This patch renames the function to tee_files (as is done in
the newer coreutils versions.)
--- coreutils-5.3.0/src/tee.c 2006/10/23 07:35:00 1.1
+++ coreutils-5.3.0/src/tee.c 2006/10/23 07:35:16
@@ -31,7 +31,7 @@
#define AUTHORS "Mike Parker", "Richard M. Stallman", "David MacKenzie"
-static bool tee (int nfiles, const char **files);
+static bool tee_files (int nfiles, const char **files);
/* If true, append to output files rather than truncating them. */
static bool append;
@@ -121,7 +121,7 @@
/* Do *not* warn if tee is given no file arguments.
POSIX requires that it work when given no arguments. */
- ok = tee (argc - optind, (const char **) &argv[optind]);
+ ok = tee_files (argc - optind, (const char **) &argv[optind]);
if (close (STDIN_FILENO) != 0)
error (EXIT_FAILURE, errno, _("standard input"));
@@ -133,7 +133,7 @@
Return true if successful. */
static bool
-tee (int nfiles, const char **files)
+tee_files (int nfiles, const char **files)
{
FILE **descriptors;
char buffer[BUFSIZ];

View File

@@ -1,11 +0,0 @@
--- coreutils-5.3.0/src/Makefile.am.orig 2005-09-27 22:34:35.659272058 -0700
+++ coreutils-5.3.0/src/Makefile.am 2005-09-27 22:34:39.403507668 -0700
@@ -74,7 +74,7 @@
sleep_LDADD = $(nanosec_libs)
tail_LDADD = $(nanosec_libs)
-uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS)
+uptime_LDADD = $(LDADD) $(POW_LIB) $(GETLOADAVG_LIBS)
su_LDADD = $(LDADD) $(LIB_CRYPT)

View File

@@ -0,0 +1,61 @@
# coreutils uses gnulib which conflicts with newer libc header on futimens
# this patch simply renames coreutils futimes to avoid confliction
#
# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
# (this patch is licensed under GPLv2)
diff --git a/lib/utimens.c b/lib/utimens.c
index 71bc510..ae870b8 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -75,7 +75,7 @@ struct utimbuf
Return 0 on success, -1 (setting errno) on failure. */
int
-futimens (int fd ATTRIBUTE_UNUSED,
+futimens_coreutils (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 @@ futimens (int fd ATTRIBUTE_UNUSED,
int
utimens (char const *file, struct timespec const timespec[2])
{
- return futimens (-1, file, timespec);
+ return futimens_coreutils (-1, file, timespec);
}
diff --git a/lib/utimens.h b/lib/utimens.h
index 0097aaa..13fc45a 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -1,3 +1,3 @@
#include <time.h>
-int futimens (int, char const *, struct timespec const [2]);
+int futimens_coreutils (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
diff --git a/src/copy.c b/src/copy.c
index 4bdb75c..04634f1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -518,7 +518,7 @@ copy_reg (char const *src_name, char const *dst_name,
timespec[0] = get_stat_atime (src_sb);
timespec[1] = get_stat_mtime (src_sb);
- if (futimens (dest_desc, dst_name, timespec) != 0)
+ if (futimens_coreutils (dest_desc, dst_name, timespec) != 0)
{
error (0, errno, _("preserving times for %s"), quote (dst_name));
if (x->require_preserve)
diff --git a/src/touch.c b/src/touch.c
index a79c26d..6ef317d 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -182,7 +182,7 @@ touch (const char *file)
t = timespec;
}
- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
+ ok = (futimens_coreutils (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
if (fd == STDIN_FILENO)
{

View File

@@ -0,0 +1,19 @@
# remove the line to cause recursive inclusion error from autoreconf, sicne
# newer autoconf has included this definition. Simply rename it here.
#
# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
# (this patch is licensed under GPLv2)
diff --git a/extensions.m4 b/extensions.m4
index 143a9e5..f6558f1 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -16,7 +16,7 @@
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS_DUMMY],
[
AC_BEFORE([$0], [AC_COMPILE_IFELSE])
AC_BEFORE([$0], [AC_RUN_IFELSE])

View File

@@ -0,0 +1,22 @@
# man page for 'touch' is generated differently from others. All other utilities
# are provided static man source files, while for 'touch' it requires help2man
# to invoke "touch --help" and then convert the output into the manual. Since touch
# is with target format which can't be invoked on build system, disable building
# 'touch' man page here.
#
# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
# (this patch is licensed under GPLv2)
diff --git a/man/Makefile.am b/man/Makefile.am
index 32df9d1..37b09e3 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -27,7 +27,7 @@ dist_man_MANS = \
paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
- su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
+ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 tr.1 true.1 tsort.1 \
tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
whoami.1 yes.1 $(MAN)
optional_mans = \

View File

@@ -1,7 +0,0 @@
DESCRIPTION = "A collection of core GNU utilities."
LICENSE = "GPL"
SECTION = "base"
RREPLACES = "textutils shellutils fileutils"
RPROVIDES = "textutils shellutils fileutils"
inherit autotools gettext

View File

@@ -1,42 +1,41 @@
require coreutils.inc
DESCRIPTION = "The GNU Core Utilities are the basic file, shell and text manipulation utilities of the GNU operating system. These are the core utilities which are expected to exist on every operating system"
HOMEPAGE = "http://www.gnu.org/software/coreutils/"
BUGTRACKER = "http://debbugs.gnu.org/coreutils"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
file://src/ls.c;startline=4;endline=16;md5=482a96d4f25010a4e13f8743e0c3685e"
PR = "r0"
DEPENDS = "perl-native"
PR = "r2"
inherit autotools gettext
SRC_URI = "ftp://alpha.gnu.org/gnu/coreutils/coreutils-${PV}.tar.bz2 \
file://install-cross.patch;patch=1;pnum=0 \
file://man.patch;patch=1 \
file://rename-tee-for-glibc2.5.patch;patch=1 \
file://uptime-pow-lib.patch;patch=1 \
file://futimens.patch;patch=1"
SRC_URI = "http://ftp.gnu.org/gnu/coreutils/${BP}.tar.bz2 \
file://gnulib_m4.patch \
file://futimens.patch \
file://man-touch.patch"
# [ gets a special treatment and is not included in this
bindir_progs = "basename cksum comm csplit cut dir dircolors dirname du \
env expand expr factor fmt fold groups head hostid id install \
join link logname md5sum mkfifo nice nl nohup od paste pathchk \
pinky pr printenv printf ptx readlink seq sha1sum shred sort \
split stat sum tac tail tee test tr tsort tty unexpand uniq \
unlink users vdir wc who whoami yes \
"
bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
env expand expr factor fmt fold groups head hostid id install \
join link logname md5sum mkfifo nice nl nohup od paste pathchk \
pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
sha384sum sha512sum shred shuf sort split stat sum tac tail tee test \
tr tsort tty unexpand uniq unlink users vdir wc who whoami yes"
# hostname gets a special treatment and is not included in this
base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill \
ln ls mkdir mknod mv pwd rm rmdir sleep stty sync touch \
true uname \
"
base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
mknod mv pwd rm rmdir sleep stty sync touch true uname"
sbindir_progs= "chroot"
do_install () {
do_install() {
autotools_do_install
# Renaming the utilities that should go in /usr/bin
for i in ${bindir_progs}; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}; done
# Renaming and moving the utilities that should go in /bin (FHS)
install -d ${D}${base_bindir}
for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${PN}; done
# Renaming and moving the utilities that should go in /usr/sbin (FHS)
install -d ${D}${sbindir}
for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${PN}; done
@@ -44,20 +43,17 @@ do_install () {
# in update-alternatives to fail, therefore use lbracket - the name used
# for the actual source file.
mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${PN}
# hostname and uptime separated. busybox's versions are preferred
mv ${D}${bindir}/hostname ${D}${base_bindir}/hostname.${PN}
mv ${D}${bindir}/uptime ${D}${bindir}/uptime.${PN}
}
pkg_postinst_${PN} () {
# The utilities in /usr/bin
for i in ${bindir_progs}; do update-alternatives --install ${bindir}/$i $i $i.${PN} 100; done
# The utilities in /bin
for i in ${base_bindir_progs}; do update-alternatives --install ${base_bindir}/$i $i $i.${PN} 100; done
# The utilities in /usr/sbin
for i in ${sbindir_progs}; do update-alternatives --install ${sbindir}/$i $i $i.${PN} 100; done
# Special cases. uptime and hostname is broken, prefer busybox's version. [ needs to be treated separately.
@@ -67,13 +63,10 @@ pkg_postinst_${PN} () {
}
pkg_prerm_${PN} () {
# The utilities in /usr/bin
for i in ${bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
# The utilities in /bin
for i in ${base_bindir_progs}; do update-alternatives --remove $i $i.${PN}; done
# The utilities in /usr/sbin
for i in ${sbindir_progs}; do update-alternatives --remove $i $i.${PN}; done
# The special cases