Page 4 of 5

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Sat May 09, 2020 8:36 pm
by jhoyt
The issue I'm experiencing with pip is that macports installs pip3 into /opt/local/bin/pip. Unfortunately, ansible is trying to use pip3 which resolves to /usr/local/bin/pip3. If there was an ansible environmental variable to set pip and pip3's path, that would probably fix the problem one problem. This is mainly an issue as Xcode/MacOS installs python37 and we're trying to go with macports version python38. I have a test running on my VM to see if I can get everything installed rolling back to macports python37.

Another issue when running is that macports requires sudo to install but pip does not (installs for the local user). This causes pip (once pathing issues are force resolved) to not be happy as it want to run as the use and not via sudo privileges. i.e. I can only install macports when calling ansible via sudo and can only install via pip without using sudo.

Running ansible with this command allows macports to install:

Code: Select all

sudo ansible-playbook-3.8 -i hosts.macports qt5.yml
Running ansible with this command allows pip to install mysqlclient:

Code: Select all

ansible-playbook-3.8 -i hosts.macports qt5.yml
Here is my current setup which is mostly working:
ansible.macos.patch
(5.79 KiB) Downloaded 15 times

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Sat May 09, 2020 9:43 pm
by bill6502
I don't see any good way to change the PATH used by the ansible macports module. The command
module may work:

Code: Select all

- name: install mysqlclient without pip3
  command: /opt/local/bin/pip install mysqlclient
Although pip will install that in /usr/local... . Hope that's OK.

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Sun May 10, 2020 12:33 pm
by jhoyt
:: Update 1 - corrected patch for correct port select call
:: Update 2 - Fixed per Craig's post below.
:: Update 3 - Added hdhomerun to ansible patch

I believe I got ansible working with the attached patch
ansible.macos.patch
(5.76 KiB) Downloaded 15 times
I've used is on my main system which had most of the ports installed. I am currently also trying on a fresh environment where no ports are installed (it's running in a vm and is slow...). I'll update the patch file and this post if I find any necessary changes in the new environment.

To run, you must have python38 and py38-ansible installed by macports.

Code: Select all

sudo port install py38-ansible
Optional commands that I've put into the macports ansible file are:

Code: Select all

sudo port select --set python python38
sudo port select --set python3 python38
sudo port select --set pip pip38
sudo port select --set pip3 pip38
To run I'm using the following command:

Code: Select all

 sudo ansible-playbook-3.8 -i hosts.macports qt5.yml

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Sun May 10, 2020 1:38 pm
by pvr4me
Very minor, but the first command can be just:

Code: Select all

sudo port install py38-ansible
python38 is a dependency of py38-ansible and will be automatically installed.

BTW, when people install MacPorts, many of them miss that they need to run a command to get an up-to-date registry of all ports that are available:

Code: Select all

sudo port -v selfupdate
This also updates MacPorts itself should there be a new release.

In on-going use, this command should be run periodically to keep the registry current. The -v flag lists anything that is new or modified and can be omitted. To update your locally installed ports to the most current version, run:

Code: Select all

sudo port upgrade outdated
Craig

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Sun May 10, 2020 3:07 pm
by jhoyt
Thanks Craig, I did miss the "sudo port -v selfupdate" call when installing. Thanks for the tip!!!!

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 10:56 am
by jhoyt
Bill, thanks for getting this into the ansible git repo! Here is a patch file for some mods to get the python and pip selections working.

Also includes an add of the hdhomerun library and calls to "port selfupdate" and "port upgrade outdated" which should addresses Craig's most recent post (Craig, please tell me if I missed something).
ansible.macos.python.pip.patch
(1.46 KiB) Downloaded 17 times

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 11:51 am
by stuarta
Could you explain why the need to break the calls to port up into individual items?

Code: Select all

-- name: select the installed version of python and pip
+- name: select the installed version of python
   become: yes
-  command: '{{ cmd }}'
-  vars:
-    cmd:
-    - port select --set python python38
-    - port select --set python3 python38
-    - port select --set pip pip38
-    - port select --set pip3 pip38
+  command: /opt/local/bin/port select --set python python38
+
+- name: select the installed version of python3
+  become: yes
+  command: /opt/local/bin/port select --set python3 python38
+
+- name: select the installed version of pip
+  become: yes
+  command: /opt/local/bin/port select --set pip pip38
+
+- name: select the installed version of pip3
+  become: yes
+  command: /opt/local/bin/port select --set pip3 pip38

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 12:01 pm
by jhoyt
Ansible was throwing this error in the version currently posted to git:

Code: Select all

TASK [mythtv-macports : select the installed version of python and pip] ************************************************
[WARNING]: The value ['port select --set python python38', 'port select --set python3 python38', 'port select --set pip
pip38', 'port select --set pip3 pip38'] (type list) in a string field was converted to "['port select --set python
python38', 'port select --set python3 python38', 'port select --set pip pip38', 'port select --set pip3 pip38']" (type
string). If this does not look like what you expect, quote the entire value to ensure it does not change.
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "'[port select --set python python38,' 'port select --set python3 python38,' 'port select --set pip pip38,' 'port select --set pip3 pip38]'", "msg": "[Errno 2] No such file or directory: b'[port select --set python python38,'", "rc": 2}
The breakout into four calls is what fixed this on my system.

I'm new to ansible, so happy to have a better way to fix the problem.

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 12:04 pm
by stuarta
Okay, thanks for the explanation. Will have a look and see what the error is actually trying to say.

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 1:29 pm
by stuarta
Ah I get it, instead of sending the command "port" with params "select --set python python38", it's trying to exec "port select --set python python38" which obviously doesn't exist.

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 2:03 pm
by bill6502
I've fixed it, will push shortly.

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 2:24 pm
by pvr4me
jhoyt wrote:
Mon May 11, 2020 10:56 am
Also includes an add of the hdhomerun library and calls to "port selfupdate" and "port upgrade outdated" which should addresses Craig's most recent post ...
I'm not sure if the 'port upgrade outdated' is necessary. Do we expect that someone using the ansible playbook will re-run the playbook command on a periodic basis to update the deps when new versions have been made available through MacPorts? How does Ansible handle upgrades versus a first time install?

(BTW, in MacPorts, 'outdated' is a special "pseudo-portname" that gets expanded internally into a list of all ports where the installed version is earlier than the latest version available through the registry. See 'man port' for more pseudo portnames that can be useful, like "installed" and "requested".)

Craig

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Mon May 11, 2020 2:32 pm
by jhoyt
It's probably not necessary. I guess I was trying to resolve port consistency issues with the upgrade call, but that could probably create some other unintentional issues (plus a long upgrade cycle...).

Bill - if you remove "upgrade: yes" then everything should be good to go

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Thu May 14, 2020 1:22 pm
by pvr4me
@jhoyt With your freshly built app, did I understand that the video output settings (OpenGL, VideoToolbox) are _not_ set by default? If so, I believe this would be considered a bug and is a trivial thing to fix. @markk would, I'm pretty sure, be the right person to poke.

Craig

Re: [Solved] Building Mythtv 31.x on Catalina

Posted: Thu May 14, 2020 1:27 pm
by jhoyt
VideoToolbox is default. This issue is on video playback (at least on retina displays), some videos do not playback in fullscreens mode (for me anything 480i or 480p). Could be a bug or config issue.