Help!

Using Environment variables in %files section

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> PRM - Partner Relationship Management RSS
Next:  Probleme mit Hardware unter Suse 10.2 - Kanotix k..  
Author Message
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Wed Jan 24, 2007 7:31 am    Post subject: Using Environment variables in %files section
Archived from groups: linux>redhat>rpm (more info?)

I have just started using RPM Packager. While creating the SPEC file I
am facing some Issues. The required file for packaging are in $STAGING
directory, where STAGING is an environment variable set in Linux.
I am specifying it in %files tag as

%files

$STAGING/linux/readme.html


I am getting an error for this. Can someone please guide me on how to
use the Linux Environment variable in %files section.
Back to top
Scott Lurndal
External


Since: Oct 20, 2004
Posts: 82



PostPosted: Thu Jan 25, 2007 12:55 am    Post subject: Re: Using Environment variables in %files section [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Rajeshwaran" <rajeshwaran.a RemoveThis @gmail.com> writes:
>
>
>I have just started using RPM Packager. While creating the SPEC file I
>am facing some Issues. The required file for packaging are in $STAGING
>directory, where STAGING is an environment variable set in Linux.
>I am specifying it in %files tag as
>
>%files
>
>$STAGING/linux/readme.html
>
>
>I am getting an error for this. Can someone please guide me on how to
>use the Linux Environment variable in %files section.
>

Add it to your ~/.rpmmacros file:

..rpmmacros:
%_staging /path/to/staging/directory

Then use '%_staging' in your %files section, instead of $STAGING.

scott
Back to top
Scott Lurndal
External


Since: Oct 20, 2004
Posts: 82



PostPosted: Thu Jan 25, 2007 1:52 am    Post subject: Re: Using Environment variables in %files section [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

scott DeleteThis @slp53.sl.home (Scott Lurndal) writes:
>"Rajeshwaran" <rajeshwaran.a DeleteThis @gmail.com> writes:
>>
>>
>>I have just started using RPM Packager. While creating the SPEC file I
>>am facing some Issues. The required file for packaging are in $STAGING
>>directory, where STAGING is an environment variable set in Linux.
>>I am specifying it in %files tag as
>>
>>%files
>>
>>$STAGING/linux/readme.html
>>
>>
>>I am getting an error for this. Can someone please guide me on how to
>>use the Linux Environment variable in %files section.
>>
>
>Add it to your ~/.rpmmacros file:
>
>.rpmmacros:
>%_staging /path/to/staging/directory
>
>Then use '%_staging' in your %files section, instead of $STAGING.
>
>scott

Actually, this probably won't work. The files in %files must be
in $RPM_BUILD_ROOT.

So use the %_staging variable in your %install section to copy
the source file to your $RPM_BUILD_ROOT, then use the path relative
to $RPM_BUILD_ROOT in your %files section.

scott
Back to top
Michal Jaegermann
External


Since: Jun 06, 2004
Posts: 62



PostPosted: Thu Jan 25, 2007 9:38 pm    Post subject: Re: Using Environment variables in %files section [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Rajeshwaran <rajeshwaran.a RemoveThis @gmail.com> wrote:
>
> The required file for packaging are in $STAGING
> directory, where STAGING is an environment variable set in Linux.
> I am specifying it in %files tag as
>
> %files
>
> $STAGING/linux/readme.html

%define readme %(echo "$STAGING/linux/readme.html")

%files
%attr(755,root,root) %{readme}

Is that what you mean? Consider using %doc instead and is really
necessary supply a symlink in your package.

If you want to install everything in a $STAGING directory, when $STAGING
is not known in advance, then look at '--prefix=...' installation option
but then you cannot use absolute paths anywhere. Otherwise you have to
supply _only_ src.rpm and 'rpmbuild --rebuild ....' every time when
needed with a proper enviroment set (and checks, or defaults, if
this is not the case).

Michal
Back to top
Michal Jaegermann
External


Since: Jun 06, 2004
Posts: 62



PostPosted: Thu Jan 25, 2007 9:44 pm    Post subject: Re: Using Environment variables in %files section [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Scott Lurndal <scott DeleteThis @slp53.sl.home> wrote:
>
> So use the %_staging variable in your %install section to copy
> the source file to your $RPM_BUILD_ROOT,

That is right.

> then use the path relative
> to $RPM_BUILD_ROOT in your %files section.

And that is not. In %files you list locations where all elements will
end up when you will install a resulting package. Consult
http://fedora.redhat.com/docs/drafts/rpm-guide-en/
for all gory details.

Michal
Back to top
Rajeshwaran
External


Since: Jul 10, 2006
Posts: 10



PostPosted: Wed Feb 07, 2007 12:16 am    Post subject: Re: Using Environment variables in %files section [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 26, 2:38 am, Michal Jaegermann <mic....RemoveThis@gortel.phys.ualberta.ca>
wrote:
> Rajeshwaran <rajeshwara....RemoveThis@gmail.com> wrote:
>
> > The required file for packaging are in $STAGING
> > directory, where STAGING is an environment variable set in Linux.
> > I am specifying it in %files tag as
>
> > %files
>
> > $STAGING/linux/readme.html
>
> %define readme %(echo "$STAGING/linux/readme.html")
>
> %files
> %attr(755,root,root) %{readme}
>
> Is that what you mean? Consider using %doc instead and is really
> necessary supply a symlink in your package.
>
> If you want to install everything in a $STAGING directory, when $STAGING
> is not known in advance, then look at '--prefix=...' installation option
> but then you cannot use absolute paths anywhere. Otherwise you have to
> supply _only_ src.rpm and 'rpmbuild --rebuild ....' every time when
> needed with a proper enviroment set (and checks, or defaults, if
> this is not the case).
>
> Michal

Hi Guys,

Thanks a lot for your answers. I was finally able to solve it. What I
did was just pass the new $STAGING Path in the rpmbuild command. It
works like this....


rpmbuild -bb $PHOENIX/install/linux/SPECS/nsmasmvca.spec --define
"STAGING $STAGING"


Thus I am setting a new variable STAGING inside the spec which will
have the $STAGING environment variable. Thus it worked finally.

Thanks again Guys.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> PRM - Partner Relationship Management All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum