Bug 212098

Summary: Use autoconf to generate task perl script templates
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: Command Line UtilitiesAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0.2CC: nkinder, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 16:51:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 152373, 240316    
Attachments:
Description Flags
cvs diffs configure.ac m4/{db.m4,mozldap.m4}
none
diffs between template-*.pl and template-*.pl.in files
none
cvs diffs (ldapserver - revised)
none
cvs commit message
none
cvs diff configure.ac Makefile.am
none
cvs diffs (ldapserver)
none
.in files for the server shell scripts
none
cvs diff Makefile.am
none
cvs commit message
none
cvs diff branding/{fedora,rhds}/brandver.dat
none
sample install info file
none
cvs commit message ({fedora,rhds}/brandver.dat) none

Description Noriko Hosoi 2006-10-25 00:29:38 UTC
Description of problem:
Instead of hardcoding the paths of mozldap, libdb, dirsec libs and tools, set
them via autoconf.

Comment 1 Noriko Hosoi 2006-10-25 18:08:37 UTC
Created attachment 139372 [details]
cvs diffs configure.ac m4/{db.m4,mozldap.m4}

Files:
 configure.ac
 m4/db.m4
 m4/mozldap.m4

Changes:
1) added template files to AC_CONFIG_FILES list
2) added db_bindir and ldapsdk_bindir to pass their tools path to the template
files.	The paths are hardcoded for now.

Notes:
1. The templates' in files are being added in the next attachment.
2. The template files are not "installed" now.

Comment 2 Noriko Hosoi 2006-10-25 18:19:18 UTC
Created attachment 139374 [details]
diffs between template-*.pl and template-*.pl.in files

Files:
template-bak2db.pl.in		 template-ns-activate.pl.in
template-cl-dump.pl.in* 	 template-ns-inactivate.pl.in
template-db2bak.pl.in		 template-ns-newpwpolicy.pl.in*
template-db2index.pl.in 	 template-repl-monitor-cgi.pl.in*
template-db2ldif.pl.in		 template-repl-monitor.pl.in*
template-ldif2db.pl.in		 template-verify-db.pl.in
template-ns-accountstatus.pl.in

Description:
Since only the paths are replaced by autoconf, attaching just the diff output.

Comment 3 Rich Megginson 2006-10-25 18:45:17 UTC
Ok.

Comment 4 Nathan Kinder 2006-10-25 19:11:35 UTC
Looks good.

Comment 5 Noriko Hosoi 2006-10-25 20:28:47 UTC
Created attachment 139403 [details]
cvs diffs (ldapserver - revised)

I removed template-dsml-active.pl from configure.ac, which does not have any
substitution (and more likely, ldapserver does not have to install the script?)

+AC_CONFIG_FILES([ldap/admin/src/scripts/template-dsml-activate.pl])

Comment 6 Noriko Hosoi 2006-10-25 20:39:54 UTC
Created attachment 139406 [details]
cvs commit message

Reviewed by Rich and Nathan (Thank you!!)

Checked in into HEAD.

Comment 7 Noriko Hosoi 2006-10-25 22:34:49 UTC
Created attachment 139419 [details]
cvs diff configure.ac Makefile.am

Files:
  configure.ac
  MAkefile.am

Changes;
1) added task perl script templates to "install" at
@sysconfdir@@scripttemplatedir@ to Makefile.am
2) added scripttemplatedir = /fedora-ds/script-templates to configure.ac

Question: changing these files, Makefile.in and configure are also updated.  Am
I supposed to check them in?
M Makefile.am
M Makefile.in
M configure
M configure.ac

Comment 8 Nathan Kinder 2006-10-25 23:02:46 UTC
There are a few things that need to be changed.

We should not be installing the "template-*.pl" files from "$(srcdir)" in
Makefile.am.  The files that configure generates from the "template-*.in" fiels
will be generated in the build area, not the source area (unless you are
building directly from the ldapserver directory).  You should just remove
"$(srcdir)/" from the list of files specified in the "task_SCRIPTS" variable. 
We should also remove the old "template-*.pl" files from the source tree as soon
as we stop building with the old Makefiles.

As for your question about Makefile.in and configure, you should check them in.
 I usually don't send them out for review as the diffs for them are always huge
whenever they are regenerated.

Comment 9 Rich Megginson 2006-10-26 02:32:51 UTC
When you change configure.ac, Makefile.am, or one of the .m4 files, you should run
autoreconf -vfi
in the ldapserver directory to make sure all of the files are generated
properly.  Then check in those files, plus Makefile.in and configure (and
possibly aclocal.m4).  You may have to use cvs checkin -f to force a file to be
committed if all autoreconf did was to change the file's timestamp.

