summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcmdline/apt-changelog59
-rw-r--r--cmdline/makefile7
-rw-r--r--debian/changelog8
-rwxr-xr-xdebian/rules4
-rw-r--r--doc/apt-changelog.1.xml77
5 files changed, 153 insertions, 2 deletions
diff --git a/cmdline/apt-changelog b/cmdline/apt-changelog
new file mode 100755
index 000000000..ac2b6e5fb
--- /dev/null
+++ b/cmdline/apt-changelog
@@ -0,0 +1,59 @@
+#!/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 ^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: }
+
+# 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- http://changelogs.ubuntu.com/changelogs/$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/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)
+
diff --git a/debian/changelog b/debian/changelog
index f13eeb856..047e18bdc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+apt (0.8.8ubuntu2) UNRELEASED; urgency=low
+
+ * Add cmdline/apt-changelog: Script to fetch package changelog from
+ changelogs.ubuntu.com. Install it in cmdline/makefile and debian/rules.
+ * Add doc/apt-changelog.1.xml, and install it in debian/rules.
+
+ -- Martin Pitt <martin.pitt@ubuntu.com> Tue, 09 Nov 2010 10:39:41 +0100
+
apt (0.8.8ubuntu1) natty; urgency=low
* merged from debian-unstable, remainging changes:
diff --git a/debian/rules b/debian/rules
index f6ffabd1c..9f3dca627 100755
--- a/debian/rules
+++ b/debian/rules
@@ -73,7 +73,7 @@ configure.in:
endif
# APT Programs in apt-utils
-APT_UTILS=ftparchive sortpkgs extracttemplates
+APT_UTILS=ftparchive sortpkgs extracttemplates changelog
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
@@ -268,7 +268,7 @@ libapt-pkg-dev: build debian/shlibs.local
dh_md5sums -p$@
dh_builddeb -p$@
-apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
+apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates apt-changelog
apt-utils: build debian/shlibs.local
dh_testdir -p$@
dh_testroot -p$@
diff --git a/doc/apt-changelog.1.xml b/doc/apt-changelog.1.xml
new file mode 100644
index 000000000..2f545bb68
--- /dev/null
+++ b/doc/apt-changelog.1.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!ENTITY % aptent SYSTEM "apt.ent">
+%aptent;
+
+<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
+%aptverbatiment;
+
+]>
+
+<refentry>
+
+<refentryinfo>
+
+ <author>
+ <firstname>Martin</firstname>
+ <surname>Pitt</surname>
+ <contrib></contrib>
+ </author>
+ &apt-email;
+ &apt-product;
+ <!-- The last update date -->
+ <date>09 November 2010</date>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>apt-changelog</refentrytitle>
+ <manvolnum>1</manvolnum>
+ <refmiscinfo class="manual">APT</refmiscinfo>
+ </refmeta>
+
+ <!-- Man page title -->
+ <refnamediv>
+ <refname>apt-changelog</refname>
+ <refpurpose>APT package changelog retriever</refpurpose>
+ </refnamediv>
+
+ <!-- Arguments -->
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>apt-changelog</command>
+ <arg choice="plain"><replaceable>packagename</replaceable></arg>
+ <group>
+ <arg choice="plain"><replaceable>version</replaceable></arg>
+ <arg choice="plain">candidate</arg>
+ </group>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1><title>Description</title>
+ <para>
+ <command>apt-changelog</command> downloads a package changelog from
+ <ulink>http://changelogs.ubuntu.com</ulink> and displays it through
+ <command>sensible-pager</command>.
+ </para>
+
+ <para>
+ By default it displays the changelog for the version that is installed.
+ However, you can specify a different version as the second argument; if you
+ specify <constant>candidate</constant>, it will fetch the changelog for the
+ latest available version of that package, i. e. the version which you would
+ get with <command>apt-get install <parameter>packagename</parameter></command>.
+ </para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+&apt-get;
+</para>
+</refsect1>
+
+ &manbugs;
+
+</refentry>
+