]> git.saurik.com Git - apt.git/commitdiff
* Add cmdline/apt-changelog: Script to fetch package changelog from
authorMartin Pitt <martin.pitt@canonical.com>
Tue, 9 Nov 2010 10:31:47 +0000 (11:31 +0100)
committerMartin Pitt <martin.pitt@canonical.com>
Tue, 9 Nov 2010 10:31:47 +0000 (11:31 +0100)
  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 [new file with mode: 0755]
cmdline/makefile
debian/changelog
debian/rules
doc/apt-changelog.1.xml [new file with mode: 0644]

diff --git a/cmdline/apt-changelog b/cmdline/apt-changelog
new file mode 100755 (executable)
index 0000000..ac2b6e5
--- /dev/null
@@ -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"
+
index 917ccc96aef76d5fe06e318d205a2e6a1945ad8e..61fa77dc2ba501be2faa6e854c5fb0611f3398ef 100644 (file)
@@ -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)
+
index f13eeb856c854e3ac59faa64fafaa14e283890df..047e18bdc7f6ffdb7ebfc3cc953cc5f70fa5134a 100644 (file)
@@ -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:
index f6ffabd1c6dba9a42f388bcc64fcd1849033b671..9f3dca6279554f478fa996934c20e3b53b0f491a 100755 (executable)
@@ -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 (file)
index 0000000..2f545bb
--- /dev/null
@@ -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>
+