LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-01-2017, 10:44 AM   #1
threezerous
Member
 
Registered: Jul 2009
Posts: 96

Rep: Reputation: 16
rpmbuild for installing files in multiple directories


This should be something simple, but I can't seem to figure out the obvious. However, this is my first try at using rpmbuild.

The requirement is to create an RPM which will install files as below:
Basically 2 separate directory paths and multiple files under each.

Code:
/parentdir/dirA/subdira/subdirb/file1
/parentdir/dirA/subdira/subdirb/file2

/parentdir/dirB/subdirp/subdirq/file3
/parentdir/dirB/subdirp/subdirq/file4

I created the rpmbuild structure under my home directory /home/threezerous as follows
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

My .rpmmacros is as follows
Code:
%_topdir        /home/threezerous/rpm
%_tmppath       /home/threezerous/rpm/tmp
My spec is as below:
Code:
%define name    appname
Name:           appname
Version:        1.0
Release:        1
Summary:        v1.0 - install jar lib files for appname
Group:          groupname
BuildArch:      noarch
License:        NA
URL:            http://xyz.com
#Source0:
BuildRoot:      %{_builddir}/${name}-root
#BuildRequires:
#Requires:
%description
%prep
exit 0
%build
tar -cvzf /tmp/dirA.tgz /parentdir/dirA/*
tar -cvzf /tmp/dirB.tgz /parentdir/dirB/*
tar -cvzf /tmp/appname.tgz /tmp/*.tgz
exit 0
%install
tar -xvzf /tmp/dirA.tgz
tar -xvzf /tmp/dirB.tgz
exit 0
%clean
exit 0
%files
%defattr(-,405,405,-)
/parentdir/dirA/subdira
/parentdir/dirB/subdirp
%changelog
* Wed Apr 27 2017 threezerous - 1.0
- Created new spec file for appname RPM
Something wrong definitely in the spec file, since running rpmbuild -bb test.spec from my home dir gives the following error towards the end
error: File not found: /home/threezerous/rpm/BUILDROOT/
Code:
error: File not found: /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64/parentdir/dirA/subdira
error: File not found: /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64/parentdir/dirB/subdirp
Any suggestions/help is much appreciated. Also, I value your time so provided as much info as I could and I have run the actual example above.

Thanks
 
Old 05-01-2017, 12:17 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,430

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Quote:
error: File not found: /home/threezerous/rpm/BUILDROOT/
Usually it's like : "....../appname-1.0-1.x86_64/parentdir" not found.

An easy fix ...
$ mkdir -p /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64
.... and then copy 'parentdir/' with itīs content into BUILDROOT/appname-1.0-1.x86_64/


-

Last edited by knudfl; 05-01-2017 at 12:18 PM.
 
Old 05-01-2017, 04:06 PM   #3
threezerous
Member
 
Registered: Jul 2009
Posts: 96

Original Poster
Rep: Reputation: 16
Thanks for your suggestion @knudfl. I tried creating that dir+ file structure as directed. But apparently when I run the rpmbuild command, it deletes the contents of the dir /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64/ and then fails with the same error.

Quote:
Usually it's like : "....../appname-1.0-1.x86_64/parentdir" not found.
You are right about that. The complete error is
Code:
error: File not found: /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64/parentdir/dirA/subdira
error: File not found: /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64/parentdir/dirB/subdirp
 
Old 05-01-2017, 04:32 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,430

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Quote:
when I run the rpmbuild command, it deletes the contents of the dir /home/threezerous/rpm/BUILDROOT
OK, then give it a try again .... until you have the right directory :
$ mkdir -p /home/threezerous/rpm/BUILDROOT/appname-1.0-1.x86_64
... or whatever the right name is for the application.


-
 
  


Reply

Tags
rpmbuild


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to make python use multiple .py files from multiple directories terry2179 Programming 4 11-09-2015 03:21 PM
[SOLVED] How to search multiple directories for multiple files? Batistuta_g_2000 Linux - Newbie 4 02-26-2013 11:36 AM
Bash Question(for loop): How to Zip multiple files under multiple directories Znrall Linux - General 2 08-01-2012 01:52 PM
Change text in multiple files in multiple directories vivo2341 Linux - General 5 11-27-2006 08:16 PM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 05:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration