Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910433 - New package request: libtypec
Summary: New package request: libtypec
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Default Assignee for New Packages
URL: https://github.com/Rajaram-Regupathy/...
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-07-16 15:04 UTC by Rajaram
Modified: 2024-04-12 19:59 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to add libtypc package (0001-dev-libs-libtypec-Add-new-package-version-0.3.patch,2.27 KB, patch)
2023-07-27 18:09 UTC, Matt Turner
Details | Diff
ebuild file to build and install libtypec (libtypec-0.5.0.ebuild,634 bytes, text/plain)
2023-12-26 04:19 UTC, Rajaram
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rajaram 2023-07-16 15:04:04 UTC
“libtypec” is aimed to provide a generic interface abstracting all platform complexity for user space to develop tools for efficient USB-C port management. The library can also enable development of diagnostic and debug tools to debug system issues around USB-C/USB PD topology.

Reproducible: Always
Comment 1 Matt Turner gentoo-dev 2023-07-24 17:07:43 UTC
Is this package intended to be a dependency used by other software? E.g. will libgusb depend on it?

Or is it intended to be a package used by an end-user?
Comment 2 Rajaram 2023-07-25 03:12:28 UTC
This is an independent library that intended to be used by end-user to develop policy layers and also used by utilities like lstypec (https://github.com/Rajaram-Regupathy/libtypec/wiki/lstypec-:-Know-your-USB-C-Ports)
Comment 3 Matt Turner gentoo-dev 2023-07-27 18:09:26 UTC
Created attachment 866445 [details, diff]
Patch to add libtypc package

This ebuild works for me to build libtypec. With it, the following files are installed:

/usr/include/libtypec.h
/usr/lib64/libtypec.so.0.1.0
/usr/share/doc/libtypec-0.3/README
/usr/share/pkgconfig/libtypec.pc

I noticed some problems in the upstream project that should be fixed:

- The version in https://github.com/Rajaram-Regupathy/libtypec/blob/main/CMakeLists.txt#L2 is wrong. This should be updated for each release, as it affects the contents of libtypec.pc

- The source tarballs are named strangely and contain a strange directory structure. Typically source tarballs are named <package-name>-<package-version>.tar.<compression> and contain a single top-level source directory named <package-name>-<package-version>. The tag tarballs on Github are named according to the tags themselves, which use an understore for separating the package name from the package version. Please use a dash in the future. I.e. libtypec-0.3 instead of libtypec_v0.3. The "release" tarballs are even more strangely named and structured. Release tarballs make sense for autotools projects where you pregenerate some files for the distribution, but they don't really have any value for a project using CMake.

- libtypec.pc has hard-coded values. This is absolutely wrong.

- CMakeLists.txt sets its own CFLAGS (https://github.com/Rajaram-Regupathy/libtypec/blob/main/CMakeLists.txt#L13). This should be left to distributions.

- (As a distributor, I'd really recommend using meson instead of CMake, but that's just an aside)


I don't know that we should provide this package in Gentoo. I think your real goal is to have it in ChromeOS, so it should probably just go into the chromiumos-overlay. But before it's included anywhere, the packaging issues I called out need to be fixed.
Comment 4 Matt Turner gentoo-dev 2023-07-27 18:16:06 UTC
I left out the symlinks from the list of files installed. They are

./usr/lib64/libtypec.so -> libtypec.so.1
./usr/lib64/libtypec.so.1 -> libtypec.so.0.1.0
./usr/lib64/libtypec.so.0.1.0

It's very weird for libtypec.so.*1* to point to libtypec.so.*0*.1.0. That should probably be fixed.
Comment 5 Rajaram 2023-08-30 17:51:53 UTC
Thanks Matt for the feedback. 

Updated the repo with a new release based on the suggestion in version 0.3.1: 
https://github.com/Rajaram-Regupathy/libtypec/releases/tag/libtypec-0.3.1


Looking forward for the package to be integrated
Comment 6 Matt Turner gentoo-dev 2023-08-31 14:23:44 UTC
> - The version in https://github.com/Rajaram-Regupathy/libtypec/blob/main/CMakeLists.txt#L2 is wrong. This should be updated for each release, as it affects the contents of libtypec.pc

You've just changed one hard-coded value in libtypec.pc.in to another. The version should be substituted into the .pc file by the build system.

> - libtypec.pc has hard-coded values. This is absolutely wrong.

This is still not fixed. prefix, exec_prefix, libdir are all hard-coded.

> - The source tarballs are named strangely and contain a strange directory structure.

This is still not fixed. The directory is named libtypec-libtypec-0.3.1, but should be libtypec-0.3.1.

> - CMakeLists.txt sets its own CFLAGS (https://github.com/Rajaram-Regupathy/libtypec/blob/main/CMakeLists.txt#L13). This should be left to distributions.

This is still not fixed.


Please confirm that these issues have been fixed.

The package now installs

/usr/lib64/libtypec.so -> libtypec.so.0.3.1
/usr/lib64/libtypec.so.0.3.1

Shouldn't it be like this instead?

/usr/lib64/libtypec.so -> libtypec.so.0
/usr/lib64/libtypec.so.0 -> libtypec.so.0.3.1
/usr/lib64/libtypec.so.0.3.1

For example, libgusb installs:

/usr/lib64/libgusb.so -> libgusb.so.2
/usr/lib64/libgusb.so.2 -> libgusb.so.2.0.10
/usr/lib64/libgusb.so.2.0.10
Comment 7 Rajaram 2023-12-22 11:10:31 UTC
Kindly check 0.5.0 (https://github.com/Rajaram-Regupathy/libtypec/releases/tag/libtypec-0.5.0). Addressed all the comments. Looking forward
Comment 8 Rajaram 2023-12-26 04:19:59 UTC
Created attachment 880309 [details]
ebuild file to build and install libtypec

built and tested on gentoo
Comment 9 Adrian Ratiu 2024-03-07 17:34:10 UTC
Hello

I've tested this on two of my laptops (intel x86 dell xps and on a ryzen9 asus zenphyrus) as well as on my arm64 mt8183 "jacuzzi" chromebook.

The only one which didn't work at runtime was the ryzen9 ((lstypec output was empty).

I also verified the lib symlink issues highlighted above have been fixed in v0.5.

I'll add a checksum manifest and metadata file then will create a github pull request for the Gentoo repository, this is very cool!
Comment 10 Larry the Git Cow gentoo-dev 2024-04-12 19:59:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1525837f407ffd338515ca42a0f349df824e74c0

commit 1525837f407ffd338515ca42a0f349df824e74c0
Author:     Adrian Ratiu <adrian.ratiu@collabora.com>
AuthorDate: 2024-03-08 10:46:19 +0000
Commit:     Adrian Ratiu <adrian.ratiu@collabora.com>
CommitDate: 2024-04-12 16:44:40 +0000

    dev-libs/libtypec: new package, add 0.5
    
    thesamesam suggested on github [1] we add this ebuild
    to GURU first, to get more testing before we eventually
    add it to the main repo.
    
    I'm in the process of upstreaming the 3 patches added
    in this ebuild [2].
    
    [1] https://github.com/gentoo/gentoo/pull/35666
    [2] https://github.com/Rajaram-Regupathy/libtypec/pull/32
    Closes: https://bugs.gentoo.org/910433
    Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>

 dev-libs/libtypec/Manifest                         |  1 +
 ...CMakeLists.txt-fix-pkgconfig-install-path.patch | 26 ++++++++++
 ...sfs_ops-define-feature-test-macro-for-nft.patch | 45 ++++++++++++++++++
 ...-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch | 55 ++++++++++++++++++++++
 dev-libs/libtypec/libtypec-0.5.0.ebuild            | 30 ++++++++++++
 dev-libs/libtypec/metadata.xml                     | 15 ++++++
 6 files changed, 172 insertions(+)