[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Problem with relocations in rpm 4.0.3



Hello!
Here is a letter I tried to post e few weeks ago but I had
some problems with my e-mail address...

I am using RedHat 7.2 with rpm-4.0.3-1.03
I am trying to make a package that I could relocate.
As long as I try to relocate only one directory it works (both
options --prefix and --relocate work ok)
However, I have problem with relocating two or three directories at the
time.

Below are described my failures of relocating multiple directories.
Can anyone say what did I do wrong?
Why is it (see spec file below):
$RPM_INSTALL_PREFIX: <dir1>
$RPM_INSTALL_PREFIX0: <dir2>
$RPM_INSTALL_PREFIX1: <dir3>
...
and not:
$RPM_INSTALL_PREFIX: <dir1>
$RPM_INSTALL_PREFIX0: <dir1>
$RPM_INSTALL_PREFIX1: <dir2>
as described by Jeff Johnson in one of the postings...

I think something is wrong with implementation of list of relocations
(probably the begin/end indexes) ... but I don't have time to debug
rpm sources.

I will be grateful for any help
Greetings
Bartosz


Here is my struggle described:

 a) Relocating two directories
 =============================
 File  exp.spec
 -----------------------------------------------------
%define VERSION 1.0.0
%define RELEASE 2
%define NAME exp

%define EXP_APP_CONFIG 	etc/exp_app
%define APACHE_CONFIG 	etc/httpd/conf
%define APACHE_HTML 	var/www/html

%define SOURCE_DIR /home/bartosz/exp1

BuildRoot: /home/bartosz/rpm/TEST_ROOT
Prefix: /etc
Prefix: /var

Summary: Exp
Name: %{NAME}
Version: %{VERSION}
Release: %{RELEASE}
Group: Application/Servers
Copyright: Commercial
Vendor: Bartosz
Packager: Bartosz Placzek <bartosz.placzek@tpg.pl>
URL: http://www.tpg.pl

%description
Just an experimental relocabile package

%prep

%build
# clean build directory
rm -rf *

#create build directories
mkdir -p  %{APACHE_HTML}
mkdir -p  %{EXP_APP_CONFIG}/conf
mkdir -p  %{APACHE_CONFIG}

#copy sources
cp -f %{SOURCE_DIR}/exp1.conf		%{APACHE_CONFIG}
cp -f %{SOURCE_DIR}/exp1.xml		%{EXP_APP_CONFIG}/conf
cp -f %{SOURCE_DIR}/exp1.html		%{APACHE_HTML}

%install
# copy everything to the final directories
rm -rf  $RPM_BUILD_ROOT/*
cp -rfp * $RPM_BUILD_ROOT

%post
# flush out the relocabile directories
echo \$RPM_INSTALL_PREFIX: $RPM_INSTALL_PREFIX
echo \$RPM_INSTALL_PREFIX0: $RPM_INSTALL_PREFIX1
echo \$RPM_INSTALL_PREFIX1: $RPM_INSTALL_PREFIX2
echo \$RPM_INSTALL_PREFIX2: $RPM_INSTALL_PREFIX3
%preun

%postun

%clean
rm -rf %{_builddir}/*
rm -rf $RPM_BUILD_ROOT/*

%files
/etc/exp_app/conf/exp1.xml
/etc/httpd/conf/exp1.conf
/var/www/html/exp1.html
  -----------------------------------------------------

  After building the package:

[root@lite i386]# rpm -qpil exp-1.0.0-2.i386.rpm
Name        : exp                          Relocations: /etc /var
Version     : 1.0.0                             Vendor: Bartosz
Release     : 2                             Build Date: Mon 12 Nov
2001 09:03:55 AM CET
Install date: (not installed)               Build Host: lite2
Group       : Application/Servers           Source RPM: exp-1.0.0-
2.src.rpm
Size        : 13297                            License: Commercial
Packager    : Bartosz Placzek <bartosz.placzek@tpg.pl>
URL         : http://www.tpg.pl
Summary     : Exp
Description :
Just an experimental relocabile package
/etc/exp_app/conf/exp1.xml
/etc/httpd/conf/exp1.conf
/var/www/html/exp1.html

[root@lite i386]# rpm -i exp-1.0.0-2.i386.rpm
$RPM_INSTALL_PREFIX: /etc
$RPM_INSTALL_PREFIX0: /var
$RPM_INSTALL_PREFIX1:
$RPM_INSTALL_PREFIX2:

[root@lite i386]# rpm -ql exp
/etc/exp_app/conf/exp1.xml
/etc/httpd/conf/exp1.conf
/var/www/html/exp1.html

  Everything's OK! Everything is where it should be .. now uninstall
exp and relocate etc..
[root@lite i386]# rpm -e exp
  /*************************************************/
   * Relocate /etc
   *************************************************/

[root@lite i386]# rpm -U --relocate /etc=/home/bartosz/test/etc exp-
1.0.0-2.i386.rpm
$RPM_INSTALL_PREFIX: /home/bartosz/test/etc
$RPM_INSTALL_PREFIX0: /var
$RPM_INSTALL_PREFIX1:
$RPM_INSTALL_PREFIX2:

[root@lite i386]# rpm -ql exp
/home/bartosz/test/etc/exp_app/conf/exp1.xml
/home/bartosz/test/etc/httpd/conf/exp1.conf
/var/www/html/exp1.html

[root@lite i386]# rpm -q --queryformat=[%{PREFIXES}]\n exp
/etc/var

[root@lite i386]# rpm -q --queryformat=[%{INSTPREFIXES}]\n exp
/home/bartosz/test/etc/var

  Everything's OK! Everything is where it should be .. now uninstall
exp and relocate var

[root@lite i386]# rpm -e exp
  /*************************************************/
   * Relocate /var
   *************************************************/
