summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-util/debugedit
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-util/debugedit')
-rw-r--r--dev-util/debugedit/Manifest2
-rw-r--r--dev-util/debugedit/debugedit-4.4.6-r1.ebuild35
-rw-r--r--dev-util/debugedit/debugedit-4.4.6-r2.ebuild36
-rw-r--r--dev-util/debugedit/debugedit-5.3.5-r1.ebuild39
-rw-r--r--dev-util/debugedit/files/Makefile11
-rw-r--r--dev-util/debugedit/files/debugedit-4.4.6-busted-paths-with-O0.patch49
-rw-r--r--dev-util/debugedit/files/debugedit-4.4.6-update.patch723
-rw-r--r--dev-util/debugedit/files/debugedit-5.1.9-DWARF-3.patch152
-rw-r--r--dev-util/debugedit/files/debugedit-5.1.9-cleanup.patch34
-rw-r--r--dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch129
-rwxr-xr-xdev-util/debugedit/files/update.sh71
-rw-r--r--dev-util/debugedit/metadata.xml5
12 files changed, 1286 insertions, 0 deletions
diff --git a/dev-util/debugedit/Manifest b/dev-util/debugedit/Manifest
new file mode 100644
index 000000000000..7c3062d15d85
--- /dev/null
+++ b/dev-util/debugedit/Manifest
@@ -0,0 +1,2 @@
+DIST debugedit-4.4.6.tar.bz2 12924 SHA256 33700d88de1dce201bcded9b43789bc352b9edce1c020ada0ac417bf88c3acb4 SHA512 ff1985e58ddc90f2fa9ea07573a72847dae89821a799ea9526c9056a11fd69c27879d9fc3c993ebb79e30c47968e0123083c6d031007ba58f186462fb2e49df9 WHIRLPOOL c1965db650ad3e871ae278af5848e06211249071660359800e5bcd32bb6dfa505a10fbfffd93b66907a934241d8be8bf9138da61f23c2f5feee69d8051141821
+DIST debugedit-5.3.5.tar.bz2 27799 SHA256 150461508dfd7791c9408c33248e5271e837167fdfa11d69d6fb51cc16d90663 SHA512 afac800a8f2e035705fcf997500d8fd2c3dc658850f47754863e8811db97859748721c5a252cc90dc81d07bf08763a9507e2272e983ee3f6bf16d8016fe5b8c9 WHIRLPOOL f3ae87994c7b9f3233502b4212b9036eae169b0ed18632c4565cf7f299012c4ef02558f476ebc4d17f3bb82c64eba8b7ed180138b66062c215546747e64c2025
diff --git a/dev-util/debugedit/debugedit-4.4.6-r1.ebuild b/dev-util/debugedit/debugedit-4.4.6-r1.ebuild
new file mode 100644
index 000000000000..2c6d37eeefac
--- /dev/null
+++ b/dev-util/debugedit/debugedit-4.4.6-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="Standalone debugedit taken from rpm"
+
+HOMEPAGE="http://www.rpm.org/"
+SRC_URI="http://dev.gentoo.org/~tester/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 hppa ppc ppc64 x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ dev-libs/elfutils"
+
+S=${WORKDIR}/${P}
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ epatch "${FILESDIR}/${P}-busted-paths-with-O0.patch"
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die "emake failed"
+}
+
+src_install() {
+ dobin debugedit
+}
diff --git a/dev-util/debugedit/debugedit-4.4.6-r2.ebuild b/dev-util/debugedit/debugedit-4.4.6-r2.ebuild
new file mode 100644
index 000000000000..39299141a1ed
--- /dev/null
+++ b/dev-util/debugedit/debugedit-4.4.6-r2.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="Standalone debugedit taken from rpm"
+
+HOMEPAGE="http://www.rpm.org/"
+SRC_URI="http://dev.gentoo.org/~tester/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ dev-libs/elfutils"
+
+S=${WORKDIR}/${P}
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ epatch "${FILESDIR}/${P}-busted-paths-with-O0.patch"
+ epatch "${FILESDIR}/${P}-update.patch"
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die "emake failed"
+}
+
+src_install() {
+ dobin debugedit
+}
diff --git a/dev-util/debugedit/debugedit-5.3.5-r1.ebuild b/dev-util/debugedit/debugedit-5.3.5-r1.ebuild
new file mode 100644
index 000000000000..93374bf74ed8
--- /dev/null
+++ b/dev-util/debugedit/debugedit-5.3.5-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# To recreate this tarball, just grab latest rpm5 release:
+# http://rpm5.org/files/rpm/
+# The files are in tools/
+# Or see $FILESDIR/update.sh
+
+EAPI="2"
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="standalone debugedit taken from rpm"
+HOMEPAGE="http://www.rpm5.org/"
+SRC_URI="http://dev.gentoo.org/~swegener/distfiles/${P}.tar.bz2
+ http://dev.gentoo.org/~vapier/distfiles/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 hppa ppc ppc64 x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE=""
+
+DEPEND="dev-libs/popt
+ dev-libs/elfutils
+ dev-libs/beecrypt"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-5.3.5-DWARF-4.patch #400663
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ dobin debugedit || die
+}
diff --git a/dev-util/debugedit/files/Makefile b/dev-util/debugedit/files/Makefile
new file mode 100644
index 000000000000..946a12865f64
--- /dev/null
+++ b/dev-util/debugedit/files/Makefile
@@ -0,0 +1,11 @@
+CPPFLAGS += -I.
+LDLIBS = -lelf -lpopt -lbeecrypt
+
+all: debugedit
+
+debugedit: debugedit.o hashtab.o
+
+clean:
+ rm -f *.o debugedit
+
+.PHONY: clean
diff --git a/dev-util/debugedit/files/debugedit-4.4.6-busted-paths-with-O0.patch b/dev-util/debugedit/files/debugedit-4.4.6-busted-paths-with-O0.patch
new file mode 100644
index 000000000000..fe2fec6e5553
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-4.4.6-busted-paths-with-O0.patch
@@ -0,0 +1,49 @@
+--- debugedit.c.orig 2007-11-07 05:54:25.093281634 +0000
++++ debugedit.c 2007-11-07 06:23:15.481373200 +0000
+@@ -723,8 +723,31 @@
+ }
+ }
+
+- if (t->attr[i].attr == DW_AT_comp_dir) {
+- if (form == DW_FORM_strp &&
++ else if (t->attr[i].attr == DW_AT_comp_dir)
++ {
++ if (form == DW_FORM_string)
++ {
++ free (comp_dir);
++ comp_dir = strdup (ptr);
++
++ if (phase == 1 && dest_dir && has_prefix (ptr, base_dir))
++ {
++ base_len = strlen (base_dir);
++ dest_len = strlen (dest_dir);
++
++ memcpy (ptr, dest_dir, dest_len);
++ if (dest_len < base_len)
++ {
++ memset (ptr + dest_len, '/',
++ base_len - dest_len);
++
++ }
++ elf_flagdata (debug_sections[DEBUG_INFO].elf_data,
++ ELF_C_SET, ELF_F_DIRTY);
++ }
++ }
++
++ else if (form == DW_FORM_strp &&
+ debug_sections[DEBUG_STR].data)
+ {
+ char *dir;
+@@ -749,11 +772,8 @@
+ ELF_C_SET, ELF_F_DIRTY);
+ }
+ }
+- else if (form == DW_FORM_string) {
+- free(comp_dir);
+- comp_dir = strdup (ptr);
+- }
+ }
++
+ else if ((t->tag == DW_TAG_compile_unit
+ || t->tag == DW_TAG_partial_unit)
+ && t->attr[i].attr == DW_AT_name
diff --git a/dev-util/debugedit/files/debugedit-4.4.6-update.patch b/dev-util/debugedit/files/debugedit-4.4.6-update.patch
new file mode 100644
index 000000000000..4b969c00d9fa
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-4.4.6-update.patch
@@ -0,0 +1,723 @@
+Patch-by: Peter Alfredsen <loki_val@gentoo.org>
+
+Mega patch, containing in no particular order:
+support for including empty directories in the output:
+https://bugzilla.redhat.com/show_bug.cgi?id=444310
+A bunch of warning fixes.
+DWARF3-support:
+https://bugzilla.redhat.com/show_bug.cgi?id=505774
+
+Most of this was pulled from rpm5.org
+
+We have factored out the support for the -i command line switch, since
+that would require pulling in another dependency (Beecrypt)
+
+--- debugedit.c.old 2009-10-20 16:48:31.000000000 +0200
++++ debugedit.c 2009-10-20 16:58:45.000000000 +0200
+@@ -1,6 +1,6 @@
+-/* Copyright (C) 2001, 2002, 2003, 2005 Red Hat, Inc.
++/* Copyright (C) 2001, 2002, 2003, 2005, 2007 Red Hat, Inc.
+ Written by Alexander Larsson <alexl@redhat.com>, 2002
+ Based on code by Jakub Jelinek <jakub@redhat.com>, 2001.
+
+ 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
+@@ -83,10 +83,11 @@
+ static uint_16 (*do_read_16) (unsigned char *ptr);
+ static uint_32 (*do_read_32) (unsigned char *ptr);
+ static void (*write_32) (unsigned char *ptr, GElf_Addr val);
+
+ static int ptr_size;
++static int cu_version;
+
+ static inline uint_16
+ buf_read_ule16 (unsigned char *data)
+ {
+ return data[0] | (data[1] << 8);
+@@ -122,11 +123,11 @@
+ data = NULL;
+ while ((data = elf_rawdata (scn, data)) != NULL)
+ {
+ if (data->d_buf
+ && offset >= data->d_off
+- && offset < data->d_off + data->d_size)
++ && offset < data->d_off + (off_t)data->d_size)
+ return (const char *) data->d_buf + (offset - data->d_off);
+ }
+ }
+
+ return NULL;
+@@ -208,20 +209,22 @@
+ #define DEBUG_INFO 0
+ #define DEBUG_ABBREV 1
+ #define DEBUG_LINE 2
+ #define DEBUG_ARANGES 3
+ #define DEBUG_PUBNAMES 4
+-#define DEBUG_MACINFO 5
+-#define DEBUG_LOC 6
+-#define DEBUG_STR 7
+-#define DEBUG_FRAME 8
+-#define DEBUG_RANGES 9
++#define DEBUG_PUBTYPES 5
++#define DEBUG_MACINFO 6
++#define DEBUG_LOC 7
++#define DEBUG_STR 8
++#define DEBUG_FRAME 9
++#define DEBUG_RANGES 10
+ { ".debug_info", NULL, NULL, 0, 0, 0 },
+ { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
+ { ".debug_line", NULL, NULL, 0, 0, 0 },
+ { ".debug_aranges", NULL, NULL, 0, 0, 0 },
+ { ".debug_pubnames", NULL, NULL, 0, 0, 0 },
++ { ".debug_pubtypes", NULL, NULL, 0, 0, 0 },
+ { ".debug_macinfo", NULL, NULL, 0, 0, 0 },
+ { ".debug_loc", NULL, NULL, 0, 0, 0 },
+ { ".debug_str", NULL, NULL, 0, 0, 0 },
+ { ".debug_frame", NULL, NULL, 0, 0, 0 },
+ { ".debug_ranges", NULL, NULL, 0, 0, 0 },
+@@ -297,11 +300,11 @@
+ free (t);
+ goto no_memory;
+ }
+ if (*slot != NULL)
+ {
+- error (0, 0, "%s: Duplicate DWARF-2 abbreviation %d", dso->filename,
++ error (0, 0, "%s: Duplicate DWARF abbreviation %d", dso->filename,
+ t->entry);
+ free (t);
+ htab_delete (h);
+ return NULL;
+ }
+@@ -317,21 +320,21 @@
+ goto no_memory;
+ }
+ form = read_uleb128 (ptr);
+ if (form == 2 || form > DW_FORM_indirect)
+ {
+- error (0, 0, "%s: Unknown DWARF-2 DW_FORM_%d", dso->filename, form);
++ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
+ htab_delete (h);
+ return NULL;
+ }
+
+ t->attr[t->nattr].attr = attr;
+ t->attr[t->nattr++].form = form;
+ }
+ if (read_uleb128 (ptr) != 0)
+ {
+- error (0, 0, "%s: DWARF-2 abbreviation does not end with 2 zeros",
++ error (0, 0, "%s: DWARF abbreviation does not end with 2 zeros",
+ dso->filename);
+ htab_delete (h);
+ return NULL;
+ }
+ *slot = t;
+@@ -369,46 +372,49 @@
+ /* At this point, we're always at the beginning of a path
+ segment. */
+
+ if (s[0] == '.' && (s[1] == 0 || IS_DIR_SEPARATOR (s[1])))
+ {
+- s ++;
++ s++;
+ if (*s)
+- s++;
+- else if (d > droot)
+- d--;
++ while (IS_DIR_SEPARATOR (*s))
++ ++s;
+ }
+
+ else if (s[0] == '.' && s[1] == '.'
+ && (s[2] == 0 || IS_DIR_SEPARATOR (s[2])))
+ {
+- char *pre = d-1; /* includes slash */
++ char *pre = d - 1; /* includes slash */
+ while (droot < pre && IS_DIR_SEPARATOR (*pre))
+ pre--;
+ if (droot <= pre && ! IS_DIR_SEPARATOR (*pre))
+ {
+- d = pre;
+- while (droot < d && ! IS_DIR_SEPARATOR (*d))
+- d--;
+- /* d now points to the slash */
+- if (droot < d)
+- d++;
+- s += 2;
+- if (*s)
+- s++;
+- else if (d > droot)
+- d--;
++ while (droot < pre && ! IS_DIR_SEPARATOR (*pre))
++ pre--;
++ /* pre now points to the slash */
++ if (droot < pre)
++ pre++;
++ if (pre + 3 == d && pre[0] == '.' && pre[1] == '.')
++ {
++ *d++ = *s++;
++ *d++ = *s++;
++ }
++ else
++ {
++ d = pre;
++ s += 2;
++ if (*s)
++ while (IS_DIR_SEPARATOR (*s))
++ s++;
++ }
+ }
+ else
+ {
+ *d++ = *s++;
+ *d++ = *s++;
+- if (*s)
+- *d++ = *s++;
+ }
+ }
+-
+ else
+ {
+ while (*s && ! IS_DIR_SEPARATOR (*s))
+ *d++ = *s++;
+ }
+@@ -431,12 +437,12 @@
+
+ static int
+ has_prefix (const char *str,
+ const char *prefix)
+ {
+- int str_len;
+- int prefix_len;
++ size_t str_len;
++ size_t prefix_len;
+
+ str_len = strlen (str);
+ prefix_len = strlen (prefix);
+
+ if (str_len < prefix_len)
+@@ -476,11 +482,11 @@
+ dso->filename);
+ return 1;
+ }
+
+ value = read_16 (ptr);
+- if (value != 2)
++ if (value != 2 && value != 3)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ value);
+ return 1;
+ }
+@@ -499,43 +505,43 @@
+
+ /* dir table: */
+ value = 1;
+ while (*ptr != 0)
+ {
+- ptr = strchr (ptr, 0) + 1;
++ ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ ++value;
+ }
+
+ dirt = (unsigned char **) alloca (value * sizeof (unsigned char *));
+- dirt[0] = ".";
++ dirt[0] = (unsigned char *) ".";
+ dirt_cnt = 1;
+ ptr = dir;
+ while (*ptr != 0)
+ {
+ dirt[dirt_cnt++] = ptr;
+- ptr = strchr (ptr, 0) + 1;
++ ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ }
+ ptr++;
+
+ /* file table: */
+ while (*ptr != 0)
+ {
+ char *s, *file;
+ size_t file_len, dir_len;
+
+- file = ptr;
+- ptr = strchr (ptr, 0) + 1;
++ file = (char *) ptr;
++ ptr = (unsigned char *) strchr ((char *)ptr, 0) + 1;
+ value = read_uleb128 (ptr);
+
+ if (value >= dirt_cnt)
+ {
+ error (0, 0, "%s: Wrong directory table index %u",
+ dso->filename, value);
+ return 1;
+ }
+ file_len = strlen (file);
+- dir_len = strlen (dirt[value]);
++ dir_len = strlen ((char *)dirt[value]);
+ s = malloc (comp_dir_len + 1 + file_len + 1 + dir_len + 1);
+ if (s == NULL)
+ {
+ error (0, ENOMEM, "%s: Reading file table", dso->filename);
+ return 1;
+@@ -552,34 +558,38 @@
+ s[dir_len] = '/';
+ memcpy (s + dir_len + 1, file, file_len + 1);
+ }
+ else
+ {
+- memcpy (s, comp_dir, comp_dir_len);
+- s[comp_dir_len] = '/';
+- memcpy (s + comp_dir_len + 1, dirt[value], dir_len);
+- s[comp_dir_len + 1 + dir_len] = '/';
+- memcpy (s + comp_dir_len + 1 + dir_len + 1, file, file_len + 1);
++ char *p = s;
++ if (comp_dir_len != 0)
++ {
++ memcpy (s, comp_dir, comp_dir_len);
++ s[comp_dir_len] = '/';
++ p += comp_dir_len + 1;
++ }
++ memcpy (p, dirt[value], dir_len);
++ p[dir_len] = '/';
++ memcpy (p + dir_len + 1, file, file_len + 1);
+ }
+ canonicalize_path (s, s);
+- if (base_dir == NULL ||
+- has_prefix (s, base_dir))
++ if (list_file_fd != -1)
+ {
+- char *p;
+- size_t size;
+- ssize_t ret;
+- if (base_dir)
+- p = s + strlen (base_dir);
+- else
++ char *p = NULL;
++ if (base_dir == NULL)
+ p = s;
+-
+- if (list_file_fd != -1)
++ else if (has_prefix (s, base_dir))
++ p = s + strlen (base_dir);
++ else if (has_prefix (s, dest_dir))
++ p = s + strlen (dest_dir);
++
++ if (p)
+ {
+- size = strlen (p) + 1;
++ size_t size = strlen (p) + 1;
+ while (size > 0)
+ {
+- ret = write (list_file_fd, p, size);
++ ssize_t ret = write (list_file_fd, p, size);
+ if (ret == -1)
+ break;
+ size -= ret;
+ p += ret;
+ }
+@@ -610,26 +620,26 @@
+ }
+ else
+ ptr = srcptr = dir;
+ while (*srcptr != 0)
+ {
+- size_t len = strlen (srcptr) + 1;
++ size_t len = strlen ((char *)srcptr) + 1;
+ const unsigned char *readptr = srcptr;
+
+- if (*srcptr == '/' && has_prefix (srcptr, base_dir))
++ if (*srcptr == '/' && has_prefix ((char *)srcptr, base_dir))
+ {
+ if (dest_len < base_len)
+ ++abs_dir_cnt;
+ memcpy (ptr, dest_dir, dest_len);
+ ptr += dest_len;
+ readptr += base_len;
+ }
+ srcptr += len;
+
+ shrank += srcptr - readptr;
+- canonicalize_path (readptr, ptr);
+- len = strlen (ptr) + 1;
++ canonicalize_path ((char *)readptr, (char *)ptr);
++ len = strlen ((char *)ptr) + 1;
+ shrank -= len;
+ ptr += len;
+
+ elf_flagdata (debug_sections[DEBUG_STR].elf_data,
+ ELF_C_SET, ELF_F_DIRTY);
+@@ -638,13 +648,16 @@
+ if (shrank > 0)
+ {
+ if (--shrank == 0)
+ error (EXIT_FAILURE, 0,
+ "canonicalization unexpectedly shrank by one character");
+- memset (ptr, 'X', shrank);
+- ptr += shrank;
+- *ptr++ = '\0';
++ else
++ {
++ memset (ptr, 'X', shrank);
++ ptr += shrank;
++ *ptr++ = '\0';
++ }
+ }
+
+ if (abs_dir_cnt + abs_file_cnt != 0)
+ {
+ size_t len = (abs_dir_cnt + abs_file_cnt) * (base_len - dest_len);
+@@ -658,13 +671,13 @@
+ *ptr++ = '\0';
+ ++srcptr;
+
+ while (*srcptr != 0)
+ {
+- size_t len = strlen (srcptr) + 1;
++ size_t len = strlen ((char *)srcptr) + 1;
+
+- if (*srcptr == '/' && has_prefix (srcptr, base_dir))
++ if (*srcptr == '/' && has_prefix ((char *)srcptr, base_dir))
+ {
+ memcpy (ptr, dest_dir, dest_len);
+ if (dest_len < base_len)
+ {
+ memmove (ptr + dest_len, srcptr + base_len,
+@@ -698,20 +711,20 @@
+ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
+ {
+ int i;
+ uint_32 list_offs;
+ int found_list_offs;
+- unsigned char *comp_dir;
++ char *comp_dir;
+
+ comp_dir = NULL;
+ list_offs = 0;
+ found_list_offs = 0;
+ for (i = 0; i < t->nattr; ++i)
+ {
+ uint_32 form = t->attr[i].form;
+- uint_32 len = 0;
+- int base_len, dest_len;
++ size_t len = 0;
++ size_t base_len, dest_len;
+
+
+ while (1)
+ {
+ if (t->attr[i].attr == DW_AT_stmt_list)
+@@ -721,70 +734,70 @@
+ list_offs = do_read_32_relocated (ptr);
+ found_list_offs = 1;
+ }
+ }
+
+- else if (t->attr[i].attr == DW_AT_comp_dir)
+- {
+- if (form == DW_FORM_string)
+- {
++ if (t->attr[i].attr == DW_AT_comp_dir)
++ {
++ if ( form == DW_FORM_string )
++ {
+ free (comp_dir);
+- comp_dir = strdup (ptr);
+-
+- if (phase == 1 && dest_dir && has_prefix (ptr, base_dir))
+- {
++ comp_dir = strdup ((char *)ptr);
++
++ if (phase == 1 && dest_dir && has_prefix ((char *)ptr, base_dir))
++ {
+ base_len = strlen (base_dir);
+ dest_len = strlen (dest_dir);
+-
++
+ memcpy (ptr, dest_dir, dest_len);
+ if (dest_len < base_len)
+- {
+- memset (ptr + dest_len, '/',
+- base_len - dest_len);
+-
+- }
++ {
++ memset(ptr + dest_len, '/',
++ base_len - dest_len);
++
++ }
+ elf_flagdata (debug_sections[DEBUG_INFO].elf_data,
+ ELF_C_SET, ELF_F_DIRTY);
+- }
+- }
++ }
++ }
++
++ else if (form == DW_FORM_strp &&
++ debug_sections[DEBUG_STR].data)
++ {
++ char *dir;
+
+- else if (form == DW_FORM_strp &&
+- debug_sections[DEBUG_STR].data)
+- {
+- char *dir;
+-
+- dir = debug_sections[DEBUG_STR].data
+- + do_read_32_relocated (ptr);
+- free (comp_dir);
+- comp_dir = strdup (dir);
++ dir = (char *) debug_sections[DEBUG_STR].data
++ + do_read_32_relocated (ptr);
+
+- if (phase == 1 && dest_dir && has_prefix (dir, base_dir))
+- {
+- base_len = strlen (base_dir);
+- dest_len = strlen (dest_dir);
+-
+- memcpy (dir, dest_dir, dest_len);
+- if (dest_len < base_len)
+- {
+- memmove (dir + dest_len, dir + base_len,
+- strlen (dir + base_len) + 1);
+- }
+- elf_flagdata (debug_sections[DEBUG_STR].elf_data,
+- ELF_C_SET, ELF_F_DIRTY);
+- }
+- }
+- }
++ free (comp_dir);
++ comp_dir = strdup (dir);
+
++ if (phase == 1 && dest_dir && has_prefix (dir, base_dir))
++ {
++ base_len = strlen (base_dir);
++ dest_len = strlen (dest_dir);
++
++ memcpy (dir, dest_dir, dest_len);
++ if (dest_len < base_len)
++ {
++ memmove (dir + dest_len, dir + base_len,
++ strlen (dir + base_len) + 1);
++ }
++ elf_flagdata (debug_sections[DEBUG_STR].elf_data,
++ ELF_C_SET, ELF_F_DIRTY);
++ }
++ }
++ }
+ else if ((t->tag == DW_TAG_compile_unit
+ || t->tag == DW_TAG_partial_unit)
+ && t->attr[i].attr == DW_AT_name
+ && form == DW_FORM_strp
+ && debug_sections[DEBUG_STR].data)
+ {
+ char *name;
+
+- name = debug_sections[DEBUG_STR].data
++ name = (char *) debug_sections[DEBUG_STR].data
+ + do_read_32_relocated (ptr);
+ if (*name == '/' && comp_dir == NULL)
+ {
+ char *enddir = strrchr (name, '/');
+
+@@ -814,10 +827,16 @@
+ }
+ }
+
+ switch (form)
+ {
++ case DW_FORM_ref_addr:
++ if (cu_version == 2)
++ ptr += ptr_size;
++ else
++ ptr += 4;
++ break;
+ case DW_FORM_addr:
+ ptr += ptr_size;
+ break;
+ case DW_FORM_ref1:
+ case DW_FORM_flag:
+@@ -839,16 +858,15 @@
+ case DW_FORM_sdata:
+ case DW_FORM_ref_udata:
+ case DW_FORM_udata:
+ read_uleb128 (ptr);
+ break;
+- case DW_FORM_ref_addr:
+ case DW_FORM_strp:
+ ptr += 4;
+ break;
+ case DW_FORM_string:
+- ptr = strchr (ptr, '\0') + 1;
++ ptr = (unsigned char *) strchr ((char *)ptr, '\0') + 1;
+ break;
+ case DW_FORM_indirect:
+ form = read_uleb128 (ptr);
+ continue;
+ case DW_FORM_block1:
+@@ -866,21 +884,49 @@
+ len = read_uleb128 (ptr);
+ form = DW_FORM_block1;
+ assert (len < UINT_MAX);
+ break;
+ default:
+- error (0, 0, "%s: Unknown DWARF-2 DW_FORM_%d", dso->filename,
++ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename,
+ form);
+ return NULL;
+ }
+
+ if (form == DW_FORM_block1)
+ ptr += len;
+
+ break;
+ }
+ }
++
++ /* Ensure the CU current directory will exist even if only empty. Source
++ filenames possibly located in its parent directories refer relatively to
++ it and the debugger (GDB) cannot safely optimize out the missing
++ CU current dir subdirectories. */
++ if (comp_dir && list_file_fd != -1)
++ {
++ char *p;
++ size_t size;
++
++ if (base_dir && has_prefix (comp_dir, base_dir))
++ p = comp_dir + strlen (base_dir);
++ else if (dest_dir && has_prefix (comp_dir, dest_dir))
++ p = comp_dir + strlen (dest_dir);
++ else
++ p = comp_dir;
++
++ size = strlen (p) + 1;
++ while (size > 0)
++ {
++ ssize_t ret = write (list_file_fd, p, size);
++ if (ret == -1)
++ break;
++ size -= ret;
++ p += ret;
++ }
++ }
++
+ if (found_list_offs && comp_dir)
+ edit_dwarf2_line (dso, list_offs, comp_dir, phase);
+
+ free (comp_dir);
+
+@@ -1068,11 +1114,11 @@
+ if (rtype != R_386_32)
+ goto fail;
+ break;
+ case EM_PPC:
+ case EM_PPC64:
+- if (rtype != R_PPC_ADDR32 || rtype != R_PPC_UADDR32)
++ if (rtype != R_PPC_ADDR32 && rtype != R_PPC_UADDR32)
+ goto fail;
+ break;
+ case EM_S390:
+ if (rtype != R_390_32)
+ goto fail;
+@@ -1135,42 +1181,42 @@
+ {
+ error (0, 0, "%s: .debug_info too small", dso->filename);
+ return 1;
+ }
+
+- value = read_16 (ptr);
+- if (value != 2)
++ cu_version = read_16 (ptr);
++ if (cu_version != 2 && cu_version != 3)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+- value);
++ cu_version);
+ return 1;
+ }
+
+ value = read_32_relocated (ptr);
+ if (value >= debug_sections[DEBUG_ABBREV].size)
+ {
+ if (debug_sections[DEBUG_ABBREV].data == NULL)
+ error (0, 0, "%s: .debug_abbrev not present", dso->filename);
+ else
+- error (0, 0, "%s: DWARF-2 CU abbrev offset too large",
++ error (0, 0, "%s: DWARF CU abbrev offset too large",
+ dso->filename);
+ return 1;
+ }
+
+ if (ptr_size == 0)
+ {
+ ptr_size = read_1 (ptr);
+ if (ptr_size != 4 && ptr_size != 8)
+ {
+- error (0, 0, "%s: Invalid DWARF-2 pointer size %d",
++ error (0, 0, "%s: Invalid DWARF pointer size %d",
+ dso->filename, ptr_size);
+ return 1;
+ }
+ }
+ else if (read_1 (ptr) != ptr_size)
+ {
+- error (0, 0, "%s: DWARF-2 pointer size differs between CUs",
++ error (0, 0, "%s: DWARF pointer size differs between CUs",
+ dso->filename);
+ return 1;
+ }
+
+ abbrev = read_abbrev (dso,
+@@ -1184,11 +1230,11 @@
+ if (tag.entry == 0)
+ continue;
+ t = htab_find_with_hash (abbrev, &tag, tag.entry);
+ if (t == NULL)
+ {
+- error (0, 0, "%s: Could not find DWARF-2 abbreviation %d",
++ error (0, 0, "%s: Could not find DWARF abbreviation %d",
+ dso->filename, tag.entry);
+ htab_delete (abbrev);
+ return 1;
+ }
+
+@@ -1289,11 +1335,10 @@
+ if (fd != -1)
+ close (fd);
+ return NULL;
+ }
+
+-
+ int
+ main (int argc, char *argv[])
+ {
+ DSO *dso;
+ int fd, i;
+@@ -1301,13 +1346,12 @@
+ poptContext optCon; /* context for parsing command-line options */
+ int nextopt;
+ const char **args;
+ struct stat stat_buf;
+ char *p;
+-
+- optCon = poptGetContext("debugedit", argc, (const char **)argv,
+- optionsTable, 0);
++
++ optCon = poptGetContext("debugedit", argc, (const char **)argv, optionsTable, 0);
+
+ while ((nextopt = poptGetNextOpt (optCon)) > 0 || nextopt == POPT_ERROR_BADOPT)
+ /* do nothing */ ;
+
+ if (nextopt != -1)
+@@ -1404,11 +1448,11 @@
+ if (strcmp (name, ".stab") == 0)
+ edit_stabs (dso, i);
+ #endif
+ if (strcmp (name, ".debug_info") == 0)
+ edit_dwarf2 (dso);
+-
++
+ break;
+ default:
+ break;
+ }
+ }
diff --git a/dev-util/debugedit/files/debugedit-5.1.9-DWARF-3.patch b/dev-util/debugedit/files/debugedit-5.1.9-DWARF-3.patch
new file mode 100644
index 000000000000..ab7bbb422c09
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.1.9-DWARF-3.patch
@@ -0,0 +1,152 @@
+Index: rpm/tools/debugedit.c
+RCS File: /v/rpm/cvs/rpm/tools/debugedit.c,v
+rcsdiff -q -kk '-r2.21' '-r2.22' -u '/v/rpm/cvs/rpm/tools/debugedit.c,v' 2>/dev/null
+--- debugedit.c 2008/12/25 17:21:43 2.21
++++ debugedit.c 2009/06/15 14:16:21 2.22
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2001, 2002, 2003, 2005, 2007 Red Hat, Inc.
++/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009 Red Hat, Inc.
+ Written by Alexander Larsson <alexl@redhat.com>, 2002
+ Based on code by Jakub Jelinek <jakub@redhat.com>, 2001.
+
+@@ -114,6 +114,7 @@
+ static void (*write_32) (unsigned char *ptr, GElf_Addr val);
+
+ static int ptr_size;
++static int cu_version;
+
+ static inline rpmuint16_t
+ buf_read_ule16 (unsigned char *data)
+@@ -239,16 +240,18 @@
+ #define DEBUG_LINE 2
+ #define DEBUG_ARANGES 3
+ #define DEBUG_PUBNAMES 4
+-#define DEBUG_MACINFO 5
+-#define DEBUG_LOC 6
+-#define DEBUG_STR 7
+-#define DEBUG_FRAME 8
+-#define DEBUG_RANGES 9
++#define DEBUG_PUBTYPES 5
++#define DEBUG_MACINFO 6
++#define DEBUG_LOC 7
++#define DEBUG_STR 8
++#define DEBUG_FRAME 9
++#define DEBUG_RANGES 10
+ { ".debug_info", NULL, NULL, 0, 0, 0 },
+ { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
+ { ".debug_line", NULL, NULL, 0, 0, 0 },
+ { ".debug_aranges", NULL, NULL, 0, 0, 0 },
+ { ".debug_pubnames", NULL, NULL, 0, 0, 0 },
++ { ".debug_pubtypes", NULL, NULL, 0, 0, 0 },
+ { ".debug_macinfo", NULL, NULL, 0, 0, 0 },
+ { ".debug_loc", NULL, NULL, 0, 0, 0 },
+ { ".debug_str", NULL, NULL, 0, 0, 0 },
+@@ -328,7 +331,7 @@
+ }
+ if (*slot != NULL)
+ {
+- error (0, 0, "%s: Duplicate DWARF-2 abbreviation %d", dso->filename,
++ error (0, 0, "%s: Duplicate DWARF abbreviation %d", dso->filename,
+ t->entry);
+ free (t);
+ htab_delete (h);
+@@ -348,7 +351,7 @@
+ form = read_uleb128 (ptr);
+ if (form == 2 || form > DW_FORM_indirect)
+ {
+- error (0, 0, "%s: Unknown DWARF-2 DW_FORM_%d", dso->filename, form);
++ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
+ htab_delete (h);
+ return NULL;
+ }
+@@ -358,7 +361,7 @@
+ }
+ if (read_uleb128 (ptr) != 0)
+ {
+- error (0, 0, "%s: DWARF-2 abbreviation does not end with 2 zeros",
++ error (0, 0, "%s: DWARF abbreviation does not end with 2 zeros",
+ dso->filename);
+ htab_delete (h);
+ return NULL;
+@@ -510,7 +513,7 @@
+ }
+
+ value = read_16 (ptr);
+- if (value != 2)
++ if (value != 2 && value != 3)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ value);
+@@ -855,7 +858,12 @@
+
+ switch (form)
+ {
+- case DW_FORM_ref_addr: /* ptr_size in DWARF 2, offset in DWARF 3 */
++ case DW_FORM_ref_addr:
++ if (cu_version == 2)
++ ptr += ptr_size;
++ else
++ ptr += 4;
++ break;
+ case DW_FORM_addr:
+ ptr += ptr_size;
+ break;
+@@ -907,7 +915,7 @@
+ assert (len < UINT_MAX);
+ break;
+ default:
+- error (0, 0, "%s: Unknown DWARF-2 DW_FORM_%d", dso->filename,
++ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename,
+ form);
+ return NULL;
+ }
+@@ -1204,11 +1212,11 @@
+ return 1;
+ }
+
+- value = read_16 (ptr);
+- if (value != 2)
++ cu_version = read_16 (ptr);
++ if (cu_version != 2 && cu_version != 3)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+- value);
++ cu_version);
+ return 1;
+ }
+
+@@ -1218,7 +1226,7 @@
+ if (debug_sections[DEBUG_ABBREV].data == NULL)
+ error (0, 0, "%s: .debug_abbrev not present", dso->filename);
+ else
+- error (0, 0, "%s: DWARF-2 CU abbrev offset too large",
++ error (0, 0, "%s: DWARF CU abbrev offset too large",
+ dso->filename);
+ return 1;
+ }
+@@ -1228,14 +1236,14 @@
+ ptr_size = read_1 (ptr);
+ if (ptr_size != 4 && ptr_size != 8)
+ {
+- error (0, 0, "%s: Invalid DWARF-2 pointer size %d",
++ error (0, 0, "%s: Invalid DWARF pointer size %d",
+ dso->filename, ptr_size);
+ return 1;
+ }
+ }
+ else if (read_1 (ptr) != ptr_size)
+ {
+- error (0, 0, "%s: DWARF-2 pointer size differs between CUs",
++ error (0, 0, "%s: DWARF pointer size differs between CUs",
+ dso->filename);
+ return 1;
+ }
+@@ -1253,7 +1261,7 @@
+ t = htab_find_with_hash (abbrev, &tag, tag.entry);
+ if (t == NULL)
+ {
+- error (0, 0, "%s: Could not find DWARF-2 abbreviation %d",
++ error (0, 0, "%s: Could not find DWARF abbreviation %d",
+ dso->filename, tag.entry);
+ htab_delete (abbrev);
+ return 1;
diff --git a/dev-util/debugedit/files/debugedit-5.1.9-cleanup.patch b/dev-util/debugedit/files/debugedit-5.1.9-cleanup.patch
new file mode 100644
index 000000000000..f83123f69ffc
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.1.9-cleanup.patch
@@ -0,0 +1,34 @@
+This patch is a hand-edited CVS patch covering only minor important cleanup changes.
+--- debugedit.c
++++ debugedit.c
+@@ -153,7 +153,7 @@
+ {
+ if (data->d_buf
+ && offset >= data->d_off
+- && offset < data->d_off + data->d_size)
++ && offset < data->d_off + (off_t)data->d_size)
+ return (const char *) data->d_buf + (offset - data->d_off);
+ }
+ }
+@@ -468,8 +465,8 @@
+ has_prefix (const char *str,
+ const char *prefix)
+ {
+- int str_len;
+- int prefix_len;
++ size_t str_len;
++ size_t prefix_len;
+
+ str_len = strlen (str);
+ prefix_len = strlen (prefix);
+@@ -747,8 +747,8 @@
+ for (i = 0; i < t->nattr; ++i)
+ {
+ uint_32 form = t->attr[i].form;
+- uint_32 len = 0;
+- int base_len, dest_len;
++ size_t len = 0;
++ size_t base_len, dest_len;
+
+
+ while (1)
diff --git a/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch b/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch
new file mode 100644
index 000000000000..3e1406196e9b
--- /dev/null
+++ b/dev-util/debugedit/files/debugedit-5.3.5-DWARF-4.patch
@@ -0,0 +1,129 @@
+add DWARF 4 support
+
+https://bugs.gentoo.org/400663
+https://bugzilla.redhat.com/show_bug.cgi?id=707677
+
+--- debugedit-5.3.5/debugedit.c 2011-10-11 05:37:49.000000000 +0200
++++ debugedit-5.3.5/debugedit.c 2012-01-25 01:27:23.487999039 +0100
+@@ -70,6 +70,10 @@
+ #include <rpmtag.h>
+
+ #define DW_TAG_partial_unit 0x3c
++#define DW_FORM_sec_offset 0x17
++#define DW_FORM_exprloc 0x18
++#define DW_FORM_flag_present 0x19
++#define DW_FORM_ref_sig8 0x20
+
+ char *base_dir = NULL;
+ char *dest_dir = NULL;
+@@ -246,6 +250,7 @@
+ #define DEBUG_STR 8
+ #define DEBUG_FRAME 9
+ #define DEBUG_RANGES 10
++#define DEBUG_TYPES 11
+ { ".debug_info", NULL, NULL, 0, 0, 0 },
+ { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
+ { ".debug_line", NULL, NULL, 0, 0, 0 },
+@@ -257,6 +262,7 @@
+ { ".debug_str", NULL, NULL, 0, 0, 0 },
+ { ".debug_frame", NULL, NULL, 0, 0, 0 },
+ { ".debug_ranges", NULL, NULL, 0, 0, 0 },
++ { ".debug_types", NULL, NULL, 0, 0, 0 },
+ { NULL, NULL, NULL, 0, 0, 0 }
+ };
+
+@@ -349,7 +355,8 @@
+ goto no_memory;
+ }
+ form = read_uleb128 (ptr);
+- if (form == 2 || form > DW_FORM_indirect)
++ if (form == 2
++ || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
+ {
+ error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
+ htab_delete (h);
+@@ -378,7 +385,6 @@
+ canonicalize_path (const char *s, char *d)
+ {
+ char *rv = d;
+- const char *sroot;
+ char *droot;
+
+ if (IS_DIR_SEPARATOR (*s))
+@@ -394,7 +400,6 @@
+ s++;
+ }
+ droot = d;
+- sroot = s;
+
+ while (*s)
+ {
+@@ -513,7 +518,7 @@
+ }
+
+ value = read_16 (ptr);
+- if (value != 2 && value != 3)
++ if (value != 2 && value != 3 && value != 4)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ value);
+@@ -529,8 +534,8 @@
+ return 1;
+ }
+
+- opcode_base = ptr[4];
+- ptr = dir = ptr + 4 + opcode_base;
++ opcode_base = ptr[4 + (value >= 4)];
++ ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
+
+ /* dir table: */
+ value = 1;
+@@ -758,7 +763,8 @@
+ {
+ if (t->attr[i].attr == DW_AT_stmt_list)
+ {
+- if (form == DW_FORM_data4)
++ if (form == DW_FORM_data4
++ || form == DW_FORM_sec_offset)
+ {
+ list_offs = do_read_32_relocated (ptr);
+ found_list_offs = 1;
+@@ -864,6 +870,8 @@
+ else
+ ptr += 4;
+ break;
++ case DW_FORM_flag_present:
++ break;
+ case DW_FORM_addr:
+ ptr += ptr_size;
+ break;
+@@ -878,10 +886,12 @@
+ break;
+ case DW_FORM_ref4:
+ case DW_FORM_data4:
++ case DW_FORM_sec_offset:
+ ptr += 4;
+ break;
+ case DW_FORM_ref8:
+ case DW_FORM_data8:
++ case DW_FORM_ref_sig8:
+ ptr += 8;
+ break;
+ case DW_FORM_sdata:
+@@ -910,6 +920,7 @@
+ form = DW_FORM_block1;
+ break;
+ case DW_FORM_block:
++ case DW_FORM_exprloc:
+ len = read_uleb128 (ptr);
+ form = DW_FORM_block1;
+ assert (len < UINT_MAX);
+@@ -1213,7 +1224,7 @@
+ }
+
+ cu_version = read_16 (ptr);
+- if (cu_version != 2 && cu_version != 3)
++ if (cu_version != 2 && cu_version != 3 && cu_version != 4)
+ {
+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
+ cu_version);
diff --git a/dev-util/debugedit/files/update.sh b/dev-util/debugedit/files/update.sh
new file mode 100755
index 000000000000..db5495d41eb2
--- /dev/null
+++ b/dev-util/debugedit/files/update.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+DISTDIR=/usr/portage/distfiles
+PN=debugedit
+
+. /etc/init.d/functions.sh
+
+set -e
+
+einfo "Getting updated index"
+rm -f index.html
+wget -q http://rpm5.org/
+
+PV=$(sed -n '/Production:/{n;s:.*RPM ::;s:<.*::;p;q}' index.html)
+einfo "Latest upstream version: ${PV}"
+rm -f index.html
+
+P="${PN}-${PV}"
+A=${P}.tar.bz2
+
+e=${P}.ebuild
+if [[ -e ../${e} ]] ; then
+ einfo "All up to date"
+ exit 0
+fi
+
+#tf=${DISTDIR}/${A}
+#if [[ ! -e ${tf} ]] ; then
+# einfo "Cannot find ${tf}"
+# exit 0
+#fi
+
+einfo "Fetching latest rpm tarball"
+r=rpm-${PV}
+wget -nv http://rpm5.org/files/rpm/rpm-${PV%.*}/${r}.tar.gz -P ${DISTDIR} -c
+
+einfo "Unpacking ${r}"
+rm -rf ${r}
+tar xf ${DISTDIR}/${r}.tar.gz
+
+einfo "Creating ${P}"
+rm -rf ${P}
+mkdir ${P}
+cp Makefile ${r}/tools/{hashtab.?,debugedit.c} ${P}/
+pushd ${P} >/dev/null
+more=true
+while ${more} ; do
+ more=false
+ for h in $(grep '#include' *.[ch] | awk '{print $NF}' | sed 's:[<>"]::g') ; do
+ [[ ${h} == */* ]] && continue
+ rh=$(find ../${r} -name ${h##*/})
+ if [[ -n ${rh} ]] && [[ ! -e ${rh##*/} ]] ; then
+ # don't copy glibc includes
+ if ! grep -qs 'This file is part of the GNU C Library' ${rh} ; then
+ cp ${rh} ./
+ more=true
+ fi
+ fi
+ done
+done
+popd >/dev/null
+tar jcf ${A} ${P}
+
+einfo "Testing build"
+pushd ${P} >/dev/null
+make -s
+popd >/dev/null
+
+einfo "Cleaning up"
+rm -rf ${P} ${r}
+du -b ${A}
diff --git a/dev-util/debugedit/metadata.xml b/dev-util/debugedit/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/dev-util/debugedit/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>