From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-dev+bounces-98063-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 85870158094
	for <garchives@archives.gentoo.org>; Mon,  5 Sep 2022 13:31:26 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E7AA3E07E6;
	Mon,  5 Sep 2022 13:31:21 +0000 (UTC)
Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C40C3E07C9
	for <gentoo-dev@lists.gentoo.org>; Mon,  5 Sep 2022 13:31:21 +0000 (UTC)
Received: by mail-pj1-x1029.google.com with SMTP id mj6so8463504pjb.1
        for <gentoo-dev@lists.gentoo.org>; Mon, 05 Sep 2022 06:31:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20210112;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date;
        bh=w1OkzTj1Yl+uVRewaTjzQeGN7joeHFMCvqKvZ/dnA6U=;
        b=EsX6Hjg8AegeRRmGJMBlSKkrVXCkF68tK/8You1rH5tOX4Aulbpu/lT0Q0FDkrdhv/
         o/kix5BUVJtYWM/7p0t5wCVsAe3GHgITWqE7uZVGW0URp3LPSiBwSLOGxM+vPhiWhgfO
         tNgBillctQ8bN1MLLR9ngcLp8QveOsDHUUKQKy35Ba6WVssAp+QmIUxf4Gn0M0R4lFY4
         Q6l+P8rM+A0mDNq0kLOUrgzrwPpEQVXBiauYCSzjmQDrsZaqdMBfVc0Ry4WnwdPs0Qs8
         iymGY79D80LOnEe3fH72RmPPZP5Hns/ZtRujSkGJWbwzhbmLfGCuoz+Lc7NSXepJPIMO
         IOaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-message-state:from:to:cc:subject:date;
        bh=w1OkzTj1Yl+uVRewaTjzQeGN7joeHFMCvqKvZ/dnA6U=;
        b=u/1PUmqSI/MA76XUIWKW2nuxMHjUWM4IfA0B8bGbO71y41k/5/0IiLfbswVTx+y8m8
         ETjpCf3W72F/Ja/jO5q3oIcY+DCibRMZTHGUft0OdCRPkp7LT+2REff4u4SKY5zQ1O2E
         vl/oEiVS1Op0DzfwjkqC4R/ExXw3Mgkg+iUrYpyPHfMCvdnDQJHwQS6JQfPOGtPF11e/
         SabxM/mVe+vwu1BI4JPECjQHzYHMK4fCcgGJ2fvfkPH6PTvQaxysPkApGrG5MrPTR6uk
         8xmxB3QFzctmpbyncO9V/PijPM3KmbpcpeBg3tr1hEzyckn8fpqRlYhwHIJUzyTN7lxT
         dfOw==
X-Gm-Message-State: ACgBeo3YFHQ3h4cDc8gYv+8sArkxO1xpzfJmHtvv1eH2L4UgDSwGQoM4
	S+SMxHkvfr8mIRGBcuh/PXu67agOLRDzleyG
X-Google-Smtp-Source: AA6agR6NZ2xgLl1SrGvqVv+HKjqhJ05IBA0GI43EKgazx2Y6FpUW7QCheuduzBDfscghpierWyJbfw==
X-Received: by 2002:a17:902:dac8:b0:174:cf17:6e93 with SMTP id q8-20020a170902dac800b00174cf176e93mr37738660plx.93.1662384680402;
        Mon, 05 Sep 2022 06:31:20 -0700 (PDT)
Received: from localhost (49.212.183.201.v6.sakura.ne.jp. [2403:3a00:202:1120:49:212:183:201])
        by smtp.gmail.com with ESMTPSA id z188-20020a6233c5000000b00536aa488062sm7700969pfz.163.2022.09.05.06.31.19
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 05 Sep 2022 06:31:20 -0700 (PDT)
From: Yiyang Wu <xgreenlandforwyy@gmail.com>
To: gentoo-dev@lists.gentoo.org
Cc: Benda Xu <heroxbd@gentoo.org>
Subject: [gentoo-dev] [PATCH v7 0/2] rocm.eclass: new eclass
Date: Mon,  5 Sep 2022 21:31:15 +0800
Message-Id: <cover.1662383384.git.xgreenlandforwyy@gmail.com>
X-Mailer: git-send-email 2.34.1
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Archives-Salt: b8707da4-de89-431d-aa53-dba8a727d266
X-Archives-Hash: 49b17ca059187a4b5d983a9500507158

Comparing to v6, rocn.eclass refactorized a lot in v7, thanks to
MichaƂ's critical comments on
https://github.com/gentoo/gentoo/pull/26784.

Now the eclass code base is much cleaner, mostly because specific codes
in phase functions are removed.

Changelog against v6:

1. Remove phase functions rocm_src_configure and rocm_src_test. The code
duplication among ROCm ebuilds are not so large that a common phase
function is necessary. Writing a all-in-one phase function would cause
the eclass hard to maintain.

2. check_rw_permission -> check_amdgpu. Limit the function to check
amdgpu device, and move `addwrite /dev/kfd` from rocm_src_test into it.
So ebuilds can simply call check_amdgpu in src_test and do the reset of
testing.

3. Standardize and simplify codes including bash array handling.

4. ROCM_VERSION is required for all packages, not assumed to be ${PV}.

5. Reshaped the examples according to the changes.

6. Update reference of AMDGPU device map, pointing to codes in an
official repo rather than a summarize hosted on a third-party web page.

I would also like to ask a question. In check_amdgpu, if GPU access
denied, the eclass suggest the user to check whether the portage user is
in render group or not. I would like to print the username, so I tried
use ${USER} but it is not set during src_test.  Previously, I used
${PORTAGE_USERNAME} but its a potage internal variable. Is there an
approach to print the portage username? Would $(whoami) suitable for
this job?

Yiyang Wu (2):
  rocm.eclass: new eclass
  profiles/desc: add amdgpu_targets.desc for USE_EXPAND

 eclass/rocm.eclass                | 223 ++++++++++++++++++++++++++++++
 profiles/base/make.defaults       |   2 +-
 profiles/desc/amdgpu_targets.desc |  17 +++
 3 files changed, 241 insertions(+), 1 deletion(-)
 create mode 100644 eclass/rocm.eclass
 create mode 100644 profiles/desc/amdgpu_targets.desc

-- 
2.34.1