-1

When I do

rpmbuild -bi ~/rpmbuild/SPECS/microemacs.spec

The result is

>g++ -g -I. -I../src basic.o bind.o buffer.o char.o crypt.o display.o eval.o exec.o file.o 
> fileio.o input.o isearch.o line.o main.o malloc.o mouse.o msdir.o random.o region.o search.o
> sinc.o tag.o window.o word.o map.o unix.o terminal.o lock.o  -o microemacs
>
>+ exit 0
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.dzYbvW
> + umask 022
> + cd /home/<redacted>/rpmbuild/BUILD
> + '[' /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64 '!=' / ']'
> + rm -rf /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> ++ dirname /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> + mkdir -p /home/<redacted>/rpmbuild/BUILDROOT
> + mkdir /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> + cd microemacs-2.9
> + echo /home/<redacted>/rpmbuild/BUILD/unix
> /home/<redacted>/rpmbuild/BUILD/unix
> + cd /home/<redacted>/rpmbuild/BUILD/microemacs-2.9
> + cd unix
> + cp microemacs /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + cp ../macros/.emacsrc /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + cp ../src/microemacs.md /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/smit_pet/rpmbuild/BUILD/microemacs-2.9
> extracting debug info from /home/smit_pet/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/microemacs
> dwz: Too few files for multifile optimization
> /usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
> 1019 blocks
> + /usr/lib/rpm/check-buildroot
> + /usr/lib/rpm/redhat/brp-compress
> + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
> + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
> + /usr/lib/rpm/redhat/brp-python-hardlink
> + /usr/lib/rpm/redhat/brp-java-repack-jars
> Processing files: microemacs-2.9-0.x86_64
> error: File must begin with "/": microemacs
> error: File must begin with "/": .emacsrc
> error: File must begin with "/": microemacs.md
> 
> RPM build errors:
>   File must begin with "/": microemacs
>   File must begin with "/": .emacsrc
>   File must begin with "/": microemacs.md

I do not understand how the distinction between BUILD BUILDROOT or how the results get to the target and how %file features in this.

Also why the /usr/lib action and why and how is this happening?

I want the results to end up in ~/bin/ and I can do this with a manual copy in %install but I think this is not the correct way.

Also nothing prints Hello.

The .spec file is

> SPECS/microemacs.spec

> Name:           microemacs                                                      
> %define version 2.9                                                             
> Version:        %{version}                                                      
> Release:        0                                                               
> Summary:        Microemacs program code editor                                  
> Group:          Applications/Development                                        
> License:        GPL 3.0 License                                                 
> URL:            .                                                               
> Vendor:         .                                                               
> Source:         microemacs-%{version}.tar.gz                                    
> Prefix:         %{_prefix}                                                      
> Packager:       .                                                     
> BuildRoot:      %{_tmppath}/%{name}-root                                        
> 
> %description                                                                    
> A text editor suporting                                                         
>  + Piping input into it.                                                        
>  + Editting Directories and their contents.                                     
>  + Taking text from the buffer into the command line                            
> 
> %prep                                                                           
> 
> %setup -q                                                                       
> 
> %build                                                                          
> echo Hello                                                                      
> pwd                                                                             
> cd ./unix                                                                       
> make                                                                            
>
> %install                                                                        
> echo %{_builddir}/unix                                                          
> cd %{_builddir}/microemacs-%{version}                                           
> cd unix                                                                         
> cp microemacs    %{buildroot}/                                                  
> cp ../macros/.emacsrc    %{buildroot}/                                          
> cp ../src/microemacs.md    %{buildroot}/                                        
> 
> %clean                                                                          
> cd ${_builddir}/microemacs-%{version}/unix                                      
> make clean                                                                      
> 
> %files                                                                          
> %defattr(-,root,root)                                                           
> microemacs                                                                      
> .emacsrc                                                                        
> microemacs.md    

 
msuchy
  • 5,162
  • 1
  • 14
  • 26
Questaware
  • 87
  • 5

1 Answers1

0

The %buildroot during the %install phase is directory where you create the layout of target. I.e., how it will be stored in final rpm.

When you have:

%install
cp microemacs %{buildroot}/

then you have to have

%files
/microemacs

But you likely want to have:

%install
cp -a microemacs %{buildroot}%{_bindir}/microemacs

%files
%{_bindir}/microemacs
%doc microemacs.md

This will place the microemacs to /usr/bin and microemacs.md to /usr/share/doc - no need to cp microemacs.md there during %install as the %doc macro will take care of it.

msuchy
  • 5,162
  • 1
  • 14
  • 26