Description of problem: usbutils-0.73 does not robustly package the included usb.ids file, nor include the updateing script Additionally, it has a hardcoded /sbin/ rather than using %{_sbindir} the following patch addresses both [herrold@centos-5 usbutils-0.73]$ diff -u usbutils.spec-ORIG usbutils.spec --- usbutils.spec-ORIG 2008-10-07 16:06:25.000000000 -0400 +++ usbutils.spec 2008-10-07 16:41:58.000000000 -0400 @@ -1,6 +1,6 @@ Name: usbutils Version: 0.73 -Release: 2%{?dist} +Release: 3%{?dist} Source: http://downloads.sourceforge.net/linux-usb/%{name}-%{version}.tar.gz Patch1: usbutils-0.73-hwdata.patch URL: http://www.linux-usb.org/ @@ -23,7 +23,7 @@ %patch1 -p1 -b .hwdata %build -%configure --sbindir=/sbin +%configure --sbindir=%{_sbindir} make %{?_smp_mflags} %install @@ -31,20 +31,53 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" # remove unpackaged files from the buildroot -rm -rf $RPM_BUILD_ROOT%{_libdir} -rm -rf $RPM_BUILD_ROOT%{_includedir} -rm -f $RPM_BUILD_ROOT%{_datadir}/usb.ids* +# rm -rf $RPM_BUILD_ROOT%{_libdir} +# rm -rf $RPM_BUILD_ROOT%{_includedir} +# rm -f $RPM_BUILD_ROOT%{_datadir}/usb.ids* +cp update-usbids.sh $RPM_BUILD_ROOT%{_sbindir} +cp usb.ids $RPM_BUILD_ROOT%{_datadir}/usb.ids_shipped +gzip $RPM_BUILD_ROOT%{_datadir}/usb.ids_shipped +# the following is in case the retrieval fails in the %post +cp $RPM_BUILD_ROOT%{_datadir}/usb.ids_shipped.gz $RPM_BUILD_ROOT%{_datadir}/usb.ids.gz %files %defattr(-,root,root,-) -%{_mandir}/*/* -/sbin/* +%{_mandir}*/* +%{_sbindir}* +%config %{_datadir}/usb* %doc AUTHORS COPYING ChangeLog NEWS README +%post +# freshen the configs; guard against, trap and fix retrieval errors +cd %{_datadir} +[ -e usb.ids.gz ] && cp -f usb.ids.gz usb.ids.gz-BAK +update-usbids.sh 2> /dev/null || : +# discard any failed DL +[ -z usb.ids.new ] && rm -f usb.ids.new +# use a good DL; rename as needed +[ -e usb.ids.new ] && mv usb.ids.new usb.ids +[ -e usb.ids ] && { +# now it is safe to get rid of the backup master + [ -e usb.ids.gz ] && rm -f usb.ids.gz + gzip usb.ids + } +# rollback to account for a non-usable result state +[ -z usb.ids.gz ] && cp usb.ids.gz-BAK usb.ids.gz +# get a zero return code for the post script +echo "" > /dev/null + +%postun +# place a canary so the rm will always silently succeed +touch %{_datadir}/usb.ids-canary +rm -f `find %{_datadir} -name 'usb.ids*' | grep -v rpmsave$` + %clean rm -rf $RPM_BUILD_ROOT %changelog +* Tue Oct 07 2008 R P Herrold <info> 0.73-3 +- add update script, reference file, and mark the latter as a config file + * Tue Feb 12 2008 Jiri Moskovcak <jmoskovc> 0.73-2 - spec file cleanup [herrold@centos-5 usbutils-0.73]$
I had forgotten to account for the hwdata patch, and have applied its result, so that the usb.ids file ends in the proper place. Sorry. I will upload a patch in a moment -- Russ herrold
Created attachment 319699 [details] updatable usb.ids addition
Hi Herrold, thanks for your patch, but I don't think updating files that belong to some package is good idea other it's against RPM logic. Imagine if someone hacks the source you're downloading from and you download some evil script. It totally overrides all rpm security mechanism like checksums and package signing. The only clean way is to update hwdata and then install this updated package. Jirka
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle. Changing version to '10'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Hi, Jirka Concur that the automated DL may not be applicable. but the other changes -- getting the missing files into the packaging, and changed to conform to Fedora packaging standards, etc remain relevant. Moving back to RawHide, for this 'cleanup' work -- Russ herrold
missed ticking the RawHide dropbox .. amending
There are two requests here: 1. to include certain mising files {which I think is not controversial} 2. to provide for inclusiong of a safe update mechanism, similar to pciutils {which you mentioned having issues in doing ...} Do you need for me to clone this into two bugs, and separate them to get the first part done? -- Russ herrold
Add update-usbids.sh script to the package. Or update hwdata package on a daily basis. (In reply to comment #3) > I don't think updating files that belong to some > package is good idea other it's against RPM logic. A script with the similar functionality is present in pciutils. It is in the user's responsibility range. Why a user should wait half a year for the hwdata package update when he plugs in a new piece of hardware. Or are the guys at the Linux USB Project working only twice in a year? Or are the hwdata's packagers working only twice in a year? He can always restore the original content from the rpm.
(In reply to comment #8) > Add update-usbids.sh script to the package. > Or update hwdata package on a daily basis. Yes, the hwdata shoudl be updated more often. > A script with the similar functionality is present in pciutils. Yes, it's present, but if user use it, it will break the hwdata rpm consintency. I'll fix the usbutils spec file according to proposed patch, but i won't add the update script to usbutils, if it should be in some rpm (which I doubt) it should be in hwdata rpm.
The /sbin or /usr/sbin directory selection depends on the Fedora rules and the application of LHS. lsusb (and also lspci) are probably expected to be in /sbin. I would not move it without at least asking other packagers. When seeing that the usbutils' author has removed the script from the package without a notice in the ChangeLog I do not object to your decision. It would still be good to provide such script or similar functionality to the user.
as to comment #9 great as to committing the spec delta -- thank you As to comment #9 and #10 as to doing data updates, I find that pci hwdata and usb-id's do not have any material cross dependencies, as they are separately maintained projects. I update either one of the other, when I add new devices in a given lkass, without issue. ymmv
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle. Changing version to '11'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Fixes still not in the latest (usbutils-0.82-3) ... HOW do I get this applied? %build %configure --sbindir=/sbin %files %defattr(-,root,root,-) %{_mandir}/*/* /sbin/* missing: +%config %{_datadir}/usb* %changelog * Wed Jul 1 2009 Jiri Moskovcak <jmoskovc> 0.82-3 - added autoconf to fix build in koji * Wed Jul 1 2009 Jiri Moskovcak <jmoskovc> 0.82-2 - minor fix in Makefile.am to properly find usb.ids from hwdata - Resolves: #506974
ping -- this is growing whiskers -- any way to get the fix applied, please?
Fixed in rawhide.
clearly: update-usbids.sh has NOT ben added to the package yet -- comment 7 and 8 How can this get in there? Is there some problem adding such -- I have a live issue where I need it, and it is still not included. -- Russ herrold [herrold@centos-5 usbutils]$ rpm -qlp /home/herrold/rpmbuild/RPMS/x86_64/usbutils-0.86-2orc.x86_64.rpm /usr/bin/usb-devices /usr/sbin/lsusb /usr/share/doc/usbutils-0.86 /usr/share/doc/usbutils-0.86/AUTHORS /usr/share/doc/usbutils-0.86/COPYING /usr/share/doc/usbutils-0.86/ChangeLog /usr/share/doc/usbutils-0.86/NEWS /usr/share/doc/usbutils-0.86/README /usr/share/man/man1/usb-devices.1.gz /usr/share/man/man8/lsusb.8.gz /usr/share/pkgconfig/usbutils.pc [herrold@centos-5 usbutils]$
I think I made my self clear in comment #9 - I won't add the script into the rpm for obvious reasons. Jirka