Просмотр исходного кода

show potentially arch-qualified fullname in 'apt show'

We do not show the architecture as a dedicated field as this is rather
technical information, but as packagename it makes sense to show the
architecture as other part of apt will refer to it in this way.
David Kalnischkies лет назад: 10
Родитель
Сommit
90139c7075
2 измененных файлов с 27 добавлено и 9 удалено
  1. 1 0
      apt-private/private-show.cc
  2. 26 9
      test/integration/test-apt-cli-show

+ 1 - 0
apt-private/private-show.cc

@@ -219,6 +219,7 @@ static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgCache::VerIterator const
    RW.push_back(pkgTagSection::Tag::Remove("Description"));
    RW.push_back(pkgTagSection::Tag::Remove("Description"));
    RW.push_back(pkgTagSection::Tag::Remove("Description-md5"));
    RW.push_back(pkgTagSection::Tag::Remove("Description-md5"));
    // improve
    // improve
+   RW.push_back(pkgTagSection::Tag::Rewrite("Package", V.ParentPkg().FullName(true)));
    RW.push_back(pkgTagSection::Tag::Rewrite("Installed-Size", installed_size));
    RW.push_back(pkgTagSection::Tag::Rewrite("Installed-Size", installed_size));
    RW.push_back(pkgTagSection::Tag::Remove("Size"));
    RW.push_back(pkgTagSection::Tag::Remove("Size"));
    RW.push_back(pkgTagSection::Tag::Rewrite("Download-Size", package_size));
    RW.push_back(pkgTagSection::Tag::Rewrite("Download-Size", package_size));

+ 26 - 9
test/integration/test-apt-cli-show

@@ -5,17 +5,12 @@ TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 . $TESTDIR/framework
 
 
 setupenvironment
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386' 'amd64'
 
 
-if [ ! -x ${BUILDDIRECTORY}/apt ]; then
-    msgmsg "No ${BUILDDIRECTORY}/apt"
-    msgskip 
-    exit 0
-fi
-
-DESCR='Some description 
+DESCR='Some description
  That has multiple lines'
  That has multiple lines'
 insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
 insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR"
 insertinstalledpackage 'foo' 'all' '1.0'
 insertinstalledpackage 'foo' 'all' '1.0'
 
 
 setupaptarchive
 setupaptarchive
@@ -33,9 +28,31 @@ Installed-Size: 43.0 kB
 Download-Size: unknown
 Download-Size: unknown
 APT-Manual-Installed: yes
 APT-Manual-Installed: yes
 APT-Sources: file:$APTARCHIVE unstable/main all Packages
 APT-Sources: file:$APTARCHIVE unstable/main all Packages
-Description: Some description 
+Description: Some description
  That has multiple lines
  That has multiple lines
 " apt show foo
 " apt show foo
+testsuccessequal "Package: bar
+Version: 1
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main i386 Packages
+Description: Some description
+ That has multiple lines
+" apt show bar
+testsuccessequal "Package: bar:amd64
+Version: 1
+Priority: optional
+Section: other
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 43.0 kB
+Download-Size: unknown
+APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages
+Description: Some description
+ That has multiple lines
+" apt show bar:amd64
 
 
 # this is the default, but disabled by the testcases
 # this is the default, but disabled by the testcases
 testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
 testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0