Opened 7 months ago

Closed 7 months ago

#27091 closed defect (implemented)

Configure jenkins with CARGO_HOME in a writeable directory

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 032-backport, 033-backport, 034-backport
Cc: dmr Actual Points:
Parent ID: #24629 Points:
Reviewer: Sponsor:

Description

Or develop a workaround in the tor build scripts.

Child Tickets

Change History (6)

comment:1 Changed 7 months ago by teor

Keywords: 032-backport 033-backport added; not-just-linux tor-ci teor-was-assigned 034-triage-20180328 034-removed-20180328 035-removed-20180711 fast-fix removed

comment:2 Changed 7 months ago by teor

Status: newneeds_information

weasel has set CARGO_HOME to an empty writeable directory in the tor-rust jenkins builds.

But he says that we should make sure cargo only writes to the build directory, for the sake of Debian, Ubuntu and other distributions.

We should do whatever other Rust packages do.

If there's no clear answer, I suggest that we make the build directory CARGO_HOME if:

  • CARGO_HOME is unset or not writeable, and
  • HOME is unset or not writeable

comment:3 Changed 7 months ago by teor

Milestone: Tor: 0.3.5.x-finalTor: unspecified

comment:4 in reply to:  2 ; Changed 7 months ago by catalyst

Replying to teor:

If there's no clear answer, I suggest that we make the build directory CARGO_HOME if:

  • CARGO_HOME is unset or not writeable, and
  • HOME is unset or not writeable

If we build in offline mode, does cargo need to write to CARGO_HOME or HOME at all?

comment:5 in reply to:  4 ; Changed 7 months ago by Hello71

Replying to teor:

We should do whatever other Rust packages do.

As I said in #26038, "I think most C+Rust projects still use the global cache. I tried searching GitHub (​https://github.com/search?q=%22CARGO_HOME%22+extension%3Aam&type=Code). I found that tor is the only project that does not. for users who do not care, using the global cache will save download time and bandwidth on repeat builds, and for those who do care, my patch prints a warning so they will know. (maybe it should be downgraded to NOTICE?)". (fwiw, I checked librsvg just now and found that they override CARGO_HOME only for gitlab-ci builds)

If there's no clear answer, I suggest that we make the build directory CARGO_HOME if:

  • CARGO_HOME is unset or not writeable, and
  • HOME is unset or not writeable

I think this sounds acceptable, but indicates a broken build environment. I know Gentoo sets HOME to a private temporary directory for each package build. I believe all of the presently used standardized Debian build scripts do so as well.

Replying to catalyst:

If we build in offline mode, does cargo need to write to CARGO_HOME or HOME at all?

Not as far as I know. I believe Cargo presently stores only configuration, registry information, and package source in CARGO_HOME. The first one is manually created by the user (another solid reason to not override CARGO_HOME now that I think about it), and the other two are vendored.

comment:6 in reply to:  5 Changed 7 months ago by catalyst

Resolution: implemented
Status: needs_informationclosed

Replying to Hello71:

I believe Cargo presently stores only configuration, registry information, and package source in CARGO_HOME. The first one is manually created by the user (another solid reason to not override CARGO_HOME now that I think about it), and the other two are vendored.

Some quick experimentation seems to confirm this: in a build tree configured to build with Rust but in offline mode, cargo doesn't seem to try writing registry or cache stuff. Let's open a new ticket if we find evidence to the contrary, because the desired Jenkins config change seems to be deployed already.

Note: See TracTickets for help on using tickets.