Bug 224413 - sysutils/py-salt is not unique: pkg overwrites current package with different python version
Summary: sysutils/py-salt is not unique: pkg overwrites current package with different...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kirill Ponomarev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-18 01:12 UTC by TAO ZHOU
Modified: 2023-11-28 04:40 UTC (History)
5 users (show)

See Also:
linimon: maintainer-feedback? (krion)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 freebsd_committer freebsd_triage 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 freebsd_committer freebsd_triage 2018-04-20 19:00:57 UTC
What happens if you do:

pkg upgrade sysutils/py-salt
Comment 5 Brad Davis freebsd_committer freebsd_triage 2018-04-20 19:03:58 UTC
Hmm, no that doesn't work either..
Comment 6 Mathieu Arnold freebsd_committer freebsd_triage 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 freebsd_triage 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.
Comment 9 Baptiste Daroussin freebsd_committer freebsd_triage 2021-08-17 17:01:01 UTC
this is not a pkg bug, if a fix/change needs to be done, it is on the way the python ports are dealt with.