implement rpm ghc-pkg hash metadata for precise automatic library dependency tracking
- add buildroot/ghcpkgbasedir to ghc-deps.sh args - calculate package and metadata by checking all library files in stdin - prof depends on devel, devel on base - update macros.ghc: - rename ghc_requires to ghc_devel_requires - drop ghc_doc_requires - ghc_reindex_haddock is deprecated and now a no-op
This commit is contained in:
parent
02c69a3bd2
commit
7232a81da9
6
AUTHORS
6
AUTHORS
@ -1,3 +1,7 @@
|
||||
Maintainer:
|
||||
Jens Petersen <petersen@redhat.com>
|
||||
|
||||
Initial implementation:
|
||||
Bryan O'Sullivan
|
||||
Jens Petersen
|
||||
Yaakov Nemoy
|
||||
Yaakov Nemoy
|
||||
|
55
ghc-deps.sh
55
ghc-deps.sh
@ -1,35 +1,50 @@
|
||||
#!/bin/sh
|
||||
# find rpm provides and requires for Haskell GHC libraries
|
||||
|
||||
#set -x
|
||||
|
||||
# To use add the following lines to spec file:
|
||||
# %define _use_internal_dependency_generator 0
|
||||
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires
|
||||
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides
|
||||
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}
|
||||
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}
|
||||
|
||||
[ $# -ne 1 ] && echo "Usage: `basename $0` [--provides|--requires]" && exit 1
|
||||
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}" && exit 1
|
||||
|
||||
MODE=$1
|
||||
|
||||
case $MODE in
|
||||
--provides) FIELD=id ;;
|
||||
--requires) FIELD=depends
|
||||
esac
|
||||
PKGBASEDIR=$2
|
||||
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
||||
|
||||
files=$(cat)
|
||||
|
||||
PKGCONF=$(echo $files | tr [:blank:] '\n' | grep package.conf.d)
|
||||
#set -x
|
||||
|
||||
if [ -n "$PKGCONF" ]; then
|
||||
CONFDIR=$(dirname $PKGCONF)
|
||||
PKGS=$(ghc-pkg -f $CONFDIR describe '*' | awk '/^name: / {print $2}')
|
||||
for pkg in $PKGS; do
|
||||
HASHS=$(ghc-pkg -f $CONFDIR field $pkg $FIELD | sed -e "s/^$FIELD: \+//")
|
||||
for i in $HASHS; do
|
||||
echo "ghc($i)"
|
||||
done
|
||||
done
|
||||
if [ -d "$PKGCONFDIR" ]; then
|
||||
for i in $files; do
|
||||
LIB_FILE=$(echo $i | grep /libHS | grep -v /libHSrts)
|
||||
if [ -n "$LIB_FILE" ]; then
|
||||
case $LIB_FILE in
|
||||
*.so) META=ghc ;;
|
||||
*_p.a) META=ghc-prof SELF=ghc-devel ;;
|
||||
*.a) META=ghc-devel SELF=ghc ;;
|
||||
esac
|
||||
if [ -n "$META" ]; then
|
||||
case $MODE in
|
||||
--provides) FIELD=id ;;
|
||||
--requires) FIELD=depends ;;
|
||||
*) echo "`basename $0`: Need --provides or --requires" ; exit 1
|
||||
esac
|
||||
PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/*\([^/]\+\)/libHS.*%\1%")
|
||||
HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
|
||||
for i in $HASHS; do
|
||||
echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/"
|
||||
done
|
||||
if [ "$MODE" = "--requires" -a -n "$SELF" ]; then
|
||||
HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
|
||||
for i in $HASHS; do
|
||||
echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE
|
||||
|
@ -60,21 +60,12 @@ mkdir -p $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d \
|
||||
install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d
|
||||
|
||||
# devel pkg basic requires
|
||||
%ghc_requires Requires: ghc = %{ghc_version}\
|
||||
Requires(post): ghc = %{ghc_version}\
|
||||
Requires(postun): ghc = %{ghc_version}\
|
||||
%if 0%{!?without_shared:1}\
|
||||
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
|
||||
%endif
|
||||
|
||||
# doc pkg basic requires
|
||||
%ghc_doc_requires Requires: ghc-doc = %{ghc_version}\
|
||||
Requires(post): ghc-doc = %{ghc_version}\
|
||||
Requires(postun): ghc-doc = %{ghc_version}
|
||||
%ghc_devel_requires Requires(post): ghc = %{ghc_version}\
|
||||
Requires(postun): ghc = %{ghc_version}
|
||||
|
||||
# prof pkg basic requires
|
||||
%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\
|
||||
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release}
|
||||
%ghc_prof_requires \
|
||||
%{nil}
|
||||
|
||||
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
|
||||
%ghc_lib_package(n:c:h:o:)\
|
||||
@ -112,13 +103,14 @@ This package provides the shared library.\
|
||||
%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
|
||||
|
||||
# for docs post and postun
|
||||
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
|
||||
%ghc_reindex_haddock\
|
||||
%{nil}
|
||||
|
||||
# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
|
||||
%ghc_package_devel(n:c:h:l:v:o:)\
|
||||
%global _use_internal_dependency_generator 0\
|
||||
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides\
|
||||
#%%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires\
|
||||
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}\
|
||||
%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}\
|
||||
%global debug_package %{nil}\
|
||||
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
||||
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
||||
@ -127,8 +119,7 @@ Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library}
|
||||
Group: Development/Libraries\
|
||||
%{-v:Version: %{-v*}}\
|
||||
%{-l:License: %{-l*}}\
|
||||
%{?ghc_requires}\
|
||||
%{?ghc_doc_requires}\
|
||||
%{?ghc_devel_requires}\
|
||||
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
|
||||
%{-h:Requires: %{-h*}}\
|
||||
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
|
||||
|
@ -1,5 +1,5 @@
|
||||
Name: ghc-rpm-macros
|
||||
Version: 0.9.1
|
||||
Version: 0.10.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Macros for building packages for GHC
|
||||
|
||||
@ -53,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Nov 22 2010 Jens Petersen <petersen@redhat.com> - 0.10.0-1
|
||||
- turn pkg hash metadata (for ghc-7 builds)
|
||||
|
||||
* Thu Sep 30 2010 Jens Petersen <petersen@redhat.com> - 0.9.1-1
|
||||
- fix without_shared build so it actually works
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user