[root@lite i386]# rpm -U --relocate /var=/home/bartosz/test/var exp-
1.0.0-2.i386.rpm
$RPM_INSTALL_PREFIX: /etc
$RPM_INSTALL_PREFIX0: /home/bartosz/test/var
$RPM_INSTALL_PREFIX1:
$RPM_INSTALL_PREFIX2:

rpm -ql exp
/etc/exp_app/conf/exp1.xml
/etc/httpd/conf/exp1.conf
/home/bartosz/test/var/www/html/exp1.html

rpm -q --queryformat=[%{PREFIXES}]\n exp
/etc/var

rpm -q --queryformat=[%{INSTPREFIXES}]\n exp
/etc/home/bartosz/test/var

  Everything's OK!

[root@lite i386]# rpm -e exp
  /*************************************************/
   * Try to relocate both /etc and /var
   *************************************************/
[root@lite i386]# rpm -U --relocate /var=/home/bartosz/test/var --
relocate /etc=/home/bartosz/test/etc exp-1.0.0-2.i386.rpm
path exp-1.0.0-2.i386.rpm in package exp-1.0.0-2 is not relocateable

Something is wrong!
How to do it?

  b) Relocating three directories
  ===============================
  Install and no relocate
  -----------------------
  The spec file little different (more prefixes)

[root@lite i386]# rpm -qpil exp-1.0.0-1.i386.rpm
Name        : exp
Relocations: /etc/grendel /etc/httpd/conf /var/www/html
Version     : 1.0.0                             Vendor: Bartosz
Release     : 1                             Build Date: Mon 12 Nov
2001 12:02:55 PM CET
Install date: (not installed)               Build Host: lite2
Group       : Application/Servers           Source RPM: exp-1.0.0-
1.src.rpm
Size        : 13297                            License: Commercial
Packager    : Bartosz Placzek <bartosz.placzek@tpg.pl>
URL         : http://www.tpg.pl
Summary     : Exp1
Description :
Just an experimental relocabile package
Copyright © 1997-2001 The Polished Group S.A.
/etc/grendel
/etc/grendel/conf
/etc/grendel/conf/exp1.xml
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf/exp1.conf
/var
/var/www
/var/www/html
/var/www/html/exp1.html
[root@lite i386]# rpm -i exp-1.0.0-1.i386.rpm

$RPM_INSTALL_PREFIX: /etc/grendel
$RPM_INSTALL_PREFIX0: /etc/httpd/conf
$RPM_INSTALL_PREFIX1: /var/www/html
$RPM_INSTALL_PREFIX2:

[root@lite i386]# rpm -ql exp
/etc/grendel
/etc/grendel/conf
/etc/grendel/conf/exp1.xml
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf/exp1.conf
/var
/var/www
/var/www/html
/var/www/html/exp1.html

[root@lite i386]# rpm -q --queryformat="[%{PREFIXES}]\n" exp
/etc/grendel/etc/httpd/conf/var/www/html

[root@lite i386]# rpm -q --queryformat="[%{INSTPREFIXES}]\n" exp
/etc/grendel/etc/httpd/conf/var/www/html

  Everything installed to default dirs.. ok..now:


  Install and relocate 3 dirs
(/etc/grendel /etc/httpd/conf /var/www/html)
  --------------------------------------------------------------------
----

[root@lite i386]# rpm -U --
relocate /etc/httpd/conf=/home/bartosz/test/apache/conf --
relocate /etc/grendel=/home/bartosz/test/grendel/config --
relocate /var/www/html=/home/bartosz/test/apache/htdocs exp-1.0.0-
1.i386.rpm

$RPM_INSTALL_PREFIX: /etc/grendel
$RPM_INSTALL_PREFIX0: /etc/httpd/conf
$RPM_INSTALL_PREFIX1: ome/bartosz/test/apache/htdocs
$RPM_INSTALL_PREFIX2:

[root@lite i386]# rpm -qil exp
Name        : exp
Relocations: /etc/grendel /etc/httpd/conf /var/www/html
Version     : 1.0.0                             Vendor: Bartosz
Release     : 1                             Build Date: Mon 12 Nov
2001 12:02:55 PM CET
Install date: Mon 12 Nov 2001 12:12:35 PM CET      Build Host: lite2
Group       : Application/Servers           Source RPM: exp-1.0.0-
1.src.rpm
Size        : 13297                            License: Commercial
Packager    : Bartosz Placzek <bartosz.placzek@tpg.pl>
URL         : http://www.tpg.pl
Summary     : Exp1
Description :
Just an experimental relocabile package
/etc/grendel
/etc/grendel/conf
/etc/grendel/conf/exp1.xml
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf/exp1.conf
/var
/var/www
/home/bartosz/test/apache/htdocs
/home/bartosz/test/apache/htdocs/exp1.html

[root@lite i386]# rpm -q --queryformat="[%{PREFIXES}]\n" exp
/etc/grendel/etc/httpd/conf/var/www/html

[root@lite i386]# rpm -q --queryformat="[%{INSTPREFIXES}]\n" exp
/etc/grendel/etc/httpd/confome/bartosz/test/apache/htdocs

  Almost :( succesfull ... only one is correctly set.
  I tried all the combinations and always only one, the last one of
directories of the --relocate list is substituted!!

  Once more grateful for any help... bartosz@tpg.pl


**********************************************************************
  Bartosz Placzek
  Programista
  e-mail: bartosz.placzek@tpg.pl
  tel. (+48 12) 424-14-45

  The Polished Group SA
  ul. Emaus 5, 30-201 Krakow, Poland
  tel. (+48 12) 424-14-00
  fax. (+48 12) 424 14 01
  http://www.tpg.pl








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []