Bug#611741: dpkg: i486 - i686 cputable adjustment for Ubuntu

2011-02-06 Thread Guillem Jover
Hi!

On Tue, 2011-02-01 at 11:46:39 -0600, Jonathan Nieder wrote:
 Colin Watson wrote:
  --- a/debian/rules
  +++ b/debian/rules
  @@ -80,6 +80,13 @@ install: check
   
  cd build-tree  $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
   
  +ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu  echo yes))
  +   # Ubuntu's i386 architecture is built for i686 (the Debian default
  +   # is i486).
  +   sed -ri 's/^(i386[[:space:]]+)[^[:space:]]+/\1i686/' \
  +   $(CURDIR)/debian/tmp/usr/share/dpkg/cputable
  +endif
  +

I've pushed this to master, although I'm not entirely happy having
this there (as hinted on the commit msg), it seems better to me than
having diverging downstreams, if that can be helped.

 All current uses of $(shell come after a ?=, which is presumably
 good for bootstrapping a dpkg-less platform.  In this case, it's
 harmless --- if dpkg-vendor is missing, the only bad effect would be a
 command not found.

Not really, bootstrapping should be possible from the pure upstream
part (although there's some pending issues there), but the Debian
packaging part relies on debhelper and dpkg itself, at which point
you might as well have those installed in the system already (instead
of say the build trees or a local directory).

 Maybe we can keep debian/rules clean by making this hack available to
 other distros, too. :) Would something along these lines make sense?
 I'm not sure --- I was considering using a ./configure flag that can
 be overridden in the Makefile but then the patch seemed to be growing
 too much...

Well it does not seem much cleaner than what Colin provided TBH :),
yes the replacing logic is hidden but still there's the i386 and
Ubuntu special cases there. At least Colin's changes are “contained”.

So the other solutions/options I can come up with right now are:

 * Having different files per diverging downstream (as in
   cputable.ubuntu or similar), but this incurs a higher maintenance
   cost, which I'd rather avoid.

 * Adding a new vendor hook which can modify specific arch values at
   run-time. Although probably cleaner, it has the potential but
   improvable problem of unknown software using directly the tables
   instead of Dpkg::Arch or dpkg-architecture, and the confusion with
   unmatched file and output. But probably what we should move to in
   the future regardless, if nothing better comes up.

thanks,
guillem



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611741: dpkg: i486 - i686 cputable adjustment for Ubuntu

2011-02-06 Thread Jonathan Nieder
Guillem Jover wrote:

 Not really, bootstrapping should be possible from the pure upstream
 part (although there's some pending issues there), but the Debian
 packaging part relies on debhelper and dpkg itself

Ah, sorry for the thinko.

In that case I can say enthusiastically that I like Colin's changes,
indeed because they are contained.

When another example comes up it will be easier to figure out whether
something like

  * Adding a new vendor hook which can modify specific arch values at
run-time. Although probably cleaner, it has the potential but
improvable problem of unknown software using directly the tables
instead of Dpkg::Arch or dpkg-architecture

is necessary, or a framework for generating cputable at build time
from a cputable.in, or something else.

Thanks. :)
Jonathan



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611741: dpkg: i486 - i686 cputable adjustment for Ubuntu

2011-02-01 Thread Colin Watson
Package: dpkg
Version: 1.15.8.10
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch natty

Thanks to lots of hard work in the past, Ubuntu is tantalisingly close
to just being able to use Debian's dpkg source package without
modifications.  The last substantive piece is that we build our i386
architecture for i686 rather than for i486, and thus require a different
cputable entry so that DEB_BUILD_GNU_CPU is set properly when building
packages.  This patch uses dpkg-vendor to adjust cputable appropriately
if and only if dpkg is being built on an Ubuntu-derived system.

Doing this in debian/rules is of course slightly hacky, but I didn't
think it was worth attempting to design a more complex system for a
single use case.  We can revisit this if and when other uses come along.

(Note also that dpkg uses the output of dpkg-architecture at configure
time - m4/dpkg-arch.m4 - but it only uses the Debian names, not the GNU
names, so it doesn't matter that we only do this substitution later.)

diff --git a/debian/rules b/debian/rules
index b4b70b8..64fdcf2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -80,6 +80,13 @@ install: check
 
cd build-tree  $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
 
+ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu  echo yes))
+   # Ubuntu's i386 architecture is built for i686 (the Debian default
+   # is i486).
+   sed -ri 's/^(i386[[:space:]]+)[^[:space:]]+/\1i686/' \
+   $(CURDIR)/debian/tmp/usr/share/dpkg/cputable
+endif
+
 # Put together the dpkg and dselect packages
 binary-arch: install
dh_testdir -a

Thanks,

-- 
Colin Watson   [cjwat...@ubuntu.com]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611741: dpkg: i486 - i686 cputable adjustment for Ubuntu

2011-02-01 Thread Jonathan Nieder
Colin Watson wrote:

 --- a/debian/rules
 +++ b/debian/rules
 @@ -80,6 +80,13 @@ install: check
  
   cd build-tree  $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
  
 +ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu  echo yes))
 + # Ubuntu's i386 architecture is built for i686 (the Debian default
 + # is i486).
 + sed -ri 's/^(i386[[:space:]]+)[^[:space:]]+/\1i686/' \
 + $(CURDIR)/debian/tmp/usr/share/dpkg/cputable
 +endif
 +
  # Put together the dpkg and dselect packages
  binary-arch: install
   dh_testdir -a

All current uses of $(shell come after a ?=, which is presumably
good for bootstrapping a dpkg-less platform.  In this case, it's
harmless --- if dpkg-vendor is missing, the only bad effect would be a
command not found.

Maybe we can keep debian/rules clean by making this hack available to
other distros, too. :) Would something along these lines make sense?
I'm not sure --- I was considering using a ./configure flag that can
be overridden in the Makefile but then the patch seemed to be growing
too much...

Anyway, thanks for brining a single shared source package closer to
reality.
---
diff --git a/Makefile.am b/Makefile.am
index f1561ef..e142772 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,11 @@ ACLOCAL_AMFLAGS = -I m4
 
 dist_pkgdata_DATA = cputable ostable triplettable
 
+install-data-hook:
+   ! test $${I386_ARCH:+set} || \
+   sed -i -e ^i386 s/i[^3]86/$${I386_ARCH}/ \
+   $(DESTDIR)$(pkgdatadir)/cputable; \
+
 EXTRA_DIST = \
.mailmap \
ChangeLog.old \
diff --git a/debian/rules b/debian/rules
index b4b70b8..feb7a01 100755
--- a/debian/rules
+++ b/debian/rules
@@ -78,7 +78,12 @@ install: check
dh_clean -k
dh_installdirs
 
-   cd build-tree  $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+   cd build-tree  \
+   if dpkg-vendor --derives-from Ubuntu 2/dev/null; then \
+   $(MAKE) DESTDIR=$(CURDIR)/debian/tmp I386_ARCH=i686 install; \
+   else \
+   $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install; \
+   fi
 
 # Put together the dpkg and dselect packages
 binary-arch: install



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org