Files listed twice question
Firstly, thank you for your answer Valery.
I didn't think of including this in my previous mail, but your comments tells me it's relevant: I'm using rpm version 4.4.2 on CentOS 5.2. Did I mention I'm the epitome of laziness? I've read about using find to auto generate the file list, but then I'd have to 1) make the script and 2) run it for every release prior to packaging. Whereas the individual files are bound to change significantly between releases, the config dirs are pretty much fixed, so a setup like the one I had in mind would be a one-time deal which I could unscrupulously copy/paste for all future releases, thus taking me a step closer towards doing absolutely nothing in exchange for my salary, which is my ultimate goal in life. I'm afraid I might not have understood what you meant by: >> It allows cross-check between installation files into build-root and filelist you mean there's those extra checks such as that if I list a file that is missing in the build-root the build will fail, and if the opposite happens I'll be warned that there are files I haven't listed in my build-root? If so, I can't see the benefit, since (as I understood it) I'd be running the find script to list whatever files end up in my build root anyway, so in effect, there'd be no difference to globbing regarding what files I'm including. If possible, please clarify this a bit for me in the very likely case that I'm missing something. As I gathered from past discussions the good thing about listing files explicitly was that you could easily compare spec files to find out what changed between releases. Are there other advantages? All that being said, my original questions still stand. Can the warnings be ignored? Is there a better way of doing what I want without explicitly listing files? Thank you all. Adrián. Valery Reznic escribió: --- On Wed, 9/24/08, Adrián Márques <amarques@geocom.com.uy> wrote: From: Adrián Márques <amarques@geocom.com.uy> Subject: Files listed twice question To: rpm-list@redhat.com Date: Wednesday, September 24, 2008, 9:28 PM Hi there, I'm an absolute newbie trying to package an application with RPM for the first time and would like to mark some files as config files. The top directory of this aplication has several files and directories, only two of which hold config files. Thus, I'm doing something like this in my spec file: %files /usr/local/myAppTopDir/ %config /usr/local/myAppTopDir/configDir1/* %config /usr/local/myAppTopDir/configDir2/* Obviously, this generates several 'file listed twice' warnings. However, I queried the generated rpm and didn't find anything wrong with it. All config files where included and correctly marked as config files. So my questions are: can I safely ignore these warnings or listing files twice like I have causes a problem I'm not seeing now? is there a better way to do what I want? I have been looking through the list archives so I know many of you would advice me to explicitly list all files. I know this would take care of this particular problem, but I don't want to do that unless I really have to, since I find globbing significantly more practical in this case. It's strange that it's only warning at least before it was error. I personally prefer am list file explicit. It'sallows cross-check between installation files into build-root and filelist. If you haven't too much files I suggest explicitly list them. If you have too much you can use find to generate filelist on the fly. Valery I thank you already for taking the time to read this. Regards. Adrián. _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
Files listed twice question
> I'm an absolute newbie trying to package an application with RPM for the
> first time and would like to mark some files as config files. > The top directory of this aplication has several files and directories, > only two of which hold config files. Thus, I'm doing something like this > in my spec file: > > %files > /usr/local/myAppTopDir/ > %config /usr/local/myAppTopDir/configDir1/* > %config /usr/local/myAppTopDir/configDir2/* > > Obviously, this generates several 'file listed twice' warnings. However, > I queried the generated rpm and didn't find anything wrong with it. All > config files where included and correctly marked as config files. > > So my questions are: can I safely ignore these warnings or listing files > twice like I have causes a problem I'm not seeing now? is there a better > way to do what I want? You could ignore them, but it is not recommended. The problem is that you are effectively listing them twice the way you have it above. Your first entry "/usr/local/myAppTopDir/" tells it to add that directory and everything under it. Your next two entries and inside that first entry's list. > I have been looking through the list archives so I know many of you > would advice me to explicitly list all files. I know this would take > care of this particular problem, but I don't want to do that unless I > really have to, since I find globbing significantly more practical in > this case. I agree that globbing tends to be a bit easier to handle in some cases as you are learning. You could list your first entry with a %doc prefix, and then provide more specific blobbing for the rest of that first entries contents. Does that make sense? Another method you can try, and based on your later comments I think you've realized the debate-ability of auto-listing, is something like what will follow. I do this to gather up file lists for when I package Informix: %define INSTALLDIR /opt/informix %install <snip> find $INSTALLDIR -printf "%y&attr(%m,%u,%g) %p " | grep -v "$INSTALLDIR/etc/.*" | sed 's/^d/\%dir /' | sed 's/&/%/' | sed 's/^[^%]//' | sed 's!%{buildroot}!!' > %{_tmppath}/%{name}-files find $INSTALLDIR/etc -printf "%y&config &attr(%m,%u,%g) %p " -not -type d | grep -v "^[dl]" |grep -v "$INSTALLDIR/etc$"| sed 's/&/%/g' | sed 's/^f//' | sed 's!%{buildroot}!!' >> %{_tmppath}/%{name}-files %files -f %{_tmppath}/%{name}-files Now... its a tad convoluted, but basically the first find does this: 1: find everything in the $INSTALLDIR and print it to stdout as "<type>&attr(<mode>,<uid>,<gid>) /path/to/file " 2: Ignore all files in my $INSTALLDIR/etc directory cause I want to specify them later as config files 3: If a line starts with d its a directory, so label it as such 4: change the & in &attr to %, thus %attr 5: Any line that doesnt start with a %, needs to 6: Remove the %{buildroot} path from each line (I use the ! so I dont have to worry about escaping the slashes) 7: write to file And the second one does this: 1: find everything that is not a directory in $INSTALLDIR/etc and print it to stdout as: "<type>&config &attr(<mode>,<uid>,<gid>) /path/to/file " 2: If a line starts with d or l ignore it 3: Get rid of the line that is the $INSTALLDIR/etc path 4: change the & in &attr to %, thus %attr 5: Any line that starts with F, remove the f 6: Remove the %{buildroot} path from each line (I use the ! so I dont have to worry about escaping the slashes) 7: append to the file If anyone has a nicer method i'd love to see it. It took me a while to clean it up to this point. -greg _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
Files listed twice question
In regard to: Re: Files listed twice question, Greg_Swift@aotx.uscourts.gov...:
I'm an absolute newbie trying to package an application with RPM for the first time and would like to mark some files as config files. The top directory of this aplication has several files and directories, only two of which hold config files. Thus, I'm doing something like this in my spec file: %files /usr/local/myAppTopDir/ %config /usr/local/myAppTopDir/configDir1/* %config /usr/local/myAppTopDir/configDir2/* Obviously, this generates several 'file listed twice' warnings. However, I queried the generated rpm and didn't find anything wrong with it. All config files where included and correctly marked as config files. So my questions are: can I safely ignore these warnings or listing files twice like I have causes a problem I'm not seeing now? is there a better way to do what I want? You could ignore them, but it is not recommended. The problem is that you are effectively listing them twice the way you have it above. Your first entry "/usr/local/myAppTopDir/" tells it to add that directory and everything under it. Your next two entries and inside that first entry's list. My recommendation would be to just use a couple more globs: %files %dir /usr/local/myAppTopDir # this should catch most non-hidden files and dirs, except those that # start with c or other non-alpha characters. /usr/local/myAppTopDir/[A-Za-bd-z0-9]* # # If you have any other files or directories that start with c, beyond # configDir1 and configDir2, you'll need to list them or use a glob # that catches them but not configDir? , something like # # /usr/local/myAppTopDir/c[A-Za-np-z0-9]* # %dir /usr/local/myAppTopDir/configDir1 %config /usr/local/myAppTopDir/configDir1/* %dir /usr/local/myAppTopDir/configDir2 %config /usr/local/myAppTopDir/configDir2/* I also personally avoid the use of auto-generated files lists. Tim -- Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu Enterprise Computing & Infrastructure 701-231-1076 (Voice) Room 242-J6, IACC Building 701-231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164 _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
Files listed twice question
Thanks a lot Greg and Tim for your answers.
They were very helpful and are much appreciated. Adrián. Greg_Swift@aotx.uscourts.gov escribió: I'm an absolute newbie trying to package an application with RPM for the first time and would like to mark some files as config files. The top directory of this aplication has several files and directories, only two of which hold config files. Thus, I'm doing something like this in my spec file: %files /usr/local/myAppTopDir/ %config /usr/local/myAppTopDir/configDir1/* %config /usr/local/myAppTopDir/configDir2/* Obviously, this generates several 'file listed twice' warnings. However, I queried the generated rpm and didn't find anything wrong with it. All config files where included and correctly marked as config files. So my questions are: can I safely ignore these warnings or listing files twice like I have causes a problem I'm not seeing now? is there a better way to do what I want? You could ignore them, but it is not recommended. The problem is that you are effectively listing them twice the way you have it above. Your first entry "/usr/local/myAppTopDir/" tells it to add that directory and everything under it. Your next two entries and inside that first entry's list. I have been looking through the list archives so I know many of you would advice me to explicitly list all files. I know this would take care of this particular problem, but I don't want to do that unless I really have to, since I find globbing significantly more practical in this case. I agree that globbing tends to be a bit easier to handle in some cases as you are learning. You could list your first entry with a %doc prefix, and then provide more specific blobbing for the rest of that first entries contents. Does that make sense? Another method you can try, and based on your later comments I think you've realized the debate-ability of auto-listing, is something like what will follow. I do this to gather up file lists for when I package Informix: %define INSTALLDIR /opt/informix %install <snip> find $INSTALLDIR -printf "%y&attr(%m,%u,%g) %p " | grep -v "$INSTALLDIR/etc/.*" | sed 's/^d/\%dir /' | sed 's/&/%/' | sed 's/^[^%]//' | sed 's!%{buildroot}!!' > %{_tmppath}/%{name}-files find $INSTALLDIR/etc -printf "%y&config &attr(%m,%u,%g) %p " -not -type d | grep -v "^[dl]" |grep -v "$INSTALLDIR/etc$"| sed 's/&/%/g' | sed 's/^f//' | sed 's!%{buildroot}!!' >> %{_tmppath}/%{name}-files %files -f %{_tmppath}/%{name}-files Now... its a tad convoluted, but basically the first find does this: 1: find everything in the $INSTALLDIR and print it to stdout as "<type>&attr(<mode>,<uid>,<gid>) /path/to/file " 2: Ignore all files in my $INSTALLDIR/etc directory cause I want to specify them later as config files 3: If a line starts with d its a directory, so label it as such 4: change the & in &attr to %, thus %attr 5: Any line that doesnt start with a %, needs to 6: Remove the %{buildroot} path from each line (I use the ! so I dont have to worry about escaping the slashes) 7: write to file And the second one does this: 1: find everything that is not a directory in $INSTALLDIR/etc and print it to stdout as: "<type>&config &attr(<mode>,<uid>,<gid>) /path/to/file " 2: If a line starts with d or l ignore it 3: Get rid of the line that is the $INSTALLDIR/etc path 4: change the & in &attr to %, thus %attr 5: Any line that starts with F, remove the f 6: Remove the %{buildroot} path from each line (I use the ! so I dont have to worry about escaping the slashes) 7: append to the file If anyone has a nicer method i'd love to see it. It took me a while to clean it up to this point. -greg _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
Files listed twice question
Adrián Márques wrote:
Hi there, I'm an absolute newbie trying to package an application with RPM for the first time and would like to mark some files as config files. The top directory of this aplication has several files and directories, only two of which hold config files. Thus, I'm doing something like this in my spec file: %files /usr/local/myAppTopDir/ Just a question - any reason in particular why you are using /usr/local instead of /opt ? /usr/local is suppose to be for applications compiled from source on the machine, /opt is for third party vendor packages (be they rpm or tarball or whatever) %config /usr/local/myAppTopDir/configDir1/* %config /usr/local/myAppTopDir/configDir2/* Obviously, this generates several 'file listed twice' warnings. However, I queried the generated rpm and didn't find anything wrong with it. All config files where included and correctly marked as config files. So my questions are: can I safely ignore these warnings or listing files twice like I have causes a problem I'm not seeing now? is there a better way to do what I want? I usually do something like this - echo "%%defattr(-,root,root,-)" > custom.list for dir in `find $RPM_BUILD_ROOT/usr/local -type d`; do fixed="`echo ${dir} |sed s?"$RPM_BUILD_ROOT"?""?`" if [ `echo $fixed |grep -c "configDir"` -eq 0 ]; then echo "%%dir $fixed" >> custom.list fi done for file in `find RPM_BUILD_ROOT/usr/local -type f`; do etc. then %files -f custome.list %defattr(-,root,root.-) %config /usr/local/myAppTopDir/configDir1/* %config /usr/local/myAppTopDir/configDir2/* If the config files are something the sysadmin is to edit, it's generally a good idea to do %config(noreplace) instead of just %config I have been looking through the list archives so I know many of you would advice me to explicitly list all files. I know this would take care of this particular problem, but I don't want to do that unless I really have to, since I find globbing significantly more practical in this case. I thank you already for taking the time to read this. Regards. Adrián. _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
Files listed twice question
Thanks a lot Michael for your answers.
I was using /usr/local out of sheer ignorance of the fact that /opt was a better choice in this case, so your comment in this regard was very helpful. Regards. Adrián. Michael A. Peters wrote: > Adrián Márques wrote: >> Hi there, >> >> I'm an absolute newbie trying to package an application with RPM for >> the first time and would like to mark some files as config files. >> The top directory of this aplication has several files and >> directories, only two of which hold config files. Thus, I'm doing >> something like this in my spec file: >> >> %files >> /usr/local/myAppTopDir/ > > Just a question - any reason in particular why you are using > /usr/local instead of /opt ? > > /usr/local is suppose to be for applications compiled from source on > the machine, /opt is for third party vendor packages (be they rpm or > tarball or whatever) > >> %config /usr/local/myAppTopDir/configDir1/* >> %config /usr/local/myAppTopDir/configDir2/* >> >> Obviously, this generates several 'file listed twice' warnings. >> However, I queried the generated rpm and didn't find anything wrong >> with it. All config files where included and correctly marked as >> config files. >> >> So my questions are: can I safely ignore these warnings or listing >> files twice like I have causes a problem I'm not seeing now? is there >> a better way to do what I want? > > I usually do something like this - > > echo "%%defattr(-,root,root,-)" > custom.list > for dir in `find $RPM_BUILD_ROOT/usr/local -type d`; do > fixed="`echo ${dir} |sed s?"$RPM_BUILD_ROOT"?""?`" > if [ `echo $fixed |grep -c "configDir"` -eq 0 ]; then > echo "%%dir $fixed" >> custom.list > fi > done > for file in `find RPM_BUILD_ROOT/usr/local -type f`; do > etc. > > then > > %files -f custome.list > %defattr(-,root,root.-) > %config /usr/local/myAppTopDir/configDir1/* > %config /usr/local/myAppTopDir/configDir2/* > > If the config files are something the sysadmin is to edit, it's > generally a good idea to do > > %config(noreplace) instead of just %config > >> >> I have been looking through the list archives so I know many of you >> would advice me to explicitly list all files. I know this would take >> care of this particular problem, but I don't want to do that unless I >> really have to, since I find globbing significantly more practical in >> this case. >> >> I thank you already for taking the time to read this. >> >> Regards. >> >> Adrián. >> >> _______________________________________________ >> Rpm-list mailing list >> Rpm-list@redhat.com >> https://www.redhat.com/mailman/listinfo/rpm-list > > _______________________________________________ > Rpm-list mailing list > Rpm-list@redhat.com > https://www.redhat.com/mailman/listinfo/rpm-list _______________________________________________ Rpm-list mailing list Rpm-list@redhat.com https://www.redhat.com/mailman/listinfo/rpm-list |
| All times are GMT. The time now is 06:31 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.