Comment 10 Noriko Hosoi 2006-10-26 06:37:36 UTC
Created attachment 139439 [details]
cvs diffs (ldapserver)

Files:
 Makefile.am
 configure.ac
 ldap/admin/src/create_instance.c
 ldap/admin/src/scripts/template-verify-db.pl.in
 (diffs are not attached)
 Makefile.in
 configure

Changes:
1) removed $(srcdir)/ as Nathan pointed out in the Comment #8.
2) autotoolized the shell-based scripts in the instance directory (e.g.,
start-slapd).  This was needed since dirsec and mozldap libraries are not in
the same directory or in the rpath any more. (attaching the *.in files next) fi

3) fixed a typo (found .o in the source list)

I could launch the server on my RHEL4 box!
$ perl usr/lib/fedora-ds/ds_newinst.pl	/tmp/install.inf 
Success!  Your new directory server instance was created


We should not be installing the "template-*.pl" files from "$(srcdir)" in
Makefile.am.  The files that configure generates from the "template-*.in" fiels

will be generated in the build area, not the source area (unless you are
building directly from the ldapserver directory).  You should just remove
"$(srcdir)/" from the list of files specified in the "task_SCRIPTS" variable.

Comment 11 Noriko Hosoi 2006-10-26 06:52:44 UTC
Created attachment 139440 [details]
.in files for the server shell scripts

New Files:
template-bak2db.in
template-db2bak.in
template-db2index.in
template-db2ldif.in
template-ldif2db.in
template-ldif2ldap.in
template-monitor.in
template-restoreconfig.in
template-saveconfig.in
template-start-slapd.in
template-stop-slapd.in
template-suffix2instance.in
template-upgradedb.in
template-vlvindex.in

Changes:
. set dirsec library paths in the shell scripts.

Comment 12 Rich Megginson 2006-10-26 14:35:29 UTC
Ok.

Comment 13 Nathan Kinder 2006-10-26 15:44:03 UTC
Looks good, but you don't need to define "newinstdir" in Makefile.am since it's
the same as "serverdir".  You can just add "ds_newinst.pl" to "server_SCRIPTS"
instead.

Comment 14 Noriko Hosoi 2006-10-26 17:33:25 UTC
Created attachment 139492 [details]
cvs diff Makefile.am

Changed ds_newinst.pl install directory to use serverdir as Nathan pointed out
in the review.

> but you don't need to define "newinstdir" in Makefile.am since it's
the same as "serverdir".  You can just add "ds_newinst.pl" to "server_SCRIPTS"
instead.

Comment 15 Noriko Hosoi 2006-10-26 17:48:18 UTC
Created attachment 139494 [details]
cvs commit message

Reviewed by Rich and Nathan (Thank you!!)

Checked in into HEAD.

Comment 16 Noriko Hosoi 2006-10-26 18:15:56 UTC
Created attachment 139497 [details]
cvs diff branding/{fedora,rhds}/brandver.dat

Files:
  branding/fedora/brandver.dat
  branding/rhds/brandver.dat

Changes:
1) added configure.ac
2) commented out *.spec (branding script fails)

Comment 17 Noriko Hosoi 2006-10-26 18:25:23 UTC
Created attachment 139498 [details]
sample install info file

Basically, I'm using the same info file generated by setup except one line in
[General]
prefix=  /export/servers/ds72_core

If prefix and ServerRoot do not exist, new instance is created from root. 
(that is, /usr/lib/<brand>-ds/slapd-<id>.)

Comment 18 Noriko Hosoi 2006-10-26 20:16:39 UTC
Created attachment 139523 [details]
cvs commit message ({fedora,rhds}/brandver.dat)

Reviewed by Nathan (Thank you!!)

Checked in into HEAD

Comment 19 Noriko Hosoi 2007-11-29 22:39:13 UTC
Checked source tree/location:
$ pwd
/share/dev4/ds/ds80/builds/20071129.1/earthquake_rhel4/ldapserver/ldap/admin/src/scripts

In the directory, there is only one template perl script which is not processed
by autoconf, but the script is not supported on 8.0 (DSML related).
$ ls template*.pl
template-dsml-activate.pl

I.e., verified.

Related bug:
Summary: clean up template-scriptname which is derived from template-scriptname.in
https://bugzilla.redhat.com/show_bug.cgi?id=229576