Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 33340 - emerge arch fails with head -1 obsolete
Summary: emerge arch fails with head -1 obsolete
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 All
: High normal (vote)
Assignee: Todd Berman (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-12 15:22 UTC by Loz Hygate
Modified: 2004-08-02 15:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Loz Hygate 2003-11-12 15:22:15 UTC
emerge arch fails because head -1 is obsolete in coreutils-5.0.91 to fix it, use the following ebuild and patch:

$ diff -u arch-1.0_pre17.ebuild arch-1.0_pre17-r2.ebuild
--- arch-1.0_pre17.ebuild       2003-10-06 12:06:46.000000000 +0100
+++ arch-1.0_pre17-r2.ebuild    2003-11-12 23:11:49.000000000 +0000
@@ -33,6 +33,7 @@
  
        cp ${t} ${t}.orig
        sed 's:/libexec:/share:g' ${t}.orig > ${t} || die "Patch failed for $t"
+       epatch ${FILESDIR}/arch-1.0pre17-head-option-patch.diff
 }
  
 src_compile() {


$ cat files/arch-1.0pre17-head-option-patch.diff
diff -ur arch-1.0pre17/src/build-tools/scripts/configure-top arch-1.0pre17-head-option-patch/src/build-tools/scripts/configure-top
--- arch-1.0pre17/src/build-tools/scripts/configure-top 2003-02-04 23:24:43.000000000 +0000
+++ arch-1.0pre17-head-option-patch/src/build-tools/scripts/configure-top      2003-11-12 23:02:56.000000000 +0000
@@ -355,8 +355,13 @@
   basere="([a-zA-Z]([a-zA-Z0-9]*(-[a-zA-Z0-9]+)?)*)"
   vsnre="([0-9]+\\.[0-9]+)"
   patchre="(base-0|patch-[0-9]+|version-0|version-fix-[0-9]+)"
-
-  package=`grep -E -e "^[      ]*($basere)(--$basere)?(--$vsnre(--$patchre)?)?[        ]*(;.*)?\$" "$pkgfile" | head -1`
+  # head -2 is obsolete in coreutils-5.0.91
+  if [ `echo "test"|head -1 2>/dev/null` ]; then
+       HEAD="head -"
+  else
+       HEAD="head -n "
+  fi
+  package=`grep -E -e "^[      ]*($basere)(--$basere)?(--$vsnre(--$patchre)?)?[        ]*(;.*)?\$" "$pkgfile" | $HEAD 1`
  
   if test "x$package" = x ; then
     echo "ERROR: ill-formed distribution name in =project ($pkgfile)." 1>&2
Comment 1 Loz Hygate 2003-11-12 23:58:05 UTC
The test in the diff file should swallow stdout as well, viz:

if [ `echo "test"|head -1 >/dev/null 2>/dev/null` ]; then
Comment 2 Loz Hygate 2003-11-13 12:30:11 UTC
I didn't remember off the top of my head if /bin/sh supported the fd dupping syntax, but seeing as its at the bottom of the patch I guess it does. So the line would read better as

if [ `echo "test"|head -1 >/dev/null 2>&1` ]; then

Now, brain, you can stop thinking about this please.
Comment 3 Loz Hygate 2004-08-02 15:27:27 UTC
This doesn't happen any more with dev-util/tla-1.2-r2