Bug 466041 - usbutils usb.ids update, adding a missed script, and conforming more closely to Fedora packaging guideline
usbutils usb.ids update, adding a missed script, and conforming more closely ...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: usbutils (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jiri Moskovcak
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-07 16:48 EDT by R P Herrold
Modified: 2015-02-01 17:48 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 537206 (view as bug list)
Environment:
Last Closed: 2009-11-12 05:25:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
updatable usb.ids addition (2.33 KB, patch)
2008-10-07 17:20 EDT, R P Herrold
no flags Details | Diff

  None (edit)
Description R P Herrold 2008-10-07 16:48:53 EDT
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@owlriver.com> 0.73-3
+- add update script, reference file, and mark the latter as a config file
+
 * Tue Feb 12 2008 Jiri Moskovcak <jmoskovc@redhat.com> 0.73-2
 - spec file cleanup

[herrold@centos-5 usbutils-0.73]$
Comment 1 R P Herrold 2008-10-07 17:18:52 EDT
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
Comment 2 R P Herrold 2008-10-07 17:20:09 EDT
Created attachment 319699 [details]
updatable usb.ids addition
Comment 3 Jiri Moskovcak 2008-11-03 08:34:19 EST
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
Comment 4 Bug Zapper 2008-11-25 22:38:47 EST
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
Comment 5 R P Herrold 2008-12-08 09:34:13 EST
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
Comment 6 R P Herrold 2008-12-08 09:34:48 EST
missed ticking the RawHide dropbox .. amending
Comment 7 R P Herrold 2009-01-09 15:49:11 EST
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
Comment 8 Lubos Stanek 2009-05-06 08:01:33 EDT
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.
Comment 9 Jiri Moskovcak 2009-05-06 08:18:13 EDT
(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.
Comment 10 Lubos Stanek 2009-05-06 08:53:25 EDT
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.
Comment 11 R P Herrold 2009-05-06 10:28:36 EDT
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
Comment 12 Bug Zapper 2009-06-09 05:45:50 EDT
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
Comment 13 R P Herrold 2009-07-14 10:56:55 EDT
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@rdhat.com> 0.82-3
- added autoconf to fix build in koji

* Wed Jul  1 2009  Jiri Moskovcak <jmoskovc@redhat.com> 0.82-2
- minor fix in Makefile.am to properly find usb.ids from hwdata
- Resolves: #506974
Comment 14 R P Herrold 2009-09-15 09:25:34 EDT
ping -- this is growing whiskers -- any way to get the fix applied, please?
Comment 15 Jiri Moskovcak 2009-09-16 09:30:53 EDT
Fixed in rawhide.
Comment 16 R P Herrold 2009-11-11 12:57:52 EST
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]$
Comment 17 Jiri Moskovcak 2009-11-12 05:25:36 EST
I think I made my self clear in comment #9 - I won't add the script into the rpm for obvious reasons.

Jirka

Note You need to log in before you can comment on or make changes to this bug.