Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#52376 closed enhancement (fixed)

usbutils @007 update USB ID database to version 2016.09.07

Reported by: lbschenkel (Leonardo Brondani Schenkel) Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: kurthindenburg (Kurt Hindenburg), bwalle (Bernhard Walle)
Port: usbutils

Description

The current port uses the USB ID database embedded in the source code, which is from 2013. I have attached a patch that replaces the database with the latest version, 2016.09.07.

Attachments (6)

usbutils.patch (574.3 KB) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
usbutils.2.patch (676 bytes) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
downloads DB at build time
usbutils.3.patch (659 bytes) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
split the USB ID database into its own port (usbids) and make usbutils depend on it
usbutils.3.2.patch (2.7 KB) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
split the USB ID database into its own port (usbids) and make usbutils depend on it
usbutils.4.patch (3.3 KB) - added by lbschenkel (Leonardo Brondani Schenkel) 8 years ago.
usbutils.5.patch (3.8 KB) - added by larryv (Lawrence Velázquez) 8 years ago.

Download all attachments as: .zip

Change History (21)

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: usbutils.patch added

comment:1 Changed 8 years ago by larryv (Lawrence Velázquez)

Cc: bernhard@… removed
Keywords: haspatch added
Owner: changed from macports-tickets@… to bernhard@…
Version: 2.3.4

Where does this database come from? Could we could download it instead of adding it to everyone’s ports trees?

comment:2 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

It comes from: http://www.linux-usb.org/usb.ids

Sure, we can download it from there at build time. The reason I didn't do it was because I thought that was an anti-pattern. I have attached a new patch that does it — maybe there is a more idiomatic MacPorts way instead that doing a curl?

In case we do want to include the DB in the ports tree, if I compress it with gzip -9 it becomes a little bit less than 200K.

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: usbutils.2.patch added

downloads DB at build time

comment:3 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Another reason for why I'm not sure if it's a good idea to download the DB at build time is because the build becomes not reproducible and if linux-usb.org is not online (or the file available or not well-formed) then the package cannot be built or will not work at runtime. Not good attributes in my opinion.

comment:4 in reply to:  2 Changed 8 years ago by larryv (Lawrence Velázquez)

Replying to leonardo.schenkel@…:

Sure, we can download it from there at build time. The reason I didn't do it was because I thought that was an anti-pattern.

No, it’s the opposite—putting non-patches in filespath is unorthodox. Very few ports do this.

I have attached a new patch that does it — maybe there is a more idiomatic MacPorts way instead that doing a curl?

The usual method is to add the additional files to distfiles, set extract.only, and add extra checksums. You can find examples by searching the ports tree for “extract.only”.

Last edited 8 years ago by larryv (Lawrence Velázquez) (previous) (diff)

comment:5 in reply to:  3 Changed 8 years ago by larryv (Lawrence Velázquez)

Replying to leonardo.schenkel@…:

Another reason for why I'm not sure if it's a good idea to download the DB at build time is because the build becomes not reproducible

The one issue I can think of is that the filename doesn’t include version information, so every update would be a stealth update. It’s possible to work around this.

if linux-usb.org is not online (or the file available or not well-formed) then the package cannot be built or will not work at runtime. Not good attributes in my opinion.

This is true of all distfiles, including source tarballs. That’s why we mirror distfiles.

comment:6 in reply to:  2 Changed 8 years ago by larryv (Lawrence Velázquez)

Replying to leonardo.schenkel@…:

Sure, we can download it from there at build time. The reason I didn't do it was because I thought that was an anti-pattern.

I just realized what you meant by this. Yes, downloading during the build phase is an antipattern. I’m recommending downloading it during the fetch phase as just another distfile.

comment:7 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

OK, thanks for the tips. I will implement a different solution later today as you have described and re-submit the patch.

comment:8 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

After some experimentation, I think the best option is to separate the USB ID database from usbutils by creating a new port usbids for just the USB ID DB and making usbutils depend on it. I have used the "deactivate" hack described in PortfileRecipes#deactivatehack since the new port will take over the ${prefix}/share/usb.ids.gz file.

Since usb.ids is an unversioned distfile it forces the port to use a dist_subdir of ${name}/${version}. If the DB was not split from usbutils this would unnecessarily waste space in all mirrors due do the fact that there would be a copy the usbutils source for each version of the port even though the source tarball does not change and does not suffer from the problem.

Splitting the two into different ports is the most elegant and straightforward solution to me. Not coincidentally, this was the approach taken by the FreeBSD port as well. I took inspiration from it and named the port similarly.

I'm attaching a new patch.

Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: usbutils.3.patch added

split the USB ID database into its own port (usbids) and make usbutils depend on it

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: usbutils.3.2.patch added

split the USB ID database into its own port (usbids) and make usbutils depend on it

comment:9 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

I had to update the patch once more to get rid of a warning that the current USB ID database triggers on usbutils. I had to patch the DB to remove the offending line.

Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Attachment: usbutils.4.patch added

comment:10 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Is there anybody who could review this please? I got no replies for 8 days now.

comment:11 Changed 8 years ago by kurthindenburg (Kurt Hindenburg)

Cc: kurthindenburg added

you might post an email to the -user mailing list - I'm not too sure about the usbids ports

comment:12 in reply to:  10 Changed 8 years ago by larryv (Lawrence Velázquez)

Cc: bernhard@… added
Owner: changed from bernhard@… to larryv
Status: newaccepted

Sorry, this slipped through the cracks. In the future, feel free to email macports-dev about idle tickets.

Couple of things:

  • The website states that “the contents of the database and the generated files can be distributed under the terms of either the GNU General Public License (version 2 or later) or of the 3-clause BSD License.” The correct way to express this is
    license {GPL-2+ BSD}
    
  • Instead of decompressing and recompressing the database, you can clear extract.only to force the extract phase to do nothing. Then you can copy the distfile directly into the destroot.

I made these and a few other minor changes. If they look okay to you, I can commit.

Changed 8 years ago by larryv (Lawrence Velázquez)

Attachment: usbutils.5.patch added

comment:13 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Sure, feel free to go ahead and commit.

comment:14 in reply to:  13 Changed 8 years ago by larryv (Lawrence Velázquez)

Thanks. Again, sorry for the delay.

comment:15 Changed 8 years ago by lbschenkel (Leonardo Brondani Schenkel)

Resolution: fixed
Status: acceptedclosed

In 4d45c902/macports-ports:

usbutils: Move USB ID database into "usbids" port

Also, update it to 2016.11.14.

The database is updated frequently, but the one shipped in the usbutils
tarball is from 2013. Splitting it out into its own port will let us
keep it up to date independently of usbutils.

Closes #52376.

Note: See TracTickets for help on using tickets.