|Summary:||ports-mgmt/pkg: pkg overwrites current package with different python version|
|Product:||Ports & Packages||Reporter:||TAO ZHOU <zhoutao>|
|Component:||Individual Port(s)||Assignee:||freebsd-pkg (Nobody) <pkg>|
|Severity:||Affects Many People||CC:||brd, christer.edwards, w.schwarzenfeld, zhoutao|
Description TAO ZHOU 2017-12-18 01:12:05 UTC
I have python 3.6 installed on FreeBSD 11.1 if I run pkg install sysutils/py-salt, it will install py36-salt. But if I run the following command python3.6 -c "import subprocess;subprocess.Popen(['pkg', 'install', '-y', 'sysutils/py-salt'])" , it will install package py27-salt. Since I am using salt-stack to mange all my FreeBSD servers, this breaks everything because every time I do a salt state.highstate, it will revert all the py36-* packages to py27-* packages. I don't know the difference if I run the pkg command inside python scripts. Is there some special environment variable for FLAVORs? Thanks
Comment 1 TAO ZHOU 2017-12-18 01:52:18 UTC
Sorry, I was wrong. This has nothing to do with python, but pkg itself. If the current installed pkg is py36-salt, when I run pkg install sysutils/py-salt, it will install py27-salt. if the current install pkg is py27-salt, when I run pkg install sysutils/py-salt, it will install py36-salt.
Comment 2 Brad Davis 2018-04-15 19:51:38 UTC
I am curious, why you have a Salt state that installs salt? If you want 36, why not just `pkg install -y py36-salt' ?
Comment 3 TAO ZHOU 2018-04-20 06:35:13 UTC
@brad That's to ensure every machine have the same version of salt running. that's not important. Even if I run by hand 'pkg install sysutils/py-salt, it have the same problem. If the current installed package is py27-salt, it will install py36-salt. And when you run it again, it will install py-salt. I cannot specify the flavor in the package name, say if I do 'pkg install sysutils/py36-salt or py27-salt, it will say the package does not exist. I am not sure if this is bug of pkg or could it be the way I build the packages with poudiere.
Comment 4 Brad Davis 2018-04-20 19:00:57 UTC
What happens if you do: pkg upgrade sysutils/py-salt
Comment 5 Brad Davis 2018-04-20 19:03:58 UTC
Hmm, no that doesn't work either..
Comment 6 Mathieu Arnold 2018-04-30 15:40:37 UTC
The main problem is that sysutils/py-salt is not unique: # pkg search -f sysutils/py-salt |grep '^Name' Name : py36-salt Name : py27-salt So, of course, pkg install sysutils/py-salt does not work as you could expect, or want.
Comment 7 TAO ZHOU 2018-05-15 23:59:52 UTC
The problem is If I do pkg install sysutils/py36-salt, it will say 'pkg: No packages available' So I have to use 'sysutils/py-salt' as the package name in my script, which will cause problem is the script was executed a second time.
Comment 8 Walter Schwarzenfeld 2019-08-09 17:44:17 UTC
This is a "mean" thing. The trick is, make the command without category: python3.6 -c "import subprocess;subprocess.Popen(['pkg', 'install', '-y', 'py36-salt'])". This is working.