# generated by cabal-rpm-2.3.3 --stream nightly --bundle # https://docs.fedoraproject.org/en-US/packaging-guidelines/Haskell/ %global comfortgraph comfort-graph-0.0.5.1 %global nonempty non-empty-0.3.6.1 %global shellutility shell-utility-0.1 %global subpkgs %{nonempty} %{comfortgraph} %{shellutility} Name: cabal-sort Version: 0.1.2.1 Release: 1%{?dist} Summary: Topologically sort cabal packages License: BSD-3-Clause URL: https://hackage.haskell.org/package/cabal-sort # Begin cabal-rpm sources: Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz Source1: https://hackage.haskell.org/package/%{comfortgraph}/%{comfortgraph}.tar.gz Source2: https://hackage.haskell.org/package/%{nonempty}/%{nonempty}.tar.gz Source3: https://hackage.haskell.org/package/%{shellutility}/%{shellutility}.tar.gz Source4: https://hackage.haskell.org/package/%{name}-%{version}/%{name}.cabal#/%{name}-%{version}.cabal # End cabal-rpm sources # Begin cabal-rpm deps: BuildRequires: ghc-rpm-macros-extra BuildRequires: ghc-Cabal-devel BuildRequires: ghc-base-devel BuildRequires: ghc-bytestring-devel #BuildRequires: ghc-comfort-graph-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-directory-devel BuildRequires: ghc-explicit-exception-devel BuildRequires: ghc-filepath-devel #BuildRequires: ghc-non-empty-devel BuildRequires: ghc-optparse-applicative-devel BuildRequires: ghc-process-devel #BuildRequires: ghc-shell-utility-devel BuildRequires: ghc-transformers-devel BuildRequires: ghc-utility-ht-devel BuildRequires: help2man # for missing dep 'comfort-graph': BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-semigroups-devel # for missing dep 'non-empty': BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-deepseq-devel BuildRequires: ghc-semigroups-devel # End cabal-rpm deps %description If you have a bunch of packages you may want to compile or recompile, then you need an order of compilation that meets the dependencies. Given a number of cabal package files, this program reads all those files and emits them topologically sorted according to their dependencies. This way you can compile many packages at once, say if a very low-level package has changed. For compiling a couple of packages from their local darcs repositories in the right order, you may run something like > for dir in `find . -name "*.cabal" | fgrep -v _darcs | xargs cabal-sort --info=dir`; do (cd $dir && cabal install); done Note that cabal-install does this automatically since version 0.10 when you call it will multiple directory names as arguments. However, when the constraint solver in cabal-install fails you may still use cabal-sort for an automated build. For uploading a set of packages to Hackage in the right order you may run > for dir in `find . -name "*.cabal" | fgrep -v _darcs | xargs cabal-sort --info=dir`; do (cd $dir && rm dist/*.tar.gz && cabal sdist && cabal upload dist/*.tar.gz); done Sometimes you have to inspect a number of packages manually, e.g. in order to adapt your packages to a new GHC version. In this case I found it useful to run > for dir in `find . -name "*.cabal" | fgrep -v _darcs | xargs cabal-sort --info=dir`; do (cd $dir; bash); done This way you start a local shell for every package. Then you can easily access commands in the shell history that you already run for previous packages, e.g. 'editor *.cabal'. After you finished a package, you switch to the next package simply by leaving the shell by calling 'exit'. Problem 1: Given packages A, B, C, where C depends on B and B depends on A, and you call > cabal-sort C.cabal A.cabal then the emitted order of packages may be wrong, because cabal-sort does not get to know the dependency of C on B. Even if the order is correct, B.cabal is missing in the output and thus the list of cabal files cannot immediately be used for a sequence of cabal-install runs. Problem 2: We ignore flags and merge all dependencies. This may lead to dependency cycles that cannot occur for any flag assignment. You also have options '--parallel' and '--makefile' that support parallel compilation. The first option is for manual parallelization and the second one allows you to compile parallelly using 'make''s '-j'/'--jobs' option. There is a second program called 'ghc-pkg-dep' that finds recursively all packages that a set of packages depends on. Duplicates are eliminated and the packages are given topologically sorted, such that you can use this for recompilation of the packages. The packages must already be registered with 'ghc-pkg'. > ghc-pkg-dep pkgA-0.1 pkgB-2.3 pkgC-0.1.2 On GHC versions before 7.0 ghc-pkg runs quite slowly. In order to not get bored you may run the program with '--verbose=2' option. Related packages: 'rpmbuild-order'. %prep # Begin cabal-rpm setup: %setup -q -a1 -a2 -a3 cp -bp %{SOURCE4} %{name}.cabal # End cabal-rpm setup %build # Begin cabal-rpm build: %ghc_libs_build -P -H %{subpkgs} %ghc_bin_build # End cabal-rpm build %install # Begin cabal-rpm install %ghc_bin_install set noclobber mkdir -p %{buildroot}%{bash_completions_dir} mkdir -p %{buildroot}%{fish_completions_dir} mkdir -p %{buildroot}%{zsh_completions_dir} %{buildroot}%{_bindir}/%{name} --bash-completion-script %{name} | sed s/filenames/default/ > %{buildroot}%{bash_completions_dir}/%{name} %{buildroot}%{_bindir}/%{name} --fish-completion-script %{name} > %{buildroot}%{fish_completions_dir}/%{name} %{buildroot}%{_bindir}/%{name} --zsh-completion-script %{name} | sed s/filenames/default/ > %{buildroot}%{zsh_completions_dir}/_%{name} %{buildroot}%{_bindir}/ghc-pkg-dep --bash-completion-script ghc-pkg-dep | sed s/filenames/default/ > %{buildroot}%{bash_completions_dir}/ghc-pkg-dep %{buildroot}%{_bindir}/ghc-pkg-dep --fish-completion-script ghc-pkg-dep > %{buildroot}%{fish_completions_dir}/ghc-pkg-dep %{buildroot}%{_bindir}/ghc-pkg-dep --zsh-completion-script ghc-pkg-dep | sed s/filenames/default/ > %{buildroot}%{zsh_completions_dir}/_ghc-pkg-dep mkdir -p %{buildroot}%{_mandir}/man1/ help2man --no-info --version-string=%{version} %{buildroot}%{_bindir}/%{name} > %{buildroot}%{_mandir}/man1/%{name}.1 help2man --no-info --version-string=%{version} %{buildroot}%{_bindir}/ghc-pkg-dep > %{buildroot}%{_mandir}/man1/ghc-pkg-dep.1 # End cabal-rpm install %files # Begin cabal-rpm files: %license LICENSE %{_bindir}/%{name} %{_bindir}/ghc-pkg-dep %{bash_completions_dir}/%{name} %{bash_completions_dir}/ghc-pkg-dep %{fish_completions_dir}/%{name} %{fish_completions_dir}/ghc-pkg-dep %{zsh_completions_dir}/_%{name} %{zsh_completions_dir}/_ghc-pkg-dep %{_mandir}/man1/%{name}.1* %{_mandir}/man1/ghc-pkg-dep.1* # End cabal-rpm files %changelog * Sat Jun 6 2026 Jens Petersen - 0.1.2.1-1 - spec file generated by cabal-rpm-2.3.3