Date: Sat, 18 Mar 2006 23:32:43 +0100 From: Alexander Leidinger <Alexander@Leidinger.net> To: Boris Samorodov <bsam@ipt.ru> Cc: freebsd-emulation@freebsd.org Subject: Re: [patch] for bsd.linux-rpm.mk (add auto sources fetching) Message-ID: <20060318233243.52d6c3aa@Magellan.Leidinger.net> In-Reply-To: <61349928@ho.ipt.ru> References: <39907788@serv3.int.kfs.ru> <20060316181625.41102cfd@Magellan.Leidinger.net> <61349928@ho.ipt.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
--MP__Zs=hjt1=aGcwfTSlB._VyF
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Am Thu, 16 Mar 2006 23:23:03 +0300
schrieb Boris Samorodov <bsam@ipt.ru>:
> On Thu, 16 Mar 2006 18:16:25 +0100 Alexander Leidinger wrote:
> > Am Thu, 16 Mar 2006 18:25:23 +0300
> > schrieb Boris Samorodov <bsam@ipt.ru>:
>
> > > +. if defined(PACKAGE_BUILDING) && ${AUTO_LINUX_SRC} == "yes"
> > > +DISTFILES+= ${DISTNAME}${SRC_SUFX}
> > > +MASTER_SITE_SUBDIR+= 3/SRPMS
> > > +ALWAYS_KEEP_DISTFILES= yes
> > > . endif
>
> > You are assuming this will only be used for some specific directory
> > layouts without the possibility to override this. I suggest to
> > introduce an overridable variable... maybe MASTER_SITE_SRC_SUBDIR or
> > whatever which will be added to MASTER_SITE_SUBDIR then.
>
> > Maybe you can change the patch to have a look at a SRC_DISTFILES
> > variable and add this content to the DISTFILES in the PACKAGE_BUILDING
> > case instead of hardcoding one file.
>
> Agreed to both. New patch is attached.
>
> If auto fetching go well, then variable AUTO_LINUX_SRC may be
I don't think we need it, I documented the behavior and what to do in
case of e.g. a commercial RPM.
> deletted. But for now it may be used if something go wrong with auto
> fetching.
Attached is a diff which I intend to commit. It's a combination of your
patches, and some own stuff (start of docs, a new new-plist target and
some mods to your patches). What do you think about it?
Bye,
Alexander.
--
To boldly go where I surely don't belong.
http://www.Leidinger.net Alexander @ Leidinger.net
GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7
WL http://www.amazon.de/exec/obidos/registry/1FZ4DTHQE9PQ8/ref=wl_em_to/
--MP__Zs=hjt1=aGcwfTSlB._VyF
Content-Type: text/x-patch; name=bsd.linux-rpm.mk.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bsd.linux-rpm.mk.diff
Index: bsd.linux-rpm.mk
===================================================================
RCS file: /big/FreeBSD-CVS/ports/Mk/bsd.linux-rpm.mk,v
retrieving revision 1.2
diff -u -u -r1.2 bsd.linux-rpm.mk
--- bsd.linux-rpm.mk 25 Jan 2006 17:41:34 -0000 1.2
+++ bsd.linux-rpm.mk 18 Mar 2006 22:28:51 -0000
@@ -4,6 +4,30 @@
# $FreeBSD: ports/Mk/bsd.linux-rpm.mk,v 1.2 2006/01/25 17:41:34 jylefort Exp $
#
+# Variables:
+# - LINUX_DIST: Will be used to set some dist-specific presets.
+# Valid values: fedora
+# - LINUX_DIST_VER: Use depends upon the dist-specific presets.
+# Valid values for "fedora": all version numbers
+# e.g. 3 for fedora core 3, 4 for fedora core 4
+# This is used to set MASTER_SITE_{,SRC_}SUBDIR
+# if it isn't already set.
+# - MASTER_SITE_SRC_SUBDIR: The subdir for the src RPM's.
+# - DISTFILES: For simple cases this will be set automatically
+# based upon the DISTNAME.
+# - SRC_DISTFILES: Variable which contains the corresponding src RPM's.
+# If there's no corresponding src RPM, it has to be
+# set to the empty value (SRC_DISTFILES= "").
+# - AUTOMATIC_PLIST: Generate a dynamic plist (please have a look at the
+# porters handbook section which talks about plists.
+# This feature is reserved for rare cases).
+# - BRANDELF_DIRS: A list of directories with executables to brand
+# as a linux executable. The directories has to not
+# contain libraries.
+# - BRANDELF_FILES: A list of files to brand as a linux executable in
+# case BRANDELF_DIRS can't be used.
+
+
.if !defined(_POSTMKINCLUDED) && !defined(Linux_RPM_Pre_Include)
Linux_RPM_Include_MAINTAINER= emulation@FreeBSD.org
@@ -33,10 +57,38 @@
Linux_RPM_Post_Include= bsd.linux-rpm.mk
+LINUX_DIST?= fedora
+LINUX_DIST_VER?= 3
+
+. if defined(LINUX_DIST)
+DIST_SUBDIR?= rpm/${LINUX_RPM_ARCH}/${LINUX_DIST}/${LINUX_DIST_VER}
+
+. if ${LINUX_DIST} == "fedora"
MASTER_SITES?= ${MASTER_SITE_FEDORA_LINUX}
-MASTER_SITE_SUBDIR?= 3/${LINUX_RPM_ARCH}/os/Fedora/RPMS/
+MASTER_SITE_SUBDIR?= ${LINUX_DIST_VER}/${LINUX_RPM_ARCH}/os/Fedora/RPMS \
+ updates/${LINUX_DIST_VER}/${LINUX_RPM_ARCH}
+MASTER_SITE_SRC_SUBDIR?= ${LINUX_DIST_VER}/SRPMS \
+ updates/${LINUX_DIST_VER}/SRPMS
+. else
+IGNORE= unknown LINUX_DIST in port Makefile
+. endif
+. endif
PKGNAMEPREFIX?= linux-
+# DISTFILES and SRC_DISTFILES assume that there is only one bindist
+# and one src file.
+# Please, define them n the Makefile of the port in case this assumption
+# is not true.
+
+DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
+SRC_DISTFILES?= ${DISTNAME}${SRC_SUFX}
+
+. if defined(PACKAGE_BUILDING)
+DISTFILES+= ${SRC_DISTFILES}
+MASTER_SITE_SUBDIR+= ${MASTER_SITE_SRC_SUBDIR}
+ALWAYS_KEEP_DISTFILES= yes
+. endif
+
EXTRACT_DEPENDS+= ${RPM2CPIO}:${PORTSDIR}/archivers/rpm
EXTRACT_CMD?= ${RPM2CPIO}
@@ -45,43 +97,54 @@
MD5_FILE?= ${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
+BRANDELF_DIRS?=
+BRANDELF_FILES?=
+
. if defined(AUTOMATIC_PLIST)
. if ${USE_LINUX} == "8" || ${USE_LINUX:L} == "yes"
_LINUX_BASE_SUFFIX= 8
. elif ${USE_LINUX} == "debian"
_LINUX_BASE_SUFFIX= debian
+. elif ${USE_LINUX} == "fc3"
+_LINUX_BASE_SUFFIX= fc3
. else
# other linux_base ports do not provide a pkg-plist file
-IGNORE= uses AUTOMATIC_PLIST with an unsupported USE_LINUX, \"${USE_LINUX}\". Supported values are \"yes\", \"8\" and \"debian\"
+IGNORE= uses AUTOMATIC_PLIST with an unsupported USE_LINUX, \"${USE_LINUX}\". Supported values are \"yes\", \"8\", \"debian\" and \"fc3\"
. endif
PLIST?= ${WRKDIR}/.PLIST.linux-rpm
pre-install: linux-rpm-generate-plist
+. if !target(linux-rpm-generate-plist)
linux-rpm-generate-plist:
@cd ${WRKSRC} && \
${FIND} * ! -type d | ${SORT} > ${PLIST} && \
${FIND} * -type d | ${SORT} | ${SED} -e 's|^|@dirrm |' > ${PLIST}.dirs
@${GREP} '^@dirrm ' ${PORTSDIR}/emulators/linux_base-${_LINUX_BASE_SUFFIX}/pkg-plist | ${SORT} > ${PLIST}.shared-dirs
@${COMM} -1 -3 ${PLIST}.shared-dirs ${PLIST}.dirs | ${SORT} -r >> ${PLIST}
-
+. endif
. endif
. if !target(do-install)
do-install:
+. if ${BRANDELF_DIRS}
+ @cd ${WRKSRC} && ${FIND} ${BRANDELF_DIRS} -type f -print0 \
+ | ${XARGS} -0 ${FILE} | ${GREP} ELF | ${CUT} -d : -f 1 \
+ | ${XARGS} ${BRANDELF} -t Linux
+. endif
+. if ${BRANDELF_FILES}
+ @cd ${WRKSRC} && ${BRANDELF} -t Linux ${BRANDELF_FILES}
+. endif
cd ${WRKSRC} && ${FIND} * -type d -exec ${MKDIR} "${PREFIX}/{}" \;
cd ${WRKSRC} && ${FIND} * ! -type d | ${CPIO} -pm -R root:wheel ${PREFIX}
. endif
. if !target(new-plist)
-new-plist:
- @${RM} -rf ${WRKDIR}/.new-plist
- @${MKDIR} ${WRKDIR}/.new-plist
- @cd ${WRKDIR}/.new-plist && \
- for f in ${DISTFILES}; do \
- ${RPM2CPIO} ${_DISTDIR}/$$f | ${CPIO} -id --quiet; \
+new-plist: build
+ @${RM} -f ${PLIST}.new
+ @cd ${WRKSRC} && \
${FIND} * ! type d | ${SORT} > ${PLIST}.new; \
${FIND} -d * -type d | ${SED} -e 's|^|@dirrm |' >> ${PLIST}.new; \
done
--MP__Zs=hjt1=aGcwfTSlB._VyF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060318233243.52d6c3aa>
