rworkman / slackpkg

Slackware's slackpkg
35 stars 12 forks source link

Install exact package names #36

Open mid-kid opened 1 year ago

mid-kid commented 1 year ago

I'm trying to script around slackware, and one of the problems I'm trying to solve is being able to install and reinstall arbitrary packages with exact package names, rather than having to glob in a dir full of tarballs. Slackpkg is a very suitable solution for that, but what I'm finding is that it is utterly impossible to specify exact package names with it.

For example:

# slackpkg -batch=on install gcc

Looking for gcc in package list. Please wait... DONE

gcc-11.2.0-x86_64-2.txz
gcc-brig-11.2.0-x86_64-2.txz
gcc-g++-11.2.0-x86_64-2.txz
gcc-gdc-11.2.0-x86_64-2.txz
gcc-gfortran-11.2.0-x86_64-2.txz
gcc-gnat-11.2.0-x86_64-2.txz
gcc-go-11.2.0-x86_64-2.txz
gcc-objc-11.2.0-x86_64-2.txz

Total package(s): 8

Do you wish to install selected packages (Y/n)? n

Is there a way to make it install only the gcc package?

saxa commented 1 year ago

AFAIK it should be enough to specify the package name after the slackpkg command.

mid-kid commented 1 year ago

@saxa what do you mean? I'm specifying gcc in the command and it's pulling all of these gcc subpackages I don't need.

saxa commented 1 year ago

I mean slackpkg install gcc-11.2.0-x86_64-2.txz I am not sure if it works but IMHO it should.

mid-kid commented 1 year ago

Oh, sure, but I want to avoid having to specify the exact version.

saxa commented 1 year ago

Oh ok, I read it again, sorry. I think you could try to specify a bit more of the name in your scritp then.

mid-kid commented 1 year ago

What is "a bit more" when gcc is the full name?

saxa commented 1 year ago

You tried gcc-11 ?

mid-kid commented 1 year ago

I guess that works for now, I'd like to avoid hardcoding the version though...

saxa commented 1 year ago

Ok, glad you sorted it out. Probably on some of the package names you would need to hardcode them, at the end they do not change names so often. Another solution maybe would be to do it like pkgtools do it, by reversing the name and cut off the last 3 fields and then search for it. But to suggest better probably would be good to see some piece of code of what are you trying to achieve.