summaryrefslogtreecommitdiff
path: root/vendor/getinfo
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-05 08:24:00 +0100
committerMichael Vogt <mvo@debian.org>2013-12-05 08:24:00 +0100
commit44633bd7cac1ce68d4e475285a0f45b7a8952a7f (patch)
tree3e3af83bb955b9f49f38239d490b5173bb0b9ac4 /vendor/getinfo
parentb10b0c4aac5d0648125d4203eea6900032efb7ba (diff)
parent7014e1482942d00b66eb30061b0cf5d2a7b3ebf3 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: apt-pkg/deb/dpkgpm.cc cmdline/apt-key.in debian/control doc/apt-key.8.xml doc/makefile doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pl.po doc/po/pt.po doc/po/pt_BR.po
Diffstat (limited to 'vendor/getinfo')
-rwxr-xr-xvendor/getinfo36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/getinfo b/vendor/getinfo
new file mode 100755
index 000000000..ac816e10e
--- /dev/null
+++ b/vendor/getinfo
@@ -0,0 +1,36 @@
+#!/bin/sh
+# small helper to extract information form *.ent files
+
+BASEDIR="$(readlink -f "$(dirname $0)")"
+INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")"
+
+if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
+ echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.'
+ exit 1
+fi
+
+getrawfield() {
+ grep --max-count=1 "^<!ENTITY $1 \"" "${2:-$INFO}" | cut -d'"' -f 2
+}
+
+getfield() {
+ local FIELD="$(getrawfield "$@")"
+ FIELD="${FIELD#*>}"
+ echo "${FIELD%<*}"
+}
+
+case "$1" in
+debian-stable-codename)
+ getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
+ ;;
+ubuntu-codename)
+ getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
+ ;;
+keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri)
+ getfield "$1"
+ ;;
+*)
+ echo >&2 "Unknown data field $1 requested"
+ exit 2
+ ;;
+esac