[rt-devel] rpm packaging for 2-0-6

Cris Bailiff c.bailiff at awayweb.com
Tue Sep 4 01:09:37 EDT 2001


Hi,
	I've created a basic '.spec' file for producing an rpm file from the
rt2 tarball, which I'd like to contribute to rt2. I hope that this is
the best place to send them - let me know if I should just create an rt2
ticket instead...

The normal rt makefile does some configuration steps during installation
of the files and only installs into the 'final' run directory. RPM would
like to 'make install' into a build directory for packaging, and run any
configuration steps after the files are finally installed, so I've also
attached a Makefile patch which lets RPM install into a build directory
and then run the final configuration later with the real runtime
directories.

Notes:

* The .spec lists all the dependencies from the current deptest script
(for mysql) as dependencies on 'perl-Blah-Blah' rpms. This forces the
end user to consider the dependencies, but as not all CPAN modules are
widely available in rpm form, you will probably need to rpm -ivh
--nodeps the final rpm to get it installed. (We make our own perl rpms
inhouse, using the makerpm.pl script from CPAN).

* The postinstall section of the RPM just shows the postinstall
configuration commands, it doesn't run them. This is because it will
probably need the mysql root password, and the user should choose the rt
database password themselves.

* I built and tested on rh6.2 with all patches, and rt2 seems to work
fine.

* There's plenty of extra bells and whistles which could be added, e.g.
for detecting and running upgrades, choosing and configuring a database
etc. I can't offer updates or support for these files - they fit my
current needs, and I'm happy for them to be useful to anyone else.

Licence: I hereby assign all rights to the attached code to Jesse
Vincent for inclusion into RT2 under the terms of the GPL.

Cheers,
Cris Bailiff,
/dev/secure Pty Ltd
c.bailiff at devsecure.com
-------------- next part --------------
Summary: rt Request Tracker

Name: rt
Version: 2.0.6
Release: 4
Group: Applications/Web
Packager: Cris Bailiff <c.bailiff at devsecure.com>
Vendor: http://www.fsck.com/projects/rt
Requires: perl
Requires: mod_perl > 1.22
Requires: perl-DBI >= 1.18
Requires: perl-DBIx-DataSource >= 0.02
Requires: perl-DBIx-SearchBuilder >= 0.40
Requires: perl-HTML-Entities
Requires: perl-MLDBM
Requires: perl-Net-Domain
Requires: perl-Net-SMTP
Requires: perl-Params-Validate >= 0.02
Requires: perl-HTML-Mason >= 0.896
Requires: perl-CGI-Cookie >= 1.20
Requires: perl-Apache-Cookie
Requires: perl-Apache-Session >= 1.53
Requires: perl-Date-Parse 
Requires: perl-Date-Format 
Requires: perl-MIME-Entity >= 5.108
Requires: perl-Mail-Mailer >= 1.20
Requires: perl-Getopt-Long >= 2.24
Requires: perl-Tie-IxHash
Requires: perl-Text-Wrapper
Requires: perl-Text-Template
Requires: perl-File-Spec >= 0.8
Requires: perl-Errno
Requires: perl-FreezeThaw
Requires: perl-File-Temp
Requires: perl-Log-Dispatch >= 1.6                     

Source: http://www.fsck.com/pub/rt/release/%{name}.tar.gz
Patch0: rt-Makefile.patch
 
Copyright: GPL 
BuildRoot: /var/tmp/rt-root

%description
RT is an industrial-grade ticketing system. It lets a group
of people intelligently and efficiently manage requests
submitted by a community of users. RT is used by systems
administrators, customer support staffs, NOCs, developers
and even marketing departments at over a thousand sites
around the world. 

%prep
groupadd rt || true
%setup -q -n %{name}-2-0-6
%patch0 -p1

%build

%install

if [ x$RPM_BUILD_ROOT != x ]; then
rm -rf $RPM_BUILD_ROOT
fi

#
# Perform all the non-site specfic steps whilst building the package
#
make dirs libs-install html-install bin-install  RT_PATH=$RPM_BUILD_ROOT/opt/rt2
#
# fixperms needs these, so make fake empty files
touch $RPM_BUILD_ROOT/opt/rt2/etc/insertdata $RPM_BUILD_ROOT/opt/rt2/etc/config.pm
make fixperms insert-install WEB_USER=wwwuser RT_PATH=$RPM_BUILD_ROOT/opt/rt2  

#
# Copy in the files needed again after install
#
mkdir -p $RPM_BUILD_ROOT/opt/rt2/postinstall/bin
cp -rp Makefile etc tools $RPM_BUILD_ROOT/opt/rt2/postinstall
cp -rp bin/initacls.* $RPM_BUILD_ROOT/opt/rt2/postinstall/bin

