[PATCH setup 10/11] Don't show source-only packages in package list

Jon Turney jon.turney@dronecode.org.uk
Fri Apr 28 12:13:00 GMT 2017


external-source: packages which have no binary package will be marked skip:
and so won't show up in setup.ini at all.

If we change to using the Source: line to identify a source package, which
is (by definition) source only, these will appear in setup.ini, but without
any install: lines, so we need to explcitly avoid showing them in the
package list.

Future work: perhaps add another view to show just source packages?
---
 PickView.cc     |  3 +++
 package_meta.cc | 12 ++++++++++++
 package_meta.h  |  2 ++
 3 files changed, 17 insertions(+)

diff --git a/PickView.cc b/PickView.cc
index 1ba55e8..b3b1c1a 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -165,6 +165,9 @@ PickView::setViewMode (views mode)
         {
           packagemeta & pkg = *(i->second);
 
+          if (!pkg.isBinary())
+            continue;
+
           if ( // "Full" : everything
               (view_mode == PickView::views::PackageFull)
 
diff --git a/package_meta.cc b/package_meta.cc
index 0f97f1d..24ed17e 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -537,6 +537,18 @@ packagemeta::sourceAccessible () const
       if (bin.sourcePackage().accessible())
         return true;
     }
+
+  return false;
+}
+
+bool
+packagemeta::isBinary () const
+{
+  for (set<packageversion>::iterator i=versions.begin();
+       i != versions.end(); ++i)
+    if ((i->Type() == package_binary) && i->accessible())
+      return true;
+
   return false;
 }
 
diff --git a/package_meta.h b/package_meta.h
index 9bf8336..5f7842c 100644
--- a/package_meta.h
+++ b/package_meta.h
@@ -142,6 +142,8 @@ public:
   bool accessible () const;
   bool sourceAccessible() const;
 
+  bool isBinary() const;
+
   void logSelectionStatus() const;
   void logAllVersions() const;
 
-- 
2.12.2



More information about the Cygwin-apps mailing list