[opensuse-packaging] Variables in %Files Section

Hi List, simple Question. On top of spec i declare Variable: %define HOSTNAME_SHORT `/bin/hostname -s` As %{HOSTNAME_SHORT} I can use it in %install or %post section with success but i get an error in %files section. I get error: Processing files: mailgraph-1.14-1 error: Two files on one line: /my/path/`/bin/hostname error: File must begin with "/": -s`/subpath/file.txt What could be the problem? Thank you Andre --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Andre Hübner wrote:
%define HOSTNAME_SHORT `/bin/hostname -s`
Processing files: mailgraph-1.14-1 error: Two files on one line: /my/path/`/bin/hostname error: File must begin with "/": -s`/subpath/file.txt
What could be the problem?
You define the variable to the verbatim string "`/bin/hostname -s`". In the scripts this is substituted for the output of /bin/hostname -s, but it fails in the %files section. But the real problem is somewhere else -- why do you need to store the build host name in the package? Michal --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

----- Original Message ----- From: "Michal Marek" <mmarek@suse.cz> To: "Andre Hübner" <andre.huebner@gmx.de> Cc: <opensuse-packaging@opensuse.org> Sent: Monday, June 02, 2008 3:09 PM Subject: Re: [opensuse-packaging] Variables in %Files Section
Andre Hübner wrote:
%define HOSTNAME_SHORT `/bin/hostname -s`
Processing files: mailgraph-1.14-1 error: Two files on one line: /my/path/`/bin/hostname error: File must begin with "/": -s`/subpath/file.txt
What could be the problem?
You define the variable to the verbatim string "`/bin/hostname -s`". In the scripts this is substituted for the output of /bin/hostname -s, but it fails in the %files section.
But the real problem is somewhere else -- why do you need to store the build host name in the package?
Michal --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
i package some server-tools which have to be installed on this individual folder cause control domain of server points to this document-root first time that i use Variables in %files section, in %install section a correct path is composed... Thanks Andre --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Andre Hübner napsal(a):
----- Original Message ----- From: "Michal Marek" <mmarek@suse.cz>
You define the variable to the verbatim string "`/bin/hostname -s`". In the scripts this is substituted for the output of /bin/hostname -s, but it fails in the %files section.
But the real problem is somewhere else -- why do you need to store the build host name in the package?
i package some server-tools which have to be installed on this individual folder cause control domain of server points to this document-root
But you do realize that such package will only work on the machine where you build it? There must be a number of ways how to avoid this kind of packaging. Michal --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Andre Hübner escribió:
What could be the problem?
The problem is that what are you trying to do does not make much sense. -- "Progress is possible only if we train ourselves to think about programs without thinking of them as pieces of executable code.” - Edsger W. Dijkstra Cristian Rodríguez R. Platform/OpenSUSE - Core Services SUSE LINUX Products GmbH Research & Development http://www.opensuse.org/

The problem is that what are you trying to do does not make much sense.
you should not mix up sense with a misunderständing of the %files section... there was good help from list and case is solved, it is working. andre --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

On 2008-06-03 21:27:23 +0200, Andre Huebner wrote:
The problem is that what are you trying to do does not make much sense.
you should not mix up sense with a misunderständing of the %files section... there was good help from list and case is solved, it is working.
Just because it works now, doesnt mean it is correct. Jumping from a high bridge works too. i wouldnt advice to do that anyway. See the comments from Michal why hardcoding the hostname of the buildhost into a rpm. darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Marcus Rueckert wrote:
See the comments from Michal why hardcoding the hostname of the buildhost into a rpm.
In order that I don't sound as a grumpy old man ;-), here's something more constructive: Package the files with static paths and create a host-dependent symlink at _install_ time in the %post scriptlet (and remove it in %postun). Michal --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Hi, On Wed, 4 Jun 2008, Michal Marek wrote:
In order that I don't sound as a grumpy old man ;-), here's something more constructive: Package the files with static paths and create a host-dependent symlink at _install_ time in the %post scriptlet (and remove it in %postun).
Which is what I suggested. Ciao, Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (6)
-
Andre Huebner
-
Andre Hübner
-
Cristian Rodríguez
-
Marcus Rueckert
-
Michael Matz
-
Michal Marek