On Sat, Jan 09, 2021 at 10:38:36PM +0100, Klemens Nanni wrote:
> Coming from sysutils/mdprint I want ordinary distfiles handling.
> Since we have more than one port using RPM files, here is a straight
> forward diff to unify each of their quirky handling.
> 
> Less code, no plist change and we can use EXTRACT_FILES if need be.
> 
> OK?
> 
> Index: infrastructure/mk/bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1542
> diff -u -p -r1.1542 bsd.port.mk
> --- infrastructure/mk/bsd.port.mk     26 Jun 2020 11:51:16 -0000      1.1542
> +++ infrastructure/mk/bsd.port.mk     9 Jan 2021 21:04:00 -0000
> @@ -1385,6 +1385,11 @@ PATCH_CASES += *.bz2) \
>       ${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
>  .endif
>  
> +.if !empty(_LIST_EXTRACTED:M*.rpm)
> +BUILD_DEPENDS += converters/rpm2cpio
> +EXTRACT_CASES += *.rpm) \
> +     cd ${WRKDIR} && rpm2cpio ${FULLDISTDIR}/$$archive | cpio -id -- 
> ${EXTRACT_FILES};;
> +.endif
>  
>  _PERL_FIX_SHAR ?= perl -ne 'print if $$s || ($$s = m:^\#(\!\s*/bin/sh\s*| 
> This is a shell archive):)'
>  
> Index: sysutils/mdprint/Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/mdprint/Makefile,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile
> --- sysutils/mdprint/Makefile 28 Dec 2020 04:01:48 -0000      1.5
> +++ sysutils/mdprint/Makefile 9 Jan 2021 21:11:03 -0000
> @@ -17,9 +17,6 @@ PERMIT_PACKAGE =    Yes
>  
>  MASTER_SITES =               
> https://yum.oracle.com/repo/OracleLinux/OL6/latest/source/getPackageSource/
>  EXTRACT_SUFX =               .el6.src.rpm
> -EXTRACT_ONLY =               # empty
> -
> -BUILD_DEPENDS =              converters/rpm2cpio
>  
>  MODULES =            lang/python
>  MODPY_VERSION =              ${MODPY_DEFAULT_VERSION_3}
> @@ -31,9 +28,7 @@ NO_TEST =           Yes
>  
>  # the SRC RPM contains a SPEC file and the actual uncompressed source tarball
>  post-extract:
> -     cd ${WRKDIR} && rpm2cpio ${FULLDISTDIR}/${DISTFILES} | \
> -             cpio -i ${DISTNAME}.tar
> -     ${TAR} -C${WRKDIR} -xf${WRKDIR}/${DISTNAME}.tar ${DISTNAME}/${MDPRINT}
> +     cd ${WRKDIR} && ${TAR} -xf./${DISTNAME}.tar
>  
>  do-build:
>       2to3-${MODPY_VERSION} --no-diffs -W ${WRKSRC}/${MDPRINT}
> Index: mail/kopano/webapp/Makefile
> ===================================================================
> RCS file: /cvs/ports/mail/kopano/webapp/Makefile,v
> retrieving revision 1.21
> diff -u -p -r1.21 Makefile
> --- mail/kopano/webapp/Makefile       30 May 2020 08:50:13 -0000      1.21
> +++ mail/kopano/webapp/Makefile       9 Jan 2021 21:18:51 -0000
> @@ -24,19 +24,19 @@ MINOR=            2765
>  RPMVER=              1630.1
>  PKGNAME=     kopano-webapp-${WAPP_VERSION}.${MINOR}
>  
> -EXTRACT_SUFX=        # empty
> +EXTRACT_SUFX=        .noarch.rpm
>  
>  # 
> https://download.kopano.io/community/webapp%3A/webapp-4.1.2765%2B1630.1.dbabb97-RHEL_7-noarch.tar.gz
>  .for _dfile in ${PLUGINS}
> -EDISTFILES+=    kopano-webapp-plugin-${_dfile}.noarch.rpm
> +EDISTFILES+=    kopano-webapp-plugin-${_dfile}${EXTRACT_SUFX}
>  .endfor
> -EDISTFILES+=    
> kopano-webapp-lang-${WAPP_VERSION}.${MINOR}-${RPMVER}.noarch.rpm
> +EDISTFILES+=    
> kopano-webapp-lang-${WAPP_VERSION}.${MINOR}-${RPMVER}${EXTRACT_SUFX}
>  EXTRACT_ONLY=   ${EDISTFILES:C/:[0-9]$//}
>  
> -DISTFILES+=  kopano-webapp-${WAPP_VERSION}.${MINOR}-${RPMVER}.noarch.rpm
> -DISTFILES+=  kopano-webapp-plugin-files-3.0.0.42-362.1.noarch.rpm \
> -             
> kopano-webapp-plugin-filesbackend-owncloud-3.0.0.15-115.1.noarch.rpm \
> -             kopano-webapp-plugin-filesbackend-smb-3.0.0.14-82.1.noarch.rpm
> +DISTFILES+=  kopano-webapp-${WAPP_VERSION}.${MINOR}-${RPMVER}${EXTRACT_SUFX}
> +DISTFILES+=  kopano-webapp-plugin-files-3.0.0.42-362.1${EXTRACT_SUFX} \
> +             
> kopano-webapp-plugin-filesbackend-owncloud-3.0.0.15-115.1${EXTRACT_SUFX} \
> +             
> kopano-webapp-plugin-filesbackend-smb-3.0.0.14-82.1${EXTRACT_SUFX}
>  
>  DISTFILES+=  ${EDISTFILES}
>  
> @@ -49,7 +49,6 @@ MODULES=    lang/php
>  MODPHP_BUILDDEP=No
>  MODPHP_RUNDEP=       No
>  
> -BUILD_DEPENDS=       converters/rpm2cpio
>  RUN_DEPENDS= mail/kopano/core,-mapi # php-mapi
>  
>  NO_BUILD=    Yes

No objection from me, but you need a small snippet for bsd.port.mk(5) as
well.

Reply via email to