Thank you for the review, responses below.
Hilton Chain <hako@ultrarare.space> writes:
Toggle quote (43 lines)
> Hi Tomas,
>
> On Wed, 15 Jan 2025 07:40:19 +0800,
> Tomas Volf wrote:
>>
>> The script started with reset of the $PATH to a value not suitable to Guix.
>> In addition, the script requires coreutils and sed, so add those into the
>> $PATH.
>>
>> * gnu/packages/admin.scm (smartmontools)[arguments]<#:phases>: Add 'fix-path.
>>
>> Change-Id: Ide97f572e6f369fe24337f945474dc7a65584eda
>> ---
>> gnu/packages/admin.scm | 15 +++++++++++++--
>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
>> index 7f50d5f4e9..098e21ff8a 100644
>> --- a/gnu/packages/admin.scm
>> +++ b/gnu/packages/admin.scm
>> @@ -2921,8 +2921,19 @@ (define-public smartmontools
>> "0gcrzcb4g7f994n6nws26g6x15yjija1gyzd359sjv7r3xj1z9p9"))))
>> (build-system gnu-build-system)
>> (arguments
>> - (list #:make-flags
>> - #~(list "BUILD_INFO=\"(Guix)\"")))
>> + (list
>> + #:make-flags
>> + #~(list "BUILD_INFO=\"(Guix)\"")
>> + #:phases
>> + #~(modify-phases %standard-phases
>> + (add-after 'install 'fix-path
>> + (lambda _
>> + (substitute* (string-append #$output "/etc/smartd_warning.sh")
>> + (("export PATH=.*$" all)
>> + (string-append "PATH="
>> + #$(file-append sed "/bin") ":"
>> + #$(file-append coreutils "/bin") ":"
>> + "$PATH\n"))))))))
>
> Please add sed and coreutils-minimal to inputs and use search-input-file or
> this-package-input instead.
Why? I will of course do so, but would first like to understand why.
The current way seems to work and keeps all the references in just one
place. If I switch to the suggested approach, both `sed' and
`coreutils' will be referenced in two places (once in the `inputs' and
once here) and those will need to be kept in sync. So, uh, why do it?
Toggle quote (5 lines)
>
> For smartmontools the proper way is to set --with-scriptpath='...' configure
> flag, which is documented in its INSTALL file. (It can be disabled with a 'no'
> value as well.)
This does indeed seem to be more elegant approach, will use it for v2.
Toggle quote (9 lines)
>
>> (inputs (list libcap-ng))
>> (home-page "https://www.smartmontools.org/")
>> (synopsis "S.M.A.R.T. harddisk control and monitoring tools")
>> --
>> 2.47.1
>
> Thanks
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----
iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmeTsmwOHH5Ad29sZnNk
ZW4uY3oACgkQL7/ufbZ/wanI5w//RgKJ61iB5BO70O8AdgNZz8hvv5XStvP8vani
KyDTeWSd1Rnkc5R2nxJjwJuWtTJKIf2yGPsLyU5YO9gNc2sj2h1aQ6R6BV69bOVe
rvksqUNrYuWmfiEE43FdESjI1b1oSrSaoAxg7RMxXcWT1yzImSxOeVKy23HSFHV6
tlyg2evu9FbqwDyNUJP22IKP6ogaaerbTI7+RfpIyUWauMuNGb1azzVhcS8I1t/J
nZA3qZFn4g0tKxwU1EtV0eyTosjphJf5YZoFJh1IOopzISk2FIPpHYYrBOIS1T8u
Jtf+awfffy80E5Up7RBh8lIlfo6co+fPXsgwHNcNCqOABz2dVkOdnGJbHe3G+wDD
a+kTlvuRVHCm19gr0AaN/6stIJkellIBITG8VDY+LBGvFUZYlkaSlMkoV02VEu/b
0uhr5Tt5Mc9g076/NMODPI3GWMYiiGAMvJjyB4VigbfDaEWF4bULaownYWsYvo5u
RlOZljVwAMplNElR0ST7PZIfbR1teCqX4QNzyeaMtM6Q6etQgemNRa1rO63zw9Y5
lNS8xO44SgfOxQOQlw2/UGHROeZuqmEShU9RmBsnS77R0hKalYPGOqN3w2faSBd3
R47YEKJQMCrubyX0xPppyNm8BiI2ojUa7DB2Jn5h5e0BMEosPSz30ZGa3ltnR4OE
XXFo2o0=
=EeeP
-----END PGP SIGNATURE-----