summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnish Bhatt2015-06-21 21:14:15 -0700
committerAnish Bhatt2015-06-21 21:14:15 -0700
commite8d22effaadf1b6a7d4c49025a1f14153b8658a9 (patch)
treecfd8963cc14e5cace09fddc3ea4cd4a51936a7ee
downloadaur-e8d22effaadf1b6a7d4c49025a1f14153b8658a9.tar.gz
Initial import
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD39
-rw-r--r--python2.patch8
-rw-r--r--python3.patch140
4 files changed, 205 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..41a8e98fc8f6
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = deheader
+ pkgdesc = C and C++ file analyzer to determine which header enclusions can be removed while still allowing them to compile
+ pkgver = 1.1
+ pkgrel = 1
+ url = http://www.catb.org/esr/deheader/
+ arch = any
+ license = BSD
+ depends = python
+ provides = deheader
+ source = http://www.catb.org/~esr/deheader/deheader-1.1.tar.gz
+ source = python3.patch
+ source = python2.patch
+ md5sums = 1be3e197af339f4f65524e62198beff4
+ md5sums = 4738b5b10899020ad00edf32b37cc597
+ md5sums = 62edf5aa5ee0206632ea2b50c22dfeb7
+
+pkgname = deheader
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9b6b8f0fd23e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,39 @@
+# Contributor :Anish Bhatt <anish[removethis][at]gatech[dot]edu>
+# Maintainer : Anish Bhatt <anish[removethis][at]gatech[dot]edu>
+# Other Contributors : trontonic for man page & license fixes.
+
+pkgname=deheader
+pkgver=1.1
+pkgrel=1
+
+pkgdesc='C and C++ file analyzer to determine which header enclusions can be removed while still allowing them to compile'
+url='http://www.catb.org/esr/deheader/'
+arch=('any')
+
+source=(http://www.catb.org/~esr/deheader/deheader-$pkgver.tar.gz
+ python3.patch
+ python2.patch)
+md5sums=('1be3e197af339f4f65524e62198beff4'
+ '4738b5b10899020ad00edf32b37cc597'
+ '62edf5aa5ee0206632ea2b50c22dfeb7')
+
+#change to python2, if you don't want python3
+#depends=('python2')
+depends=('python')
+provides=('deheader')
+license=('BSD')
+
+build () {
+ pushd ${srcdir}/deheader-$pkgver
+# Use this if you wish to stick to python2
+# patch -p0 < ../python2.patch
+ patch -p0 < ../python3.patch
+}
+package() {
+ install -d -m755 ${pkgdir}/usr/bin || return 1
+ install -m755 ${srcdir}/deheader-$pkgver/deheader ${pkgdir}/usr/bin || return 1
+ install -d -m755 ${pkgdir}/usr/share/man/man1 || return 1
+ install -m644 ${srcdir}/deheader-$pkgver/deheader.1 ${pkgdir}/usr/share/man/man1 || return 1
+ install -Dm644 ${srcdir}/deheader-$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING" || return 1
+}
+
diff --git a/python2.patch b/python2.patch
new file mode 100644
index 000000000000..ab95b1deaaff
--- /dev/null
+++ b/python2.patch
@@ -0,0 +1,8 @@
+--- deheader.orig 2010-12-28 13:29:53.000000000 -0800
++++ deheader 2010-12-28 13:29:58.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ """\
+ deheader -- find (optionally remove) unneeded includes in C or C++ sourcefiles.
+
diff --git a/python3.patch b/python3.patch
new file mode 100644
index 000000000000..42d80717338b
--- /dev/null
+++ b/python3.patch
@@ -0,0 +1,140 @@
+--- deheader (original)
++++ deheader (refactored)
+@@ -30,7 +30,7 @@
+ The last line of the output is a statistical summary of operations.
+ """
+
+-import sys, os, getopt, time, re, operator, commands
++import sys, os, getopt, time, re, operator, subprocess
+
+ BATON_DEBUG = 1
+ PROGRESS_DEBUG = 2
+@@ -1243,20 +1243,20 @@
+ if not os.path.isdir(root):
+ if excludes and excludes.search(root):
+ if verbose > 1:
+- print "deheader: %s excluded" % root
++ print("deheader: %s excluded" % root)
+ elif InclusionMap.c_source(root):
+ self.files.append(root)
+ else:
+- print >>sys.stderr, "deheader: can't analyze %s" % root
++ print("deheader: can't analyze %s" % root, file=sys.stderr)
+ else:
+ sublist = []
+ for root, dirs, files in os.walk(root):
+- dirs = filter(lambda x: not x.startswith("."), dirs)
++ dirs = [x for x in dirs if not x.startswith(".")]
+ for name in files:
+ path = os.path.join(root, name)
+ if excludes and excludes.search(path):
+ if verbose > 1:
+- print "deheader: %s excluded" % root
++ print("deheader: %s excluded" % root)
+ elif InclusionMap.c_source(path):
+ sublist.append(path)
+ sublist.sort()
+@@ -1280,15 +1280,15 @@
+ elif line.startswith("#include"):
+ if verbosity >= PROGRESS_DEBUG:
+ name = trim(line)
+- print "deheader: %s includes %s" % (sourcefile, name)
++ print("deheader: %s includes %s" % (sourcefile, name))
+ if ignore and ignore.search(line):
+ if verbosity >= PROGRESS_DEBUG:
+- print "deheader: ignoring %s (exclusion match with %s)." % (name, ignore.pattern)
++ print("deheader: ignoring %s (exclusion match with %s)." % (name, ignore.pattern))
+ continue
+ if not conditions or conditions == ["S_SPLINT_S"]:
+ includes.append(line)
+ elif verbose > 1:
+- print "deheader: ignoring %s (conditional inclusion)" % name
++ print("deheader: ignoring %s (conditional inclusion)" % name)
+ for (r, c, h) in compiled:
+ if c.search(line):
+ if not set(h).issubset(set(seen)):
+@@ -1302,7 +1302,7 @@
+ trimmedcount[ref] = trimmedcount.get(ref, 0) + 1
+ for ref in trimmedcount:
+ if trimmedcount[ref] > 1:
+- print "deheader: %s has more than one inclusion of %s" % (sourcefile, ref)
++ print("deheader: %s has more than one inclusion of %s" % (sourcefile, ref))
+ def forget(self, sourcefile, header):
+ "Forget a header dependency."
+ self.depends_on[sourcefile].remove(header)
+@@ -1353,7 +1353,7 @@
+ os.remove(derived)
+ command = maker + " " + derived
+ start = time.time()
+- (status, output) = commands.getstatusoutput(command)
++ (status, output) = subprocess.getstatusoutput(command)
+ end = time.time()
+ if verbosity >= COMMAND_DEBUG or (showerrs and os.WIFEXITED(status) and os.WEXITSTATUS(status) != 0):
+ sys.stdout.write(output + "\n")
+@@ -1364,7 +1364,7 @@
+ else:
+ explain = "succeeded"
+ if verbosity >= PROGRESS_DEBUG:
+- print "deheader: %s%s %s." % (source, msg, explain)
++ print("deheader: %s%s %s." % (source, msg, explain))
+ if os.path.exists(derived):
+ os.remove(derived)
+ return (status, end - start)
+@@ -1389,7 +1389,7 @@
+ for required in requirements:
+ if required in header:
+ if verbosity >= PROGRESS_DEBUG:
+- print "deheader: in %s, %s prevents uninclusion of %s" % (sourcefile, trigger, trim(header))
++ print("deheader: in %s, %s prevents uninclusion of %s" % (sourcefile, trigger, trim(header)))
+ retain += 1
+ if not retain:
+ saveit.remove_headers([header])
+@@ -1406,10 +1406,10 @@
+ baton.end()
+ # Missing-require detection. Can't be merged with duplicate-header
+ # detection because this has to be done after unneeded headers are removed.
+- stillhere = map(trim, includes)
++ stillhere = list(map(trim, includes))
+ for (requirement, trigger) in requires:
+ if not set(requirement).issubset(stillhere):
+- print "deheader: in %s, %s portability requires %s." % (sourcefile, trigger, ",".join(requirement))
++ print("deheader: in %s, %s portability requires %s." % (sourcefile, trigger, ",".join(requirement)))
+ return unneeded
+
+ def deheader(sourcefile, maker, includes, requires, remove, verbose):
+@@ -1423,7 +1423,7 @@
+ includes[:], requires, verbose)
+ if unneeded:
+ for line in unneeded:
+- print "deheader: remove %s from %s" % (trim(line), sourcefile)
++ print("deheader: remove %s from %s" % (trim(line), sourcefile))
+ if remove:
+ remove_it = SaveForModification(sourcefile)
+ remove_it.remove_headers(unneeded)
+@@ -1431,7 +1431,7 @@
+ del remove_it
+ return Summary([sourcefile], includes, unneeded)
+ else:
+- print >>sys.stderr, "deheader: basic compilation failed on %s" % (sourcefile,)
++ print("deheader: basic compilation failed on %s" % (sourcefile,), file=sys.stderr)
+ return Summary([sourcefile], includes, [])
+
+ # After-action analysis starts here
+@@ -1478,7 +1478,7 @@
+ elif switch in ('-v', '--verbose'):
+ verbose += 1
+ elif switch in ('-V', '--version'):
+- print "deheader", version
++ print("deheader", version)
+ raise SystemExit(0)
+ elif switch in ('-x', '--exclude'):
+ exclusions.append(val)
+@@ -1504,7 +1504,7 @@
+ stats = Summary()
+ for summary in summaries:
+ stats = stats + summary
+- print "deheader: saw", stats
++ print("deheader: saw", stats)
+ raise SystemExit(0)
+
+ # End