[Solved] Building Mythtv 31.x on Catalina

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

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

Post 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 116 times
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

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

Post 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.
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post 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 117 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: 763
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 »

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
Formerly the MacPorts guy.
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post by jhoyt »

Thanks Craig, I did miss the "sudo port -v selfupdate" call when installing. Thanks for the tip!!!!
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post 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 124 times
User avatar
stuarta
Developer
Posts: 220
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post 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
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post 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.
User avatar
stuarta
Developer
Posts: 220
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post by stuarta »

Okay, thanks for the explanation. Will have a look and see what the error is actually trying to say.
User avatar
stuarta
Developer
Posts: 220
Joined: Wed Feb 05, 2014 5:13 pm
Great Britain

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

Post 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.
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

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

Post by bill6502 »

I've fixed it, will push shortly.
User avatar
pvr4me
Senior
Posts: 763
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 »

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
Formerly the MacPorts guy.
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post 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
User avatar
pvr4me
Senior
Posts: 763
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 »

@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
Formerly the MacPorts guy.
User avatar
jhoyt
Senior
Posts: 143
Joined: Thu Aug 27, 2015 10:11 am
United States of America

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

Post 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.
Post Reply