https://www.funtoo.org/api.php?action=feedcontributions&user=Senyai&feedformat=atomFuntoo - User contributions [en]2024-03-28T21:12:58ZUser contributionsMediaWiki 1.36.2https://www.funtoo.org/index.php?title=Autogen&diff=35149Autogen2021-01-31T20:37:14Z<p>Senyai: Created page with "Typical autogen.py code: {{file|name=browser-kit/curated/www-client/brave-bin/autogen.py|lang=python|body= def find_release(json_dict, channel="Release"): releases = filter(..."</p>
<hr />
<div>Typical autogen.py code:<br />
{{file|name=browser-kit/curated/www-client/brave-bin/autogen.py|lang=python|body=<br />
def find_release(json_dict, channel="Release"):<br />
releases = filter(<br />
lambda x: x["prerelease"] is False<br />
and x["draft"] is False<br />
and x["name"].startswith(channel)<br />
and not "Android" in x["name"],<br />
json_dict,<br />
)<br />
releases = list(releases)<br />
if not len(releases):<br />
return None<br />
return sorted(releases, key=lambda x: x["tag_name"])[-1]<br />
}}<br />
<br />
# Let's start with the <code>key</code> argument. It allows to sort an array by specific key; <code>tag_name</code> in this example. <code>tag_name</code> is a version number that is stored as a string, so sorting won't work correctly, as <code>max('10.1', '9.0') == '9.0'</code>. Better code would be <code>key=lambda item: tuple(map(int, re.findall('\d+', x["tag_name"])))</code>, because python sorts tuples of integers correctly.<br />
# Next, selecting maximal element by sorting a list and then selecting the rightmost element is not very beautiful. <code>sorted</code> can be replaced by <code>max</code>: <code>return max(releases, key=extract_version)</code><br />
# <code>max</code> can return default value, when there are no element, so check <code>if not len(releases)</code> becomes needless: <code>return max(releases, key=version, default=None)</code><br />
# <code>x["prerelease"] is False</code> check is considered unpythonic. Use <code>not x["prerelease"]</code><br />
# <code>not "Android" in x["name"]</code> is two operators, that can be combined: <code>"Android" not in x["name"]</code><br />
# Generator comprehension are considered more pythonic than <code>filter</code>.<br />
So, more pythonic version, that works correctly looks like this:<br />
{{file|name=browser-kit/curated/www-client/brave-bin/autogen.py|lang=python|body=<br />
def extract_version(release):<br />
return tuple(map(int, re.findall('\d+', release["tag_name"])))<br />
<br />
def find_release(all_releases, channel="Release"):<br />
releases = (<br />
release for release in all_releases<br />
if not release["prerelease"]<br />
and not release["draft"]<br />
and release["name"].startswith(channel)<br />
and "Android" not in release["name"]<br />
)<br />
return max(releases, key=extract_version)<br />
}}</div>Senyaihttps://www.funtoo.org/index.php?title=Test&diff=35146Test2021-01-31T09:45:19Z<p>Senyai: </p>
<hr />
<div>Test edit. Another test edit.<br />
<br />
{{Download|kind=gnome}}<br />
{{Download|kind=foo}}<br />
{{Download|kind=cinnamon}}<br />
<br />
{{Announce|title=Grab me from DockerHub!|body=This stage3 can be deployed in Docker via {{c|docker run funtoo/stage3-intel64-skylake}}}}<br />
<br />
{{console|body=<br />
##g##drobbins@ryzen##!g## ##c##~ $##!c## ##i##ssh -i ~/Downloads/drobbins-funtoo-us-east-1.pem ec2-user@54.152.74.161<br />
The authenticity of host '54.152.74.161 (54.152.74.161)' can't be established.<br />
ECDSA key fingerprint is SHA256:06VxabD5Gom5FRzpg7jZrBWro+TJkZBFa2+29WTSII4.<br />
Are you sure you want to continue connecting (yes/no)? yes<br />
Warning: Permanently added '54.152.74.161' (ECDSA) to the list of known hosts.<br />
<br />
// Welcome to Funtoo Linux for Amazon EC2! This image has been optimized <br />
// for the best possible performance by taking advantage of all CPU <br />
// instruction sets offered by Amazon Web Services.<br />
<br />
>>> Release: Funtoo Linux 1.2-release-ec2<br />
>>> Version: 17-Nov-2018<br />
>>> Subarch: intel64-haswell<br />
>>> Created by: Daniel Robbins <drobbins@funtoo.org><br />
>>> Open Source Community: Funtoo Linux (https://www.funtoo.org)<br />
>>> Commercial Support: BreezyOps (https://breezyops.com)<br />
>>> Bug reports: https://bugs.funtoo.org<br />
>>> Support email: support@funtoo.org<br />
<br />
NOTE: This message can be removed by deleting /etc/motd.<br />
<br />
##g##ec2-user@ip-172-31-22-215##!g## ##c##~ $##!c## ##i##sudo su<br />
##r##ip-172-31-22-215##!r## ##bl##/home/ec2-user##!bl## # ##i##ego sync<br />
}}<br />
<br />
<div>{{#ev:youtube|https://youtu.be/pZGKsdip4u0|autoresize}}</div><br />
<br />
{{file|lang=python|desc=python test|body=<br />
def fib(n):<br />
a, b = 0, 1<br />
while a < n:<br />
print(a, end=' ')<br />
a, b = b, a+b<br />
print()<br />
fib(1000)<br />
}}</div>Senyaihttps://www.funtoo.org/index.php?title=Package:NVIDIA_Linux_Display_Drivers&diff=29769Package:NVIDIA Linux Display Drivers2019-11-10T11:59:10Z<p>Senyai: </p>
<hr />
<div>{{Ebuild<br />
|Summary=NVIDIA accelerated graphics driver<br />
|CatPkg=x11-drivers/nvidia-drivers<br />
}}<br />
== Introduction ==<br />
<br />
NVIDIA provides proprietary graphics drivers for Linux with excellent performance. The name of the package for these drivers is {{c|x11-drivers/nvidia-drivers}}, and in Funtoo Linux 1.4 and later there is an additional {{c|x11-drivers/nvidia-kernel-modules}} package which includes the necessary kernel modules (in 1.3 and earlier, these kernel modules are included in the main {{c|nvidia-drivers}} package.)<br />
<br />
Also note that there is an Open Source driver for NVIDIA graphics cards: {{Package|x11-drivers/xf86-video-nouveau}}.<br />
<br />
== Preparing to Install ==<br />
<br />
=== Blacklist Nouveau ===<br />
<br />
When installing the proprietary NVIDIA drivers, it is a good practice to first blacklist the Open Source nouveau drivers so they do not load automatically and interfere with the official NVIDIA drivers. Do this by adding a {{f|nouveau-blacklist.conf}} file as follows:<br />
<br />
{{file|name=/etc/modprobe.d/nouveau-blacklist.conf|body=<br />
blacklist nouveau<br />
options nouveau modeset=0<br />
alias nouveau off<br />
}}<br />
<br />
=== Required Kernel Options ===<br />
<br />
If using a pre-build debian-sources or debian-sources-lts kernel, it is not necessary to fiddle with the kernel to enable necessary options. However, if you are building your kernel from source, ensure that the following options are enabled to ensure compatibility with the drivers:<br />
<br />
{{kernelop|desc=<br />
[*] Enable loadable module support<br />
}}<br />
{{kernelop|desc=<br />
[*] MTRR (Memory Type Range Register) support<br />
}}<br />
<br />
{{kernelop|desc=<br />
Device Drivers ---><br />
Graphics support ---> <br />
<*> Support for frame buffer devices ---><br />
<> NVIDIA Framebuffer Support<br />
<> NVIDIA Riva support<br />
}}<br />
<br />
=== Hardware compatibility and driver versions ===<br />
Currently, there are five versions of meta NVIDIA Linux drivers, each of which supports a specific group of GPUs. To learn which driver is suitable for your video card, consult the official page of the NVIDIA [http://www.nvidia.com/object/IO_32667.html complete list of supported GPUs]. Mind that choosing the wrong driver may render your system unusable!<br />
{{warning|With version 396, support for the Fermi family and older cards deprecated. Use the legacy drivers instead. http://nvidia.custhelp.com/app/answers/detail/a_id/4654"}}<br />
<br />
== Installation ==<br />
<br />
Upgrade and/or configure the {{c|VIDEO_CARDS}} flag to {{c|nvidia}} in {{c|/etc/portage/[[make.conf]]}}.<br />
<br />
{{console|body=<br />
# ##i##nano /etc/portage/make.conf<br />
VIDEO_CARDS="nvidia"<br />
}}<br />
<br />
For many users, after doing this and doing an {{c|emerge -auDN @world}} will result in the NVIDIA drivers being merged. If this does not happen, they can be merged with the following commands:<br />
<br />
{{console|body=<br />
###i## emerge x11-drivers/nvidia-drivers x11-drivers/nvidia-kernel-modules<br />
}}<br />
<br />
For older NVIDIA cards, especially unsupported versions, you may need to enter the details of the '''''lowest numbered driver that will fail your video-card''''' into {{f|/etc/portage/package.mask}}. Example:<br />
{{file|name=/etc/portage/package.mask|body=<br />
>=x11-drivers/nvidia-drivers-341.0.0<br />
>=x11-drivers/nvidia-kernel-modules-341.0.0<br />
}}<br />
This will block the installation of the 341.0.0 driver '''''and all later versions''''', as the video cards used (a GT8400GS in this case) is not supported by those newer drivers. emerge will therefore install the latest previous version, in this case the 340.102 driver.<br />
<br />
{{note|Installing the driver with the '''gtk''' use flags will also provide <code>media-video/nvidia-settings</code> which is a graphical tool for monitoring and various settings for your video card}}<br />
<br />
When the installation is complete run {{c|nvidia-modprobe}} module to manually load kernel modules to begin testing.<br />
<br />
=== The Importance of the Video Group ===<br />
<br />
While many video drivers (those that are part of xorg-x11) do not require users to be part of the {{c|video}} group for hardware acceleration, the NVIDIA drivers definitely do require this. Please make sure that any non-root user is part of the {{c|video}} group. This can be done by using {{c|vigr}} or via the command-line as follows:<br />
<br />
{{console|body=<br />
# ##i## usermod -a -G video myusername<br />
}}<br />
<br />
=== Testing your Video Card ===<br />
To test your video card run the glxinfo program, which is part of the mesa-progs package. This will check if direct rendering is enabled.<br />
<console><br />
$ ##i##glxinfo | grep direct<br />
direct rendering: yes<br />
</console><br />
<br />
== Configuring ==<br />
=== Loading at boot ===<br />
To automate the loading of the module when you boot your system, add '''nvidia''' in modules variable.<br />
<console><br />
# ##i##nano /etc/conf.d/modules<br />
modules="nvidia"<br />
</console><br />
<br />
=== Integration with X Server ===<br />
When your X server is installed and there is a <code>/etc/X11/xorg.conf</code> you can run the nvidia-xconfig which will identify and set the video card, amongst other possible configurations, in your xorg.conf.<br />
<br />
<console>###i## nvidia-xconfig</console><br />
<br />
{{file|name=/etc/X11/xorg.conf|body=<br />
Section "Device"<br />
Identifier "nvidia"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
BoardName "[Name] [Model]"<br />
Option "RegistryDwords" "EnableBrightnessControl=1"<br />
EndSection<br />
}}<br />
<br />
{{Note|1=The "EnableBrightnessControl=1" option above will allow laptop backlight brightness to be controlled via hotkey or via GNOME slider. Without this option, it is likely that brightness will not be able to be controlled.}}<br />
<br />
=== Enabling NVIDIA Support ===<br />
Include the use flag in '''nvidia''' in <code>/etc/portage/[[make.conf]]</code> so that applications flags are set correctly.<br />
<console><br />
# ##i##nano /etc/portage/make.conf<br />
USE="nvidia"<br />
</console><br />
<br />
=== Enabling OpenGL/OpenCL ===<br />
As a requirement, make sure that the Xorg server is not in use during this change. To enable OpenGL and OpenCL.<br />
<console><br />
###i## eselect opengl set nvidia<br />
###i## eselect opencl set nvidia<br />
</console><br />
<br />
== TemptorSent's Experimental NVIDIA ebuilds ==<br />
'''These are an active work-in-progress which are not expected to work out of the box yet!'''<br />
<br />
'''Use at your own risk -- ''if it breaks, you get to keep the pieces.'' '''<br />
<br />
The <code>x11-drivers/nvidia-drivers</code> packages contained in the following repo utilize<br />
a parser which evaluates the package manifest included in NVIDIA's packaging directly and<br />
installs requested components to specified directories.<br />
<br />
Add the overlay:<br />
<console><br />
###i## mkdir -p /var/git/overlay<br />
###i## cd /var/git/overlay<br />
###i## git clone https://github.com/TemptorSent/overlay-nvidia-testkit nvidia-testkit<br />
###i## cat > /etc/portage/repos.conf/overlay-nvidia-testkit<br />
[nvidia-testkit]<br />
location = /var/git/overlay/nvidia-testkit<br />
auto-sync = no<br />
priority = 10<br />
^D<br />
###i## cat >> /etc/portage/package.mask<br />
# upstream gentoo mask we need to fix<br />
=media-libs/libglvnd-1.1.1.20190313<br />
^D<br />
###i## cat >> /etc/portage/package.use<br />
# if you JUST have an NVIDIA video card, we DON'T want these -- nvidia-drivers provides them for us:<br />
media-libs/mesa -opencl -vdpau -xa -vulkan<br />
# if you have a multi-GPU setup with a non-NVIDIA card, then the above should be OK to omit.<br />
^D<br />
#<br />
</console><br />
<br />
Install the package, and include mesa so it is rebuilt as well, since we need the new version from nvidia-testkit:<br />
<console><br />
###i## emerge nvidia-drivers mesa<br />
</console><br />
<br />
This will install both the drivers and the now split <code>nvidia-kernel-modules</code> package.<br />
<br />
Please note that you will need the mesa and libglvnd ebuilds provided in the nvidia-testkit repo for full functionality.<br />
<br />
{{Important|Once the new drivers are installed, you will notice that {{c|eselect opengl}} will display {{c|xorg-x11}}. This is OK! With the new drivers, the {{c|libglvnd}} package now provides libGL and brokers the GL calls to the appropriate underlying hardware-specific library, making {{c|eselect opengl}} redundant. We may fix this is the production release so that {{c|eselect opengl}} shows {{c|glvnd}} instead, to avoid confusion.}}<br />
<br />
The remainder of configuration should remain mostly the same as above where needed, consult NVIDIA's docs for details.<br />
Please contact TemptorSent on freenode IRC in #funtoo.<br />
<br />
[[Category:Video Cards]]<br />
[[Category:First Steps]]<br />
{{EbuildFooter}}</div>Senyai