diff options
author | Daniel Burrows <dburrows@debian.org> | 2007-10-24 10:27:19 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2007-10-24 10:27:19 -0700 |
commit | f6df027405b7667cb8ef0f5cc12a496d844294a4 (patch) | |
tree | b3fee4e7f924b9887e85b4d10f7c34f803789690 | |
parent | d93d8c604a4f331f8c320138e045085c01885794 (diff) | |
download | aptitude-f6df027405b7667cb8ef0f5cc12a496d844294a4.tar.gz |
Add hypothetical support for homepages, once apt-pkg learns about them. (Closes: #445244)
Once the support is in apt-pkg, I might want to revisit this and add code to,
e.g., run epiphany on the homepage of a package.
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | src/cmdline/cmdline_show.cc | 6 | ||||
-rw-r--r-- | src/pkg_info_screen.cc | 8 | ||||
-rw-r--r-- | src/pkg_view.cc | 12 |
4 files changed, 34 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 76174b9f..b98eaee4 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,15 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgcache.h>]], AC_DEFINE([HAVE_DDTP], [], [Set to true if apt is DDTP-enabled]), AC_MSG_RESULT([no])) +AC_MSG_CHECKING([whether apt supports the Homepage: field]) + +AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgrecords.h>]], + [[ pkgRecords::Parser p;]] + [[ p.Homepage();]]), + AC_MSG_RESULT([yes]) + AC_DEFINE([APT_HAS_HOMEPAGE], [], [Set to true if apt supports the Homepage: field]), + AC_MSG_RESULT([no])) + # Try to guess what namespace the hash stuff is in (maybe I should just # use rbltrees instead in most places?) if test x$HASH_INC != x diff --git a/src/cmdline/cmdline_show.cc b/src/cmdline/cmdline_show.cc index e7a9badf..5c1ede97 100644 --- a/src/cmdline/cmdline_show.cc +++ b/src/cmdline/cmdline_show.cc @@ -425,6 +425,12 @@ static fragment *version_file_fragment(pkgCache::VerIterator ver, get_short_description(ver).c_str())); fragments.push_back(indentbox(1, 1, make_desc_fragment(get_long_description(ver)))); +#ifdef APT_HAS_HOMEPAGE + if(rec.Homepage() != "") + fragments.push_back(dropbox(text_fragment(_("Homepage: ")), + hardwrapbox(text_fragment(rec.Homepage())))); +#endif + fragment *tags = make_tags_fragment(pkg); if(tags) fragments.push_back(fragf("%n%F", tags)); diff --git a/src/pkg_info_screen.cc b/src/pkg_info_screen.cc index f76c01ed..42ba773a 100644 --- a/src/pkg_info_screen.cc +++ b/src/pkg_info_screen.cc @@ -1,6 +1,6 @@ // pkg_info_screen.cc // -// Copyright 2000-2002, 2004-2005 Daniel Burrows +// Copyright 2000-2002, 2004-2005, 2007 Daniel Burrows // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -95,6 +95,12 @@ void pkg_grouppolicy_info::setup_package_info(const pkgCache::PkgIterator &pkg, _("Description: "), shortdesc.c_str()))); frags.push_back(indentbox(2, 2, make_desc_fragment(desc))); +#ifdef APT_HAS_HOMEPAGE + if(rec.Homepage() != "") + frags.push_back(dropbox(fragf("%B%s%b", _("Homepage: ")), + hardwrapbox(text_fragment(rec.Homepage())))); +#endif + fragment *tags = make_tags_fragment(pkg); if(tags != NULL) frags.push_back(fragf("%n%F", tags)); diff --git a/src/pkg_view.cc b/src/pkg_view.cc index 391316d7..653ce678 100644 --- a/src/pkg_view.cc +++ b/src/pkg_view.cc @@ -226,12 +226,24 @@ public: void set_package(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver) { +#ifdef APT_HAS_HOMEPAGE + pkgRecords::Parser &rec=apt_package_records->Lookup(ver.FileList()); +#endif + // Check against pkg.end() to hack around #339533; if ver is a // default iterator, pkg.end() is true. wstring newdesc(pkg.end() ? L"" : get_long_description(ver)); fragment *frag=make_desc_fragment(newdesc); +#ifdef APT_HAS_HOMEPAGE + fragment *homepage = + rec.Homepage() == "" + ? fragf("") + : dropbox(fragf("%B%s%b", _("Homepage")), + hardwrapbox(text_fragment(rec.Homepage()))); +#endif + fragment *tags=make_tags_fragment(pkg); if(tags != NULL) tags = fragf("%n%n%F", tags); |