Bug 115342 - [PATCH] sysutils/py-bcfg2: FreeBSD fixes and startup script
Summary: [PATCH] sysutils/py-bcfg2: FreeBSD fixes and startup script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Boris Samorodov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-09 08:00 UTC by lerik
Modified: 2008-01-12 14:50 UTC (History)
1 user (show)

See Also:


Attachments
py-bcfg2.patch (1.76 KB, patch)
2007-08-09 08:00 UTC, lerik
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lerik 2007-08-09 08:00:10 UTC
This patch enhances the sysutils/py-bcfg2 port with the following:
	* Make the port use ${PREFIX}/etc/bcfg2.conf rather than hardcoded
	/etc/bcfg2.conf everywhere
	* Added rc.subr-style startup script for the server
	* Bump PORTREVISION

This patch was reviewed by the maintainer (cc'ed) before submission.

Fix: Patch included below:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-08-09 08:00:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-python

freebsd-python@ wants to have py- PRs
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2007-08-09 08:00:39 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 3 Robert Gogolok 2007-08-09 09:24:08 UTC
I approve the patch.
Comment 4 lerik 2007-08-09 14:33:47 UTC
Sorry, when send-pr'ing this I accidentally inverted the file arguments to 
diff and so the patch included is in reverse, correct one is below:


--- py-bcfg2.patch begins here ---
diff -ruN py-bcfg2.old/Makefile py-bcfg2/Makefile
--- py-bcfg2.old/Makefile	Mon Aug  6 11:49:50 2007
+++ py-bcfg2/Makefile	Tue Aug  7 09:29:39 2007
@@ -7,6 +7,7 @@

  PORTNAME=	bcfg2
  PORTVERSION=	0.9.4
+PORTREVISION=	1
  CATEGORIES=	sysutils
  MASTER_SITES=	ftp://ftp.mcs.anl.gov/pub/bcfg/ \
  		http://mirror.opensysadmin.com/bcfg/
@@ -22,6 +23,10 @@
  USE_PYTHON=		yes
  USE_PYDISTUTILS=	yes

+USE_RC_SUBR=	bcfg2
+SUB_LIST+=      PYTHON_CMD=${PYTHON_CMD}
+
+
  MAN1=	bcfg2.1
  MAN5=	bcfg2.conf.5
  MAN8=	bcfg2-admin.8 bcfg2-build-reports.8 bcfg2-repo-validate.8 bcfg2-server.8 bcfg2-info.8
@@ -30,6 +35,10 @@

  post-patch:
  	    @${REINPLACE_CMD} -e 's|share/man|man|g' ${WRKSRC}/setup.py
+.for f in bcfg2 bcfg2-admin bcfg2-build-reports bcfg2-info bcfg2-repo-validate bcfg2-server bcfg2-ping-sweep bcfg2-query 
+	@${REINPLACE_CMD} -e 's|/etc/bcfg2.conf|${PREFIX}/etc/bcfg2.conf|g' ${WRKSRC}/src/sbin/$f
+.endfor
+	@${RM} ${WRKSRC}/src/sbin/*.bak

  .if !defined(NOPORTDOCS)
  post-install:
diff -ruN py-bcfg2.old/files/bcfg2.in py-bcfg2/files/bcfg2.in
--- py-bcfg2.old/files/bcfg2.in	Thu Jan  1 01:00:00 1970
+++ py-bcfg2/files/bcfg2.in	Tue Aug  7 09:51:30 2007
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bcfg2
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable bcfg2-server:
+# bcfg2_enable (bool):	Set it to "YES" to enable bcfg2.
+#			Default is "NO".
+# bcfg2_flags (str):	Flags passed to bcfg2 on startup.
+#			Default is "".
+
+. %%RC_SUBR%%
+
+name="bcfg2"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bcfg2_enable="NO"}
+: ${bcfg2_pidfile="/var/run/$name.pid"}
+: ${bcfg2_flags="-D ${bcfg2_pidfile}"}
+
+pidfile=${bcfg2_pidfile}
+command=%%PREFIX%%/bin/${name}-server
+command_interpreter=%%PYTHON_CMD%%
+
+run_rc_command "$1"
--- py-bcfg2.patch ends here ---
Comment 5 Robert Gogolok 2008-01-11 23:12:05 UTC
The patch has to be updated to reflect current port version 0.9.5.X.

(sadly  nobody commited the old one)
Comment 6 Boris Samorodov freebsd_committer freebsd_triage 2008-01-12 12:24:53 UTC
Responsible Changed
From-To: freebsd-python->bsam

Take.
Comment 7 Boris B.Samorodov 2008-01-12 14:10:29 UTC
. update the patch to current port version;
. add bcfg2-remote for reinplacing (Makefile, post-patch:);
. use a sed option "-i ''" for reinplacing, hence no need to remove *.bak.

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/sysutils/py-bcfg2/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- Makefile	12 Jan 2008 12:58:52 -0000	1.6
+++ Makefile	12 Jan 2008 14:04:16 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	bcfg2
 PORTVERSION=	0.9.5.5
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	ftp://ftp.mcs.anl.gov/pub/bcfg/ \
 		http://mirror.opensysadmin.com/bcfg/
@@ -23,6 +24,9 @@
 USE_PYDISTUTILS=	yes
 PYDISTUTILS_PKGNAME=	Bcfg2
 
+USE_RC_SUBR=	bcfg2
+SUB_LIST+=	PYTHON_CMD=${PYTHON_CMD}
+
 MAN1=	bcfg2.1
 MAN5=	bcfg2.conf.5
 MAN8=	bcfg2-admin.8 bcfg2-build-reports.8 bcfg2-repo-validate.8 \
@@ -32,6 +36,9 @@
 
 post-patch:
 	    @${REINPLACE_CMD} -e 's|share/man|man|g' ${WRKSRC}/setup.py
+.for f in bcfg2 bcfg2-admin bcfg2-build-reports bcfg2-info bcfg2-repo-validate bcfg2-server bcfg2-ping-sweep bcfg2-query bcfg2-remote
+	@${REINPLACE_CMD} -i '' -e 's|/etc/bcfg2.conf|${PREFIX}/etc/bcfg2.conf|g' ${WRKSRC}/src/sbin/$f
+.endfor
 
 .if !defined(NOPORTDOCS)
 post-install:
Index: files/bcfg2.in
===================================================================
RCS file: files/bcfg2.in
diff -N files/bcfg2.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/bcfg2.in	12 Jan 2008 14:04:16 -0000
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bcfg2
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable bcfg2-server:
+# bcfg2_enable (bool):  Set it to "YES" to enable bcfg2.
+#                       Default is "NO".
+# bcfg2_flags (str):    Flags passed to bcfg2 on startup.
+#                       Default is "".
+
+. %%RC_SUBR%%
+
+name="bcfg2"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bcfg2_enable="NO"}
+: ${bcfg2_pidfile="/var/run/$name.pid"}
+: ${bcfg2_flags="-D ${bcfg2_pidfile}"}
+
+pidfile=${bcfg2_pidfile}
+command=%%PREFIX%%/bin/${name}-server
+command_interpreter=%%PYTHON_CMD%%
+
+run_rc_command "$1"
Comment 8 Robert Gogolok 2008-01-12 14:35:17 UTC
I approve the patch.
Comment 9 dfilter service freebsd_committer freebsd_triage 2008-01-12 14:46:18 UTC
bsam        2008-01-12 14:46:13 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/py-bcfg2    Makefile 
  Added files:
    sysutils/py-bcfg2/files bcfg2.in 
  Log:
  * Make the port use ${PREFIX}/etc/bcfg2.conf rather than /etc/bcfg2.conf;
  * Added rc.subr-style startup script for the server;
  * Bump PORTREVISION.
  
  PR:             115342
  Submitted by:   Lars Erik Gullerud <lerik at nolink.net>
  Approved by:    Robert Gogolok <gogo at cs.uni-sb.de> (maintainer)
  
  Revision  Changes    Path
  1.7       +7 -0      ports/sysutils/py-bcfg2/Makefile
  1.1       +30 -0     ports/sysutils/py-bcfg2/files/bcfg2.in (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 10 Boris Samorodov freebsd_committer freebsd_triage 2008-01-12 14:47:05 UTC
State Changed
From-To: feedback->closed

Committed, thanks!