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
4
AUTHORS
4
AUTHORS
@ -1,3 +1,7 @@
|
|||||||
|
Maintainer:
|
||||||
|
Jens Petersen <petersen@redhat.com>
|
||||||
|
|
||||||
|
Initial implementation:
|
||||||
Bryan O'Sullivan
|
Bryan O'Sullivan
|
||||||
Jens Petersen
|
Jens Petersen
|
||||||
Yaakov Nemoy
|
Yaakov Nemoy
|
49
ghc-deps.sh
49
ghc-deps.sh
@ -1,34 +1,49 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# find rpm provides and requires for Haskell GHC libraries
|
# find rpm provides and requires for Haskell GHC libraries
|
||||||
|
|
||||||
#set -x
|
|
||||||
|
|
||||||
# To use add the following lines to spec file:
|
# To use add the following lines to spec file:
|
||||||
# %define _use_internal_dependency_generator 0
|
# %define _use_internal_dependency_generator 0
|
||||||
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires
|
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}
|
||||||
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides
|
# %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
|
MODE=$1
|
||||||
|
PKGBASEDIR=$2
|
||||||
case $MODE in
|
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
||||||
--provides) FIELD=id ;;
|
|
||||||
--requires) FIELD=depends
|
|
||||||
esac
|
|
||||||
|
|
||||||
files=$(cat)
|
files=$(cat)
|
||||||
|
|
||||||
PKGCONF=$(echo $files | tr [:blank:] '\n' | grep package.conf.d)
|
#set -x
|
||||||
|
|
||||||
if [ -n "$PKGCONF" ]; then
|
if [ -d "$PKGCONFDIR" ]; then
|
||||||
CONFDIR=$(dirname $PKGCONF)
|
for i in $files; do
|
||||||
PKGS=$(ghc-pkg -f $CONFDIR describe '*' | awk '/^name: / {print $2}')
|
LIB_FILE=$(echo $i | grep /libHS | grep -v /libHSrts)
|
||||||
for pkg in $PKGS; do
|
if [ -n "$LIB_FILE" ]; then
|
||||||
HASHS=$(ghc-pkg -f $CONFDIR field $pkg $FIELD | sed -e "s/^$FIELD: \+//")
|
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
|
for i in $HASHS; do
|
||||||
echo "ghc($i)"
|
echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/"
|
||||||
done
|
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
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -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
|
install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d
|
||||||
|
|
||||||
# devel pkg basic requires
|
# devel pkg basic requires
|
||||||
%ghc_requires Requires: ghc = %{ghc_version}\
|
%ghc_devel_requires Requires(post): ghc = %{ghc_version}\
|
||||||
Requires(post): ghc = %{ghc_version}\
|
Requires(postun): 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}
|
|
||||||
|
|
||||||
# prof pkg basic requires
|
# prof pkg basic requires
|
||||||
%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\
|
%ghc_prof_requires \
|
||||||
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release}
|
%{nil}
|
||||||
|
|
||||||
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
|
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
|
||||||
%ghc_lib_package(n:c:h:o:)\
|
%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 || :
|
%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
|
||||||
|
|
||||||
# for docs post and postun
|
# 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 pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
|
||||||
%ghc_package_devel(n:c:h:l:v:o:)\
|
%ghc_package_devel(n:c:h:l:v:o:)\
|
||||||
%global _use_internal_dependency_generator 0\
|
%global _use_internal_dependency_generator 0\
|
||||||
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides\
|
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}\
|
||||||
#%%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires\
|
%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}\
|
||||||
%global debug_package %{nil}\
|
%global debug_package %{nil}\
|
||||||
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
||||||
%define ghc_pkg_name ghc-%{local_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\
|
Group: Development/Libraries\
|
||||||
%{-v:Version: %{-v*}}\
|
%{-v:Version: %{-v*}}\
|
||||||
%{-l:License: %{-l*}}\
|
%{-l:License: %{-l*}}\
|
||||||
%{?ghc_requires}\
|
%{?ghc_devel_requires}\
|
||||||
%{?ghc_doc_requires}\
|
|
||||||
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
|
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
|
||||||
%{-h:Requires: %{-h*}}\
|
%{-h:Requires: %{-h*}}\
|
||||||
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
|
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Name: ghc-rpm-macros
|
Name: ghc-rpm-macros
|
||||||
Version: 0.9.1
|
Version: 0.10.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Macros for building packages for GHC
|
Summary: Macros for building packages for GHC
|
||||||
|
|
||||||
@ -53,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%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
|
* Thu Sep 30 2010 Jens Petersen <petersen@redhat.com> - 0.9.1-1
|
||||||
- fix without_shared build so it actually works
|
- fix without_shared build so it actually works
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user