# logging in /var/log/rt2
mkdir -p $RPM_BUILD_ROOT/var/log/rt2
chown wwwuser $RPM_BUILD_ROOT/var/log/rt2

%clean
if [ x$RPM_BUILD_ROOT != x ]; then
rm -rf $RPM_BUILD_ROOT
fi

#
# A new rt groups is required
#
%pre
groupadd rt || true

#
# Show the user the site specific steps required after install
#
%post
cat <<EOF
-----------------------------------------------------------------------
rt2 installation is complete. Now create the rt2 database by running:
-----------------------------------------------------------------------

# cd /opt/rt2/postinstall
# make config-replace initialize.mysql insert RT_LOG_PATH=/var/log/rt2 DB_RT_PASS=new_rt_user_password

Choose your own new_rt_user_password. You will need the mysql root password.
You can try Pg or Oracle instead of mysql - untested.

Review and configure your site specific details in /opt/rt2/etc/config.pm
EOF

%preun

%files
%dir /opt/rt2
/opt/rt2/bin
/opt/rt2/WebRT
/opt/rt2/lib
/opt/rt2/local
/opt/rt2/man
/opt/rt2/postinstall
%dir /opt/rt2/etc
/opt/rt2/etc/insertdata
%config /opt/rt2/etc/config.pm
%dir /var/log/rt2

%changelog
* Tue Sep 4 2001 Cris Bailiff <c.bailiff at devsecure.com>
- created initial spec file
-------------- next part --------------
--- Makefile	Sun Sep  2 08:23:24 2001
+++ Makefile.new	Tue Sep  4 13:05:57 2001
@@ -32,11 +32,18 @@
 # RT_PATH is the name of the directory you want make to install RT in
 # RT must be installed in its own directory (don't set this to /usr/local)
 
+# FINAL_RT_PATH is the path after install, which is inserted into scripts etc.
+# RT_PATH is the path during building, which can be re-directed during packaging
+FINAL_RT_PATH		=	/opt/rt2
 RT_PATH			=	/opt/rt2
 
 # The rest of these paths are all configurable, but you probably don't want to 
 # put them elsewhere
 
+FINAL_RT_LIB_PATH		=	$(FINAL_RT_PATH)/lib
+FINAL_RT_ETC_PATH		=	$(FINAL_RT_PATH)/etc
+FINAL_RT_BIN_PATH		=	$(FINAL_RT_PATH)/bin
+
 RT_LIB_PATH		=	$(RT_PATH)/lib
 RT_ETC_PATH		=	$(RT_PATH)/etc
 RT_BIN_PATH		=	$(RT_PATH)/bin
@@ -312,8 +319,8 @@
 insert-install:
 	cp -rp ./tools/insertdata \
 		 $(RT_ETC_PATH)
-	$(PERL) -p -i -e " s'!!RT_ETC_PATH!!'$(RT_ETC_PATH)'g;\
-		           s'!!RT_LIB_PATH!!'$(RT_LIB_PATH)'g;"\
+	$(PERL) -p -i -e " s'!!RT_ETC_PATH!!'$(FINAL_RT_ETC_PATH)'g;\
+		           s'!!RT_LIB_PATH!!'$(FINAL_RT_LIB_PATH)'g;"\
 		$(RT_ETC_PATH)/insertdata
 
 bin-install:
@@ -324,11 +331,11 @@
 	cp -p ./bin/mason_handler.fcgi $(RT_FASTCGI_HANDLER)
 	cp -p ./bin/mason_handler.scgi $(RT_SPEEDYCGI_HANDLER)
 
-	$(PERL) -p -i -e "s'!!RT_PATH!!'"$(RT_PATH)"'g;\
+	$(PERL) -p -i -e "s'!!RT_PATH!!'"$(FINAL_RT_PATH)"'g;\
 				s'!!PERL!!'"$(PERL)"'g;\
 			      	s'!!RT_VERSION!!'"$(RT_VERSION)"'g;\
-				s'!!RT_ETC_PATH!!'"$(RT_ETC_PATH)"'g;\
-				s'!!RT_LIB_PATH!!'"$(RT_LIB_PATH)"'g;"\
+				s'!!RT_ETC_PATH!!'"$(FINAL_RT_ETC_PATH)"'g;\
+				s'!!RT_LIB_PATH!!'"$(FINAL_RT_LIB_PATH)"'g;"\
 		$(RT_MODPERL_HANDLER) $(RT_FASTCGI_HANDLER) \
 		$(RT_SPEEDYCGI_HANDLER) $(RT_CLI_BIN) $(RT_CLI_ADMIN_BIN) \
 		$(RT_MAILGATE_BIN)


More information about the Rt-devel mailing list