Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing maintainer email does not work as expected #154

Closed
LiNk-NY opened this issue Aug 22, 2024 · 3 comments
Closed

changing maintainer email does not work as expected #154

LiNk-NY opened this issue Aug 22, 2024 · 3 comments

Comments

@LiNk-NY
Copy link

LiNk-NY commented Aug 22, 2024

Hi Gábor, @gaborcsardi

I am interested in changing only the maintainer email from the Authors@R field.
I tried to use change_maintainer function but it is not changing the email
as expected (see the reprex below).

Is this the right way to think about it?
I also tried desc_change_maintainer and it didn't work either.

Thanks!

suppressPackageStartupMessages(library(desc))
desctext <- "
Package: Foo
Title: A test package
Version: 0.99.0
Authors@R: c(
    person('John', 'Snow', email = 'john.snow@email.com',
    role = c('aut', 'cre')
    )
  )
Description: This is a test.
Depends:
    R (>= 3.0.0)
Encoding: UTF-8
"
desc <- desc(text = desctext)
desc <- desc[["change_maintainer"]](
    email = "john.snow@newmail.edu",
)
desc$get_maintainer()
#> [1] "John Snow <john.snow@email.com>"

Created on 2024-08-22 with reprex v2.1.1

I am using

> packageVersion("desc")
[1] '1.4.3'
@gaborcsardi
Copy link
Member

gaborcsardi commented Aug 22, 2024

change_maintainer() changes the maintainer to another author. I.e. it only changes the roles of two authors.

@LiNk-NY
Copy link
Author

LiNk-NY commented Aug 22, 2024

I see, it looks for the person with the email provided and changes that person's role. Thanks.

@LiNk-NY LiNk-NY closed this as completed Aug 22, 2024
@LiNk-NY
Copy link
Author

LiNk-NY commented Aug 22, 2024

For anyone interested, here is how I changed the maintainer email when there is a single author present:

suppressPackageStartupMessages(library(desc))
desctext <- "
Package: Foo
Title: A test package
Version: 0.99.0
Authors@R: c(
    person('John', 'Snow', email = 'john.snow@email.com',
    role = c('aut', 'cre')
    )
  )
Description: This is a test.
Depends:
    R (>= 3.0.0)
Encoding: UTF-8
"
desc <- desc(text = desctext)
desc$add_author(
    given = "John", family = "Snow",
    email = "john.snow@newemail.edu"
)
desc$change_maintainer(
    given = "John", family = "Snow",
    email = "john.snow@newemail.edu"
)
desc$add_role(
    role = "aut",
    given = "John", family = "Snow",
    email = "john.snow@newemail.edu"
)
desc$del_author(
    given = "John", family = "Snow",
    email = "john.snow@email.com",
)
#> Author removed: John Snow.
desc
#> Package: Foo
#> Title: A test package
#> Version: 0.99.0
#> Authors@R (parsed):
#>     * John Snow <john.snow@newemail.edu> [cre, aut]
#> Description: This is a test.
#> Depends:
#>     R (>= 3.0.0)
#> Encoding: UTF-8

Created on 2024-08-22 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants