From 23632f5a29fe7dbb02f7b13eb2b404632cc8ac8c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 9 Nov 2010 11:31:47 +0100 Subject: [PATCH] * 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. --- cmdline/apt-changelog | 59 +++++++++++++++++++++++++++++++ cmdline/makefile | 7 ++++ debian/changelog | 8 +++++ debian/rules | 4 +-- doc/apt-changelog.1.xml | 77 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 2 deletions(-) create mode 100755 cmdline/apt-changelog create mode 100644 doc/apt-changelog.1.xml 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 + +set -e + +# evaluate and check CLI argumens +pkg="$1" + +if [ -z "$1" -o -n "$3" ]; then + echo "Usage: $0 [ | 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 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 @@ + + +%aptent; + + +%aptverbatiment; + +]> + + + + + + + Martin + Pitt + + + &apt-email; + &apt-product; + + 09 November 2010 + + + + apt-changelog + 1 + APT + + + + + apt-changelog + APT package changelog retriever + + + + + + apt-changelog + packagename + + version + candidate + + + + + Description + + apt-changelog downloads a package changelog from + http://changelogs.ubuntu.com and displays it through + sensible-pager. + + + + 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 candidate, it will fetch the changelog for the + latest available version of that package, i. e. the version which you would + get with apt-get install packagename. + + + +See Also + +&apt-get; + + + + &manbugs; + + + -- 2.50.0