[Solved] Building Mythtv 31.x on Catalina

For discussion of topics specific to MythTV on OSX
jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Sat May 09, 2020 8:36 pm

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 14 times

User avatar
bill6502
Developer
Posts: 1788
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

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

Post by bill6502 » Sat May 09, 2020 9:43 pm

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.

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Sun May 10, 2020 12:33 pm

:: 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
Last edited by jhoyt on Sun May 10, 2020 3:19 pm, edited 2 times in total.

User avatar
pvr4me
Senior
Posts: 718
Joined: Fri Feb 07, 2014 7:25 pm
Location: near Toronto, Canada
Contact:
Canada

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

Post by pvr4me » Sun May 10, 2020 1:38 pm

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
The MacPorts guy.

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Sun May 10, 2020 3:07 pm

Thanks Craig, I did miss the "sudo port -v selfupdate" call when installing. Thanks for the tip!!!!

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Mon May 11, 2020 10:56 am

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

User avatar
stuarta
Developer
Posts: 211
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post by stuarta » Mon May 11, 2020 11:51 am

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

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Mon May 11, 2020 12:01 pm

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.

User avatar
stuarta
Developer
Posts: 211
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post by stuarta » Mon May 11, 2020 12:04 pm

Okay, thanks for the explanation. Will have a look and see what the error is actually trying to say.

User avatar
stuarta
Developer
Posts: 211
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post by stuarta » Mon May 11, 2020 1:29 pm

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.

User avatar
bill6502
Developer
Posts: 1788
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

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

Post by bill6502 » Mon May 11, 2020 2:03 pm

I've fixed it, will push shortly.

User avatar
pvr4me
Senior
Posts: 718
Joined: Fri Feb 07, 2014 7:25 pm
Location: near Toronto, Canada
Contact:
Canada

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

Post by pvr4me » Mon May 11, 2020 2:24 pm

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
The MacPorts guy.

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Mon May 11, 2020 2:32 pm

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

User avatar
pvr4me
Senior
Posts: 718
Joined: Fri Feb 07, 2014 7:25 pm
Location: near Toronto, Canada
Contact:
Canada

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

Post by pvr4me » Thu May 14, 2020 1:22 pm

@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
The MacPorts guy.

jhoyt
Junior
Posts: 74
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt » Thu May 14, 2020 1:27 pm

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.

Post Reply