summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rwxr-xr-xcmdline/apt-changelog67
-rwxr-xr-xcmdline/apt-key14
-rw-r--r--cmdline/makefile7
3 files changed, 81 insertions, 7 deletions
diff --git a/cmdline/apt-changelog b/cmdline/apt-changelog
new file mode 100755
index 000000000..6d7c0e95f
--- /dev/null
+++ b/cmdline/apt-changelog
@@ -0,0 +1,67 @@
+#!/bin/sh
+# Fetch Package changelog for given source or binary package. Send it through
+# a pager if stdout is a terminal.
+# (C) 2010 Canonical Ltd
+# Author: Martin Pitt <martin.pitt@ubuntu.com>
+
+set -e
+
+# evaluate and check CLI argumens
+pkg="$1"
+
+if [ -z "$1" -o -n "$3" ]; then
+ echo "Usage: $0 <package_name> [ <version> | candidate ]" >&2
+ exit 1
+fi
+
+version="$2"
+
+# do we want the log for the currently installed version?
+if [ -z "$version" ]; then
+ if ! dpkgs=`dpkg -s $pkg 2>/dev/null`; then
+ echo "ERROR: Package $pkg is not installed; try 'candidate' version for uninstalled packages" >&2
+ exit 1
+ fi
+ version=`echo "$dpkgs" | grep ^Version`
+fi
+
+# turn binary package names into source
+if src=`apt-cache show $pkg 2>/dev/null| grep -m 1 ^Source:`; then
+ pkg=${src#Source: }
+fi
+
+# get version and directory
+if ! showsrc=`apt-cache showsrc $pkg 2>/dev/null` || [ -z "$showsrc" ] ; then
+ echo "ERROR: Source or binary package $pkg does not exist" >&2
+ exit 1
+fi
+
+if [ "$version" = "candidate" ]; then
+ version=`echo "$showsrc"| grep -m 1 ^Version:`
+fi
+
+# strip off tag name and epoch
+version=${version#Version: }
+version=${version#*:}
+
+dir=`echo "$showsrc"| grep ^Directory:`
+dir=${dir#Directory: }
+
+# get configuration
+eval `apt-config shell SERVER Apt::Changelog::Server`
+
+if [ -z "$SERVER" ]; then
+ echo "ERROR: You need to set Apt::Changelog::Server configuration option" >&2
+ exit 1
+fi
+
+# fetch it
+OUT=`mktemp -t "${pkg}.changes.XXXXXX"`
+trap "rm $OUT" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+if ! wget -q -O- ${SERVER}/$dir/${pkg}_${version}/changelog > "$OUT"
+then
+ echo "ERROR: changelog for this version is not (yet) available; try https://launchpad.net/ubuntu/+source/$pkg/+changelog" >&2
+ exit 1
+fi
+sensible-pager "$OUT"
+
diff --git a/cmdline/apt-key b/cmdline/apt-key
index b39ab12e4..3514effad 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -8,13 +8,13 @@ unset GREP_OPTIONS
GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg"
GPG="$GPG_CMD"
-MASTER_KEYRING=""
-ARCHIVE_KEYRING_URI=""
-#MASTER_KEYRING=/usr/share/keyrings/debian-master-keyring.gpg
-#ARCHIVE_KEYRING_URI=http://ftp.debian.org/debian/debian-archive-keyring.gpg
-ARCHIVE_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg
-REMOVED_KEYS=/usr/share/keyrings/debian-archive-removed-keys.gpg
+# ubuntu keyrings
+MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg
+ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg
+REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg
+ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg
+
add_keys_with_verify_against_master_keyring() {
ADD_KEYRING=$1
@@ -85,7 +85,7 @@ net_update() {
update() {
if [ ! -f $ARCHIVE_KEYRING ]; then
echo >&2 "ERROR: Can't find the archive-keyring"
- echo >&2 "Is the debian-archive-keyring package installed?"
+ echo >&2 "Is the ubuntu-keyring package installed?"
exit 1
fi
diff --git a/cmdline/makefile b/cmdline/makefile
index 917ccc96a..61fa77dc2 100644
--- a/cmdline/makefile
+++ b/cmdline/makefile
@@ -64,3 +64,10 @@ include $(COPY_H)
#TO=$(BIN)
#TARGET=program
#include $(COPY_H)
+
+# The apt-changelog program
+SOURCE=apt-changelog
+TO=$(BIN)
+TARGET=program
+include $(COPY_H)
+