{"id":94,"date":"2023-04-28T00:31:16","date_gmt":"2023-04-28T00:31:16","guid":{"rendered":"https:\/\/gabriel.marcanobrady.family\/blog\/?p=94"},"modified":"2023-04-28T00:31:16","modified_gmt":"2023-04-28T00:31:16","slug":"gentoos-sets-conf-dateset","status":"publish","type":"post","link":"https:\/\/gabriel.marcanobrady.family\/blog\/2023\/04\/28\/gentoos-sets-conf-dateset\/","title":{"rendered":"Gentoo&#8217;s sets.conf DateSet"},"content":{"rendered":"\n<p>I wanted to write this blog entry because this isn&#8217;t the first time I&#8217;ve rediscovered this bit of Gentoo functionality, and I suspect it will not be the last.<\/p>\n\n\n\n<p>Recently my GCC upgrade from <code>sys-devel\/gcc:12<\/code> to <code>sys-devel\/gcc:13<\/code>, and because I build most of my system with LTO, &#8220;bad things&#8221; started happening (mostly when building newer packages, LTO bytecode mismatch). I found myself wanting to rebuild all of the packages built prior to <code>gcc:13<\/code> being installed&#8230; and remembered that at some point I had figured out this exact problem on an older system of mine through the use of Gentoo portage sets.<\/p>\n\n\n\n<p>Gentoo&#8217;s portage&#8217;s set support is <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.gentoo.org\/~zmedico\/portage\/doc\/ch02.html\" target=\"_blank\">quite extensive<\/a>, including a bunch of set classes that can control how packages are selected (like <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.gentoo.org\/~zmedico\/portage\/doc\/ch02s03s12.html\" target=\"_blank\"><code>AgeSet<\/code><\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.gentoo.org\/~zmedico\/portage\/doc\/ch02s03s13.html\" target=\"_blank\"><code>CategorySet<\/code><\/a>). My goal was to make a set, like <code>@older_gcc<\/code>, that contained all of the packages built before the current <code>gcc<\/code>. I briefly considered using <code>AgeSet<\/code>, which lets you specify a number of days ago, and then you specify whether to select packages newer than that day, or older. Something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;older_gcc]\nclass = portage.sets.dbapi.AgetSet\nage = 1\nmode = older<\/code><\/pre>\n\n\n\n<p>But, that configuration doesn&#8217;t cover any packages that might have installed today before <code>gcc:13<\/code>. Also, I&#8217;ll probably forget to run this next time <code>gcc<\/code> does a major update, and I&#8217;ll have to update the age parameter.<\/p>\n\n\n\n<p>It was here than I remembered doing something else many years ago, but I could not find anything relevant in the portage documentation. After digging through the portage source code, I found <a rel=\"noreferrer noopener\" href=\"https:\/\/gitweb.gentoo.org\/proj\/portage.git\/tree\/lib\/portage\/_sets\/dbapi.py?h=portage-3.0.46#n483\" target=\"_blank\"><code>DateSet<\/code><\/a>. This class allows one to specify a package as a point of reference! This is exactly what I wanted. As such, I&#8217;ve now added the following to my <code>\/etc\/portage\/sets.conf<\/code> :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;older_gcc]\nclass = portage.sets.dbapi.DateSet\npackage = sys-devel\/gcc<\/code><\/pre>\n\n\n\n<p>As far as I can tell from checking with <code>emerge -pv @older_gcc<\/code>, everything looks to be selected properly.<\/p>\n\n\n\n<p>Hopefully this is the last time I rediscover this bit of functionality&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to write this blog entry because this isn&#8217;t the first time I&#8217;ve rediscovered this bit of Gentoo functionality, and I suspect it will not be the last. Recently my GCC upgrade from sys-devel\/gcc:12 to sys-devel\/gcc:13, and because I build most of my system with LTO, &#8220;bad things&#8221; started happening (mostly when building newer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[8,6,7],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-gentoo","category-linux","tag-dateset","tag-gentoo-linux","tag-portage"],"_links":{"self":[{"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":2,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":96,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/posts\/94\/revisions\/96"}],"wp:attachment":[{"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gabriel.marcanobrady.family\/blog\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}