How to find the URI and repository name from which the package was installed?
by verilog15 from LinuxQuestions.org on (#5KT7W)
Hello!
My task is to do the following: Build a script which, given a list of rpm packages, finds all the zypper repositories (name and URIs).
I have a package installed locally and I want to find the zypper URI and the repository name from which the package was installed from. I could search for the package and find it:
Code:zypper info $PKG_NAMEIt does give me the repo name (if there is one) but it does not give me the URI:
Code:> zypper info tcsh
Information for package tcsh:
Repository: <REPO_NAME>
Name: tcsh
Version: 6.18.01-9.7.1
Arch: x86_64
Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Support Level: unknown
Installed: Yes
Status: up-to-date
Installed Size: 1.0 MiB
Summary: The C SHell
Description:
Tcsh is an enhanced, but completely compatible, version of the Berkeley
UNIX C shell, csh(1). It is a command language interpreter usable as an
interactive login shell and a shell script command processor. It
includes a command-line editor, programmable word completion, spelling
correction, a history mechanism, job control, and a C-like syntax.I want the "Repository:" part.
I'm also familiar with the Code:zypper repos -u command to list all the repositories and URIs.
I could combine the two commands and find the repository name and then the URI. Is there a better approach? My biggest struggle is on how to parse it. So the questions are:
1. Is there a command that given the package name, returns the repository name (without the need to parse)?
2. Is there a command that given the package name, returns the repository URI (without the need to parse)? Is it possible to combine it with question 1 and just get those two?
3. If there is no way to get the repository URI based on the package name, is there a command to get the repository URI based on the repository name (without the need to parse)?
Maybe this can be extract with RPM?
My task is to do the following: Build a script which, given a list of rpm packages, finds all the zypper repositories (name and URIs).
I have a package installed locally and I want to find the zypper URI and the repository name from which the package was installed from. I could search for the package and find it:
Code:zypper info $PKG_NAMEIt does give me the repo name (if there is one) but it does not give me the URI:
Code:> zypper info tcsh
Information for package tcsh:
Repository: <REPO_NAME>
Name: tcsh
Version: 6.18.01-9.7.1
Arch: x86_64
Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Support Level: unknown
Installed: Yes
Status: up-to-date
Installed Size: 1.0 MiB
Summary: The C SHell
Description:
Tcsh is an enhanced, but completely compatible, version of the Berkeley
UNIX C shell, csh(1). It is a command language interpreter usable as an
interactive login shell and a shell script command processor. It
includes a command-line editor, programmable word completion, spelling
correction, a history mechanism, job control, and a C-like syntax.I want the "Repository:" part.
I'm also familiar with the Code:zypper repos -u command to list all the repositories and URIs.
I could combine the two commands and find the repository name and then the URI. Is there a better approach? My biggest struggle is on how to parse it. So the questions are:
1. Is there a command that given the package name, returns the repository name (without the need to parse)?
2. Is there a command that given the package name, returns the repository URI (without the need to parse)? Is it possible to combine it with question 1 and just get those two?
3. If there is no way to get the repository URI based on the package name, is there a command to get the repository URI based on the repository name (without the need to parse)?
Maybe this can be extract with RPM?