[Git][haskell-team/haskell-devscripts][master] Check if package is private, instead of not exposed

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Thu Mar 12 21:03:16 GMT 2026



Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / haskell-devscripts


Commits:
7443f66a by Ilias Tsitsimpis at 2026-03-12T22:57:16+02:00
Check if package is private, instead of not exposed

When trying to determine if a package comes from a private library, we
checked whether the package is exposed or not. This works, since most of
the time internal packages are not exposed, but it's the wrong check,
and fails for e.g., the ghc package, which is not exposed by default.

The exposed field is strictly a GHC concept. It controls whether the
package's modules are brought into scope by default when we invoke raw
ghc or ghci without specifying explicit package flags.

The visibility field determines whether a library can be depended upon
by other external Cabal packages. It can be set to either public or
private. This field describes whether a library is internal or not.

- - - - -


3 changed files:

- debian/changelog
- dh_haskell_provides_ghc
- lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-devscripts (0.16.49) unstable; urgency=medium
+
+  * Exclude packages that are private, instead of not exposed
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Thu, 12 Mar 2026 22:57:12 +0200
+
 haskell-devscripts (0.16.48) unstable; urgency=medium
 
   * Drop depends on cdbs (Closes: #1125188)


=====================================
dh_haskell_provides_ghc
=====================================
@@ -39,7 +39,7 @@ use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
   load_ghc_database
   hashed_id_to_virtual_installable
   config_to_package_id
-  is_package_exposed
+  is_package_private
 );
 use Debian::Debhelper::Dh_Lib;
 
@@ -84,10 +84,10 @@ for my $installable (@{ $dh{DOPACKAGES} }) {
     for my $config (@configs) {
         my $package_id = config_to_package_id($config, $ghc_pkg, $ENV{DEB_GHC_DATABASE});
 
-        # Exclude packages that are not exposed.
-        my $exposed = is_package_exposed($package_id, $ghc_pkg, $ENV{DEB_GHC_DATABASE});
+        # Exclude packages that are private (internal libraries).
+        my $private = is_package_private($package_id, $ghc_pkg, $ENV{DEB_GHC_DATABASE});
         next
-            if !$exposed;
+            if $private;
 
         push(@hashed_ids, $package_id);
     }


=====================================
lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
=====================================
@@ -46,7 +46,7 @@ BEGIN {
       hashed_id_to_virtual_installable
       config_to_package_id
       config_to_package_name_version
-      is_package_exposed
+      is_package_private
       init_hs_env
       clean_recipe
       make_setup_recipe
@@ -571,14 +571,14 @@ sub config_to_package_name_version {
 
 =cut
 
-sub is_package_exposed {
+sub is_package_private {
     my ($package_id, $ghc_pkg, $package_db) = @_;
 
-    my $exposed
+    my $visibility
         = run_quiet($ghc_pkg, '--package-db', $package_db, 'field',
-                    '--unit-id', '--simple-output', $package_id, 'exposed');
+                    '--unit-id', '--simple-output', $package_id, 'visibility');
     return 1
-        if $exposed eq 'True';
+        if $visibility eq 'private';
 
     return 0;
 }



View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/commit/7443f66a61511650323c0aa5850e7b0a09ab3953

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/commit/7443f66a61511650323c0aa5850e7b0a09ab3953
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20260312/c8c4d1e4/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list