Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-06 Thread Alexis Ballier
On Thu, 4 Jan 2018 10:35:23 -0500
Mike Gilbert  wrote:

> On Thu, Jan 4, 2018 at 5:23 AM, Pacho Ramos  wrote:
> > I have seen this is only used by:
> > app-arch/xz-utils
> > dev-libs/gmp
> > dev-libs/libpcre
> > dev-libs/mpc
> > dev-libs/mpfr
> > net-nds/openldap
> > sys-libs/gdbm
> > sys-libs/ncurses
> > sys-libs/readline
> > sys-process/audit
> >
> > Maybe we could deprecate it and try to drop it in the future :/
> >  
> 
> As Soap touched on earlier, this should probably not be
> deprecated/removed until a solution compatible with Paludis and
> pkgcore is implemented.
> 
> A couple of options for that:
> 
> 1. Add functionality similar to preserve-libs to these alternate
> package managers. This is unlikely to happen.

IMHO having profiles mandate a preserve-libs behavior (and thus PMS
define this) for a few select packages (the ones above) is the way to go
here: preserve-libs is evil but really the least evil in this case.
If you miss the warning from the eclass, you can very easily end up
with binaries loading the two versions of the library; preserve-libs
has the advantage that portage is very loud about this.



Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread Michał Górny
W dniu czw, 04.01.2018 o godzinie 19∶22 +0100, użytkownik Ulrich Mueller
napisał:
> > > > > > On Thu, 4 Jan 2018, Mike Gilbert wrote:
> > On Thu, Jan 4, 2018 at 5:23 AM, Pacho Ramos  wrote:
> > > I have seen this is only used by:
> > > app-arch/xz-utils
> > > dev-libs/gmp
> > > dev-libs/libpcre
> > > dev-libs/mpc
> > > dev-libs/mpfr
> > > net-nds/openldap
> > > sys-libs/gdbm
> > > sys-libs/ncurses
> > > sys-libs/readline
> > > sys-process/audit
> > > 
> > > Maybe we could deprecate it and try to drop it in the future :/
> > As Soap touched on earlier, this should probably not be
> > deprecated/removed until a solution compatible with Paludis and
> > pkgcore is implemented.
> > A couple of options for that:
> > 1. Add functionality similar to preserve-libs to these alternate
> > package managers. This is unlikely to happen.
> 
> There may also be Portage users without preserve-libs in FEATURES.
> 
> > 2. Slot the libraries so that the old versions may remain installed
> > in a PMS-compatible way. This is often a pain to actually implement.
> 
> I don't think that this would fly. You'd have to split packages like
> xz-utils which install binaries, otherwise there would be collisions
> between slots.
> 

See: sys-libs/ncurses, except for the random in-place 5->0 SLOT change
that caused a lot of mayhem.


-- 
Best regards,
Michał Górny




Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread Ulrich Mueller
> On Thu, 4 Jan 2018, Mike Gilbert wrote:

> On Thu, Jan 4, 2018 at 5:23 AM, Pacho Ramos  wrote:
>> I have seen this is only used by:
>> app-arch/xz-utils
>> dev-libs/gmp
>> dev-libs/libpcre
>> dev-libs/mpc
>> dev-libs/mpfr
>> net-nds/openldap
>> sys-libs/gdbm
>> sys-libs/ncurses
>> sys-libs/readline
>> sys-process/audit
>> 
>> Maybe we could deprecate it and try to drop it in the future :/

> As Soap touched on earlier, this should probably not be
> deprecated/removed until a solution compatible with Paludis and
> pkgcore is implemented.

> A couple of options for that:

> 1. Add functionality similar to preserve-libs to these alternate
> package managers. This is unlikely to happen.

There may also be Portage users without preserve-libs in FEATURES.

> 2. Slot the libraries so that the old versions may remain installed
> in a PMS-compatible way. This is often a pain to actually implement.

I don't think that this would fly. You'd have to split packages like
xz-utils which install binaries, otherwise there would be collisions
between slots.

> If neither of these things happens, keeping the preserve_old_lib
> calls in place is an ugly, but workable solution.

+1

Also note that the eclass functions act as no-ops when they find
preserve-libs in FEATURES.

Ulrich


pgpozZolCTZZ7.pgp
Description: PGP signature


Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread Ulrich Mueller
> On Thu, 4 Jan 2018, M J Everitt wrote:

> On 04/01/18 11:21, David Seifert wrote:
>> Never mind that this has 0 to do with EAPI3/4 or with newer EAPI
>> 'features' and is all about the fact that FEATURES=preserve-libs is
>> only implemented in Portage, without comparable functionality in
>> paludis or pkgcore.
>>
>> When you don't know why the function exists, prefer not to give
>> advice on how to proceed.

David's answer is factually correct.

> Oh I -am- sorry .. did I piss in your cornflakes too? XD

> 

Do you always react like this, when someone simply points out that you
were wrong? IMHO this is completely out of line.

Ulrich


pgpy_tVawr7Hl.pgp
Description: PGP signature


Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread M. J. Everitt
On 04/01/18 11:36, M. J. Everitt wrote:
> On 04/01/18 11:21, David Seifert wrote:
>> On Thu, 2018-01-04 at 10:43 +, M. J. Everitt wrote:
>>> On 04/01/18 10:23, Pacho Ramos wrote:
 El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió:
> Split off functions preserve_old_lib and preserve_old_lib_notify
> from
> eutils.eclass into a dedicated preserve-libs.eclass. These
> functions
> are rarely used and are independent of the rest of eutils,
> therefore
> moving them into their own eclass will help clarifying eclass
> inheritance in ebuilds.
>
> For backwards compatibility, eutils inherits the new eclass in
> existing EAPIs.
> ---
>  eclass/eutils.eclass| 65 ++-
> 
>  eclass/preserve-libs.eclass | 74
> +
>  2 files changed, 76 insertions(+), 63 deletions(-)
>  create mode 100644 eclass/preserve-libs.eclass
>
> diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
> index 7d4193e76b51..91d329e99c9e 100644
> --- a/eclass/eutils.eclass
> +++ b/eclass/eutils.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2017 Gentoo Foundation
> +# Copyright 1999-2018 Gentoo Foundation
>  # Distributed under the terms of the GNU General Public License
> v2
>  
>  # @ECLASS: eutils.eclass
> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
>  # implicitly inherited (now split) eclasses
>  case ${EAPI:-0} in
>  0|1|2|3|4|5|6)
> - inherit desktop epatch estack ltprune multilib
> toolchain-funcs
> + inherit desktop epatch estack ltprune multilib preserve-
> libs
> toolchain-funcs
>   ;;
>  esac
>  
> @@ -172,67 +172,6 @@ _eutils_eprefix_init() {
>   has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=}
> ${EROOT:=${ROOT}}
>  }
>  
> -# @FUNCTION: preserve_old_lib
> -# @USAGE:  [more libs]
> -# @DESCRIPTION:
> -# These functions are useful when a lib in your package changes
> ABI SONAME.
> -# An example might be from libogg.so.0 to libogg.so.1.  Removing
> libogg.so.0
> -# would break packages that link against it.  Most people get
> around this
> -# by using the portage SLOT mechanism, but that is not always a
> relevant
> -# solution, so instead you can call this from pkg_preinst.  See
> also the
> -# preserve_old_lib_notify function.
> -preserve_old_lib() {
> - _eutils_eprefix_init
> - if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
> - eerror "preserve_old_lib() must be called from
> pkg_preinst()
> only"
> - die "Invalid preserve_old_lib() usage"
> - fi
> - [[ -z $1 ]] && die "Usage: preserve_old_lib  preserve>
> [more libraries to preserve]"
> -
> - # let portage worry about it
> - has preserve-libs ${FEATURES} && return 0
> -
> - local lib dir
> - for lib in "$@" ; do
> - [[ -e ${EROOT}/${lib} ]] || continue
> - dir=${lib%/*}
> - dodir ${dir} || die "dodir ${dir} failed"
> - cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp
> ${lib} failed"
> - touch "${ED}"/${lib}
> - done
> -}
> -
> -# @FUNCTION: preserve_old_lib_notify
> -# @USAGE:  [more libs]
> -# @DESCRIPTION:
> -# Spit helpful messages about the libraries preserved by
> preserve_old_lib.
> -preserve_old_lib_notify() {
> - if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
> - eerror "preserve_old_lib_notify() must be called
> from
> pkg_postinst() only"
> - die "Invalid preserve_old_lib_notify() usage"
> - fi
> -
> - # let portage worry about it
> - has preserve-libs ${FEATURES} && return 0
> -
> - _eutils_eprefix_init
> -
> - local lib notice=0
> - for lib in "$@" ; do
> - [[ -e ${EROOT}/${lib} ]] || continue
> - if [[ ${notice} -eq 0 ]] ; then
> - notice=1
> - ewarn "Old versions of installed
> libraries were
> detected on your system."
> - ewarn "In order to avoid breaking
> packages that
> depend on these old libs,"
> - ewarn "the libraries are not being
> removed.  You need
> to run revdep-rebuild"
> - ewarn "in order to remove these old
> dependencies.  If
> you do not have this"
> - ewarn "helper program, simply emerge the
> 'gentoolkit'
> package."
> - ewarn
> - fi
> - ewarn "  # revdep-rebuild --library '${lib}' &&
> rm '${lib}'"
> - done
> -}
> -
>  # @FUNCTION: built_with_use
>  # @USAGE: [--hidden] [--missing ] [-a|-o] 
>  flags>
>  # @DESCRIPTION:
> diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-
> libs.eclass

Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread M. J. Everitt
On 04/01/18 11:21, David Seifert wrote:
> On Thu, 2018-01-04 at 10:43 +, M. J. Everitt wrote:
>> On 04/01/18 10:23, Pacho Ramos wrote:
>>> El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió:
 Split off functions preserve_old_lib and preserve_old_lib_notify
 from
 eutils.eclass into a dedicated preserve-libs.eclass. These
 functions
 are rarely used and are independent of the rest of eutils,
 therefore
 moving them into their own eclass will help clarifying eclass
 inheritance in ebuilds.

 For backwards compatibility, eutils inherits the new eclass in
 existing EAPIs.
 ---
  eclass/eutils.eclass| 65 ++-
 
  eclass/preserve-libs.eclass | 74
 +
  2 files changed, 76 insertions(+), 63 deletions(-)
  create mode 100644 eclass/preserve-libs.eclass

 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
 index 7d4193e76b51..91d329e99c9e 100644
 --- a/eclass/eutils.eclass
 +++ b/eclass/eutils.eclass
 @@ -1,4 +1,4 @@
 -# Copyright 1999-2017 Gentoo Foundation
 +# Copyright 1999-2018 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License
 v2
  
  # @ECLASS: eutils.eclass
 @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
  # implicitly inherited (now split) eclasses
  case ${EAPI:-0} in
  0|1|2|3|4|5|6)
 -  inherit desktop epatch estack ltprune multilib
 toolchain-funcs
 +  inherit desktop epatch estack ltprune multilib preserve-
 libs
 toolchain-funcs
;;
  esac
  
 @@ -172,67 +172,6 @@ _eutils_eprefix_init() {
has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=}
 ${EROOT:=${ROOT}}
  }
  
 -# @FUNCTION: preserve_old_lib
 -# @USAGE:  [more libs]
 -# @DESCRIPTION:
 -# These functions are useful when a lib in your package changes
 ABI SONAME.
 -# An example might be from libogg.so.0 to libogg.so.1.  Removing
 libogg.so.0
 -# would break packages that link against it.  Most people get
 around this
 -# by using the portage SLOT mechanism, but that is not always a
 relevant
 -# solution, so instead you can call this from pkg_preinst.  See
 also the
 -# preserve_old_lib_notify function.
 -preserve_old_lib() {
 -  _eutils_eprefix_init
 -  if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
 -  eerror "preserve_old_lib() must be called from
 pkg_preinst()
 only"
 -  die "Invalid preserve_old_lib() usage"
 -  fi
 -  [[ -z $1 ]] && die "Usage: preserve_old_lib >>> preserve>
 [more libraries to preserve]"
 -
 -  # let portage worry about it
 -  has preserve-libs ${FEATURES} && return 0
 -
 -  local lib dir
 -  for lib in "$@" ; do
 -  [[ -e ${EROOT}/${lib} ]] || continue
 -  dir=${lib%/*}
 -  dodir ${dir} || die "dodir ${dir} failed"
 -  cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp
 ${lib} failed"
 -  touch "${ED}"/${lib}
 -  done
 -}
 -
 -# @FUNCTION: preserve_old_lib_notify
 -# @USAGE:  [more libs]
 -# @DESCRIPTION:
 -# Spit helpful messages about the libraries preserved by
 preserve_old_lib.
 -preserve_old_lib_notify() {
 -  if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
 -  eerror "preserve_old_lib_notify() must be called
 from
 pkg_postinst() only"
 -  die "Invalid preserve_old_lib_notify() usage"
 -  fi
 -
 -  # let portage worry about it
 -  has preserve-libs ${FEATURES} && return 0
 -
 -  _eutils_eprefix_init
 -
 -  local lib notice=0
 -  for lib in "$@" ; do
 -  [[ -e ${EROOT}/${lib} ]] || continue
 -  if [[ ${notice} -eq 0 ]] ; then
 -  notice=1
 -  ewarn "Old versions of installed
 libraries were
 detected on your system."
 -  ewarn "In order to avoid breaking
 packages that
 depend on these old libs,"
 -  ewarn "the libraries are not being
 removed.  You need
 to run revdep-rebuild"
 -  ewarn "in order to remove these old
 dependencies.  If
 you do not have this"
 -  ewarn "helper program, simply emerge the
 'gentoolkit'
 package."
 -  ewarn
 -  fi
 -  ewarn "  # revdep-rebuild --library '${lib}' &&
 rm '${lib}'"
 -  done
 -}
 -
  # @FUNCTION: built_with_use
  # @USAGE: [--hidden] [--missing ] [-a|-o] 
 >>> flags>
  # @DESCRIPTION:
 diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-
 libs.eclass
 new file mode 100644
 index ..548c6411fcf0
 --- /dev/null
 +++ b/eclass/preserve-libs.eclass
 @@ -0,0 +1,74 @@

Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread David Seifert
On Thu, 2018-01-04 at 10:43 +, M. J. Everitt wrote:
> On 04/01/18 10:23, Pacho Ramos wrote:
> > El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió:
> > > Split off functions preserve_old_lib and preserve_old_lib_notify
> > > from
> > > eutils.eclass into a dedicated preserve-libs.eclass. These
> > > functions
> > > are rarely used and are independent of the rest of eutils,
> > > therefore
> > > moving them into their own eclass will help clarifying eclass
> > > inheritance in ebuilds.
> > > 
> > > For backwards compatibility, eutils inherits the new eclass in
> > > existing EAPIs.
> > > ---
> > >  eclass/eutils.eclass| 65 ++-
> > > 
> > >  eclass/preserve-libs.eclass | 74
> > > +
> > >  2 files changed, 76 insertions(+), 63 deletions(-)
> > >  create mode 100644 eclass/preserve-libs.eclass
> > > 
> > > diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
> > > index 7d4193e76b51..91d329e99c9e 100644
> > > --- a/eclass/eutils.eclass
> > > +++ b/eclass/eutils.eclass
> > > @@ -1,4 +1,4 @@
> > > -# Copyright 1999-2017 Gentoo Foundation
> > > +# Copyright 1999-2018 Gentoo Foundation
> > >  # Distributed under the terms of the GNU General Public License
> > > v2
> > >  
> > >  # @ECLASS: eutils.eclass
> > > @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
> > >  # implicitly inherited (now split) eclasses
> > >  case ${EAPI:-0} in
> > >  0|1|2|3|4|5|6)
> > > - inherit desktop epatch estack ltprune multilib
> > > toolchain-funcs
> > > + inherit desktop epatch estack ltprune multilib preserve-
> > > libs
> > > toolchain-funcs
> > >   ;;
> > >  esac
> > >  
> > > @@ -172,67 +172,6 @@ _eutils_eprefix_init() {
> > >   has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=}
> > > ${EROOT:=${ROOT}}
> > >  }
> > >  
> > > -# @FUNCTION: preserve_old_lib
> > > -# @USAGE:  [more libs]
> > > -# @DESCRIPTION:
> > > -# These functions are useful when a lib in your package changes
> > > ABI SONAME.
> > > -# An example might be from libogg.so.0 to libogg.so.1.  Removing
> > > libogg.so.0
> > > -# would break packages that link against it.  Most people get
> > > around this
> > > -# by using the portage SLOT mechanism, but that is not always a
> > > relevant
> > > -# solution, so instead you can call this from pkg_preinst.  See
> > > also the
> > > -# preserve_old_lib_notify function.
> > > -preserve_old_lib() {
> > > - _eutils_eprefix_init
> > > - if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
> > > - eerror "preserve_old_lib() must be called from
> > > pkg_preinst()
> > > only"
> > > - die "Invalid preserve_old_lib() usage"
> > > - fi
> > > - [[ -z $1 ]] && die "Usage: preserve_old_lib  > > preserve>
> > > [more libraries to preserve]"
> > > -
> > > - # let portage worry about it
> > > - has preserve-libs ${FEATURES} && return 0
> > > -
> > > - local lib dir
> > > - for lib in "$@" ; do
> > > - [[ -e ${EROOT}/${lib} ]] || continue
> > > - dir=${lib%/*}
> > > - dodir ${dir} || die "dodir ${dir} failed"
> > > - cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp
> > > ${lib} failed"
> > > - touch "${ED}"/${lib}
> > > - done
> > > -}
> > > -
> > > -# @FUNCTION: preserve_old_lib_notify
> > > -# @USAGE:  [more libs]
> > > -# @DESCRIPTION:
> > > -# Spit helpful messages about the libraries preserved by
> > > preserve_old_lib.
> > > -preserve_old_lib_notify() {
> > > - if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
> > > - eerror "preserve_old_lib_notify() must be called
> > > from
> > > pkg_postinst() only"
> > > - die "Invalid preserve_old_lib_notify() usage"
> > > - fi
> > > -
> > > - # let portage worry about it
> > > - has preserve-libs ${FEATURES} && return 0
> > > -
> > > - _eutils_eprefix_init
> > > -
> > > - local lib notice=0
> > > - for lib in "$@" ; do
> > > - [[ -e ${EROOT}/${lib} ]] || continue
> > > - if [[ ${notice} -eq 0 ]] ; then
> > > - notice=1
> > > - ewarn "Old versions of installed
> > > libraries were
> > > detected on your system."
> > > - ewarn "In order to avoid breaking
> > > packages that
> > > depend on these old libs,"
> > > - ewarn "the libraries are not being
> > > removed.  You need
> > > to run revdep-rebuild"
> > > - ewarn "in order to remove these old
> > > dependencies.  If
> > > you do not have this"
> > > - ewarn "helper program, simply emerge the
> > > 'gentoolkit'
> > > package."
> > > - ewarn
> > > - fi
> > > - ewarn "  # revdep-rebuild --library '${lib}' &&
> > > rm '${lib}'"
> > > - done
> > > -}
> > > -
> > >  # @FUNCTION: built_with_use
> > >  # @USAGE: [--hidden] [--missing ] [-a|-o] 
> > >  > > flags>
> > >  # @DESCRIPTION:
> > > diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-
> > > libs.eclass
> > > new file mode 100644
> > > index ..548c6411fcf0
> > > --- /dev/null
> 

Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread M. J. Everitt
On 04/01/18 10:23, Pacho Ramos wrote:
> El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió:
>> Split off functions preserve_old_lib and preserve_old_lib_notify from
>> eutils.eclass into a dedicated preserve-libs.eclass. These functions
>> are rarely used and are independent of the rest of eutils, therefore
>> moving them into their own eclass will help clarifying eclass
>> inheritance in ebuilds.
>>
>> For backwards compatibility, eutils inherits the new eclass in
>> existing EAPIs.
>> ---
>>  eclass/eutils.eclass| 65 ++-
>>  eclass/preserve-libs.eclass | 74
>> +
>>  2 files changed, 76 insertions(+), 63 deletions(-)
>>  create mode 100644 eclass/preserve-libs.eclass
>>
>> diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
>> index 7d4193e76b51..91d329e99c9e 100644
>> --- a/eclass/eutils.eclass
>> +++ b/eclass/eutils.eclass
>> @@ -1,4 +1,4 @@
>> -# Copyright 1999-2017 Gentoo Foundation
>> +# Copyright 1999-2018 Gentoo Foundation
>>  # Distributed under the terms of the GNU General Public License v2
>>  
>>  # @ECLASS: eutils.eclass
>> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
>>  # implicitly inherited (now split) eclasses
>>  case ${EAPI:-0} in
>>  0|1|2|3|4|5|6)
>> -inherit desktop epatch estack ltprune multilib toolchain-funcs
>> +inherit desktop epatch estack ltprune multilib preserve-libs
>> toolchain-funcs
>>  ;;
>>  esac
>>  
>> @@ -172,67 +172,6 @@ _eutils_eprefix_init() {
>>  has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=}
>> ${EROOT:=${ROOT}}
>>  }
>>  
>> -# @FUNCTION: preserve_old_lib
>> -# @USAGE:  [more libs]
>> -# @DESCRIPTION:
>> -# These functions are useful when a lib in your package changes ABI SONAME.
>> -# An example might be from libogg.so.0 to libogg.so.1.  Removing libogg.so.0
>> -# would break packages that link against it.  Most people get around this
>> -# by using the portage SLOT mechanism, but that is not always a relevant
>> -# solution, so instead you can call this from pkg_preinst.  See also the
>> -# preserve_old_lib_notify function.
>> -preserve_old_lib() {
>> -_eutils_eprefix_init
>> -if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
>> -eerror "preserve_old_lib() must be called from pkg_preinst()
>> only"
>> -die "Invalid preserve_old_lib() usage"
>> -fi
>> -[[ -z $1 ]] && die "Usage: preserve_old_lib 
>> [more libraries to preserve]"
>> -
>> -# let portage worry about it
>> -has preserve-libs ${FEATURES} && return 0
>> -
>> -local lib dir
>> -for lib in "$@" ; do
>> -[[ -e ${EROOT}/${lib} ]] || continue
>> -dir=${lib%/*}
>> -dodir ${dir} || die "dodir ${dir} failed"
>> -cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed"
>> -touch "${ED}"/${lib}
>> -done
>> -}
>> -
>> -# @FUNCTION: preserve_old_lib_notify
>> -# @USAGE:  [more libs]
>> -# @DESCRIPTION:
>> -# Spit helpful messages about the libraries preserved by preserve_old_lib.
>> -preserve_old_lib_notify() {
>> -if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
>> -eerror "preserve_old_lib_notify() must be called from
>> pkg_postinst() only"
>> -die "Invalid preserve_old_lib_notify() usage"
>> -fi
>> -
>> -# let portage worry about it
>> -has preserve-libs ${FEATURES} && return 0
>> -
>> -_eutils_eprefix_init
>> -
>> -local lib notice=0
>> -for lib in "$@" ; do
>> -[[ -e ${EROOT}/${lib} ]] || continue
>> -if [[ ${notice} -eq 0 ]] ; then
>> -notice=1
>> -ewarn "Old versions of installed libraries were
>> detected on your system."
>> -ewarn "In order to avoid breaking packages that
>> depend on these old libs,"
>> -ewarn "the libraries are not being removed.  You need
>> to run revdep-rebuild"
>> -ewarn "in order to remove these old dependencies.  If
>> you do not have this"
>> -ewarn "helper program, simply emerge the 'gentoolkit'
>> package."
>> -ewarn
>> -fi
>> -ewarn "  # revdep-rebuild --library '${lib}' && rm '${lib}'"
>> -done
>> -}
>> -
>>  # @FUNCTION: built_with_use
>>  # @USAGE: [--hidden] [--missing ] [-a|-o]  > flags>
>>  # @DESCRIPTION:
>> diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-libs.eclass
>> new file mode 100644
>> index ..548c6411fcf0
>> --- /dev/null
>> +++ b/eclass/preserve-libs.eclass
>> @@ -0,0 +1,74 @@
>> +# Copyright 1999-2018 Gentoo Foundation
>> +# Distributed under the terms of the GNU General Public License v2
>> +
>> +# @ECLASS: preserve-libs.eclass
>> +# @MAINTAINER:
>> +# base-sys...@gentoo.org
>> +# @BLURB: preserve libraries after SONAME changes
>> +
>> +if [[ -z ${_PRESERVE_LIBS_ECLASS} ]]; then
>> +_PRESERVE_LIBS_ECLASS=1
>> +
>> +# @FUNCTION: preserve_old_lib
>> +# @USAGE:  

Re: [gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-04 Thread Pacho Ramos
El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió:
> Split off functions preserve_old_lib and preserve_old_lib_notify from
> eutils.eclass into a dedicated preserve-libs.eclass. These functions
> are rarely used and are independent of the rest of eutils, therefore
> moving them into their own eclass will help clarifying eclass
> inheritance in ebuilds.
> 
> For backwards compatibility, eutils inherits the new eclass in
> existing EAPIs.
> ---
>  eclass/eutils.eclass| 65 ++-
>  eclass/preserve-libs.eclass | 74
> +
>  2 files changed, 76 insertions(+), 63 deletions(-)
>  create mode 100644 eclass/preserve-libs.eclass
> 
> diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
> index 7d4193e76b51..91d329e99c9e 100644
> --- a/eclass/eutils.eclass
> +++ b/eclass/eutils.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2017 Gentoo Foundation
> +# Copyright 1999-2018 Gentoo Foundation
>  # Distributed under the terms of the GNU General Public License v2
>  
>  # @ECLASS: eutils.eclass
> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
>  # implicitly inherited (now split) eclasses
>  case ${EAPI:-0} in
>  0|1|2|3|4|5|6)
> - inherit desktop epatch estack ltprune multilib toolchain-funcs
> + inherit desktop epatch estack ltprune multilib preserve-libs
> toolchain-funcs
>   ;;
>  esac
>  
> @@ -172,67 +172,6 @@ _eutils_eprefix_init() {
>   has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=}
> ${EROOT:=${ROOT}}
>  }
>  
> -# @FUNCTION: preserve_old_lib
> -# @USAGE:  [more libs]
> -# @DESCRIPTION:
> -# These functions are useful when a lib in your package changes ABI SONAME.
> -# An example might be from libogg.so.0 to libogg.so.1.  Removing libogg.so.0
> -# would break packages that link against it.  Most people get around this
> -# by using the portage SLOT mechanism, but that is not always a relevant
> -# solution, so instead you can call this from pkg_preinst.  See also the
> -# preserve_old_lib_notify function.
> -preserve_old_lib() {
> - _eutils_eprefix_init
> - if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
> - eerror "preserve_old_lib() must be called from pkg_preinst()
> only"
> - die "Invalid preserve_old_lib() usage"
> - fi
> - [[ -z $1 ]] && die "Usage: preserve_old_lib 
> [more libraries to preserve]"
> -
> - # let portage worry about it
> - has preserve-libs ${FEATURES} && return 0
> -
> - local lib dir
> - for lib in "$@" ; do
> - [[ -e ${EROOT}/${lib} ]] || continue
> - dir=${lib%/*}
> - dodir ${dir} || die "dodir ${dir} failed"
> - cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed"
> - touch "${ED}"/${lib}
> - done
> -}
> -
> -# @FUNCTION: preserve_old_lib_notify
> -# @USAGE:  [more libs]
> -# @DESCRIPTION:
> -# Spit helpful messages about the libraries preserved by preserve_old_lib.
> -preserve_old_lib_notify() {
> - if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
> - eerror "preserve_old_lib_notify() must be called from
> pkg_postinst() only"
> - die "Invalid preserve_old_lib_notify() usage"
> - fi
> -
> - # let portage worry about it
> - has preserve-libs ${FEATURES} && return 0
> -
> - _eutils_eprefix_init
> -
> - local lib notice=0
> - for lib in "$@" ; do
> - [[ -e ${EROOT}/${lib} ]] || continue
> - if [[ ${notice} -eq 0 ]] ; then
> - notice=1
> - ewarn "Old versions of installed libraries were
> detected on your system."
> - ewarn "In order to avoid breaking packages that
> depend on these old libs,"
> - ewarn "the libraries are not being removed.  You need
> to run revdep-rebuild"
> - ewarn "in order to remove these old dependencies.  If
> you do not have this"
> - ewarn "helper program, simply emerge the 'gentoolkit'
> package."
> - ewarn
> - fi
> - ewarn "  # revdep-rebuild --library '${lib}' && rm '${lib}'"
> - done
> -}
> -
>  # @FUNCTION: built_with_use
>  # @USAGE: [--hidden] [--missing ] [-a|-o]   flags>
>  # @DESCRIPTION:
> diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-libs.eclass
> new file mode 100644
> index ..548c6411fcf0
> --- /dev/null
> +++ b/eclass/preserve-libs.eclass
> @@ -0,0 +1,74 @@
> +# Copyright 1999-2018 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: preserve-libs.eclass
> +# @MAINTAINER:
> +# base-sys...@gentoo.org
> +# @BLURB: preserve libraries after SONAME changes
> +
> +if [[ -z ${_PRESERVE_LIBS_ECLASS} ]]; then
> +_PRESERVE_LIBS_ECLASS=1
> +
> +# @FUNCTION: preserve_old_lib
> +# @USAGE:  [more libs]
> +# @DESCRIPTION:
> +# These functions are useful when a lib in your package changes ABI SONAME.
> +# An example might 

[gentoo-dev] [PATCH 1/2] preserve-libs.eclass: Split off preserve_old_lib from eutils.

2018-01-03 Thread Ulrich Müller
Split off functions preserve_old_lib and preserve_old_lib_notify from
eutils.eclass into a dedicated preserve-libs.eclass. These functions
are rarely used and are independent of the rest of eutils, therefore
moving them into their own eclass will help clarifying eclass
inheritance in ebuilds.

For backwards compatibility, eutils inherits the new eclass in
existing EAPIs.
---
 eclass/eutils.eclass| 65 ++-
 eclass/preserve-libs.eclass | 74 +
 2 files changed, 76 insertions(+), 63 deletions(-)
 create mode 100644 eclass/preserve-libs.eclass

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 7d4193e76b51..91d329e99c9e 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: eutils.eclass
@@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
 # implicitly inherited (now split) eclasses
 case ${EAPI:-0} in
 0|1|2|3|4|5|6)
-   inherit desktop epatch estack ltprune multilib toolchain-funcs
+   inherit desktop epatch estack ltprune multilib preserve-libs 
toolchain-funcs
;;
 esac
 
@@ -172,67 +172,6 @@ _eutils_eprefix_init() {
has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
 }
 
-# @FUNCTION: preserve_old_lib
-# @USAGE:  [more libs]
-# @DESCRIPTION:
-# These functions are useful when a lib in your package changes ABI SONAME.
-# An example might be from libogg.so.0 to libogg.so.1.  Removing libogg.so.0
-# would break packages that link against it.  Most people get around this
-# by using the portage SLOT mechanism, but that is not always a relevant
-# solution, so instead you can call this from pkg_preinst.  See also the
-# preserve_old_lib_notify function.
-preserve_old_lib() {
-   _eutils_eprefix_init
-   if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
-   eerror "preserve_old_lib() must be called from pkg_preinst() 
only"
-   die "Invalid preserve_old_lib() usage"
-   fi
-   [[ -z $1 ]] && die "Usage: preserve_old_lib  [more 
libraries to preserve]"
-
-   # let portage worry about it
-   has preserve-libs ${FEATURES} && return 0
-
-   local lib dir
-   for lib in "$@" ; do
-   [[ -e ${EROOT}/${lib} ]] || continue
-   dir=${lib%/*}
-   dodir ${dir} || die "dodir ${dir} failed"
-   cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed"
-   touch "${ED}"/${lib}
-   done
-}
-
-# @FUNCTION: preserve_old_lib_notify
-# @USAGE:  [more libs]
-# @DESCRIPTION:
-# Spit helpful messages about the libraries preserved by preserve_old_lib.
-preserve_old_lib_notify() {
-   if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
-   eerror "preserve_old_lib_notify() must be called from 
pkg_postinst() only"
-   die "Invalid preserve_old_lib_notify() usage"
-   fi
-
-   # let portage worry about it
-   has preserve-libs ${FEATURES} && return 0
-
-   _eutils_eprefix_init
-
-   local lib notice=0
-   for lib in "$@" ; do
-   [[ -e ${EROOT}/${lib} ]] || continue
-   if [[ ${notice} -eq 0 ]] ; then
-   notice=1
-   ewarn "Old versions of installed libraries were 
detected on your system."
-   ewarn "In order to avoid breaking packages that depend 
on these old libs,"
-   ewarn "the libraries are not being removed.  You need 
to run revdep-rebuild"
-   ewarn "in order to remove these old dependencies.  If 
you do not have this"
-   ewarn "helper program, simply emerge the 'gentoolkit' 
package."
-   ewarn
-   fi
-   ewarn "  # revdep-rebuild --library '${lib}' && rm '${lib}'"
-   done
-}
-
 # @FUNCTION: built_with_use
 # @USAGE: [--hidden] [--missing ] [-a|-o]  
 # @DESCRIPTION:
diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-libs.eclass
new file mode 100644
index ..548c6411fcf0
--- /dev/null
+++ b/eclass/preserve-libs.eclass
@@ -0,0 +1,74 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: preserve-libs.eclass
+# @MAINTAINER:
+# base-sys...@gentoo.org
+# @BLURB: preserve libraries after SONAME changes
+
+if [[ -z ${_PRESERVE_LIBS_ECLASS} ]]; then
+_PRESERVE_LIBS_ECLASS=1
+
+# @FUNCTION: preserve_old_lib
+# @USAGE:  [more libs]
+# @DESCRIPTION:
+# These functions are useful when a lib in your package changes ABI SONAME.
+# An example might be from libogg.so.0 to libogg.so.1.  Removing libogg.so.0
+# would break packages that link against it.  Most people get around this
+# by using the portage SLOT mechanism, but that is not always a relevant
+# solution, so instead you can call