guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Rust bootstrap


From: Danny Milosavljevic
Subject: Re: Question about Rust bootstrap
Date: Thu, 20 Sep 2018 11:39:07 +0200

Hi Mark,

On Thu, 20 Sep 2018 02:35:27 -0400
Mark H Weaver <address@hidden> wrote:

> Speaking of our Rust packages, I have a question: is it intentional that
> 'rust-1.23' is still built using 'rust-bootstrap' and not 'rust-1.22'?

Yes, because I'm not done yet :)

> The reason I ask is that, to my delight, there appears to be (almost?)
> everything needed for a complete source-only bootstrap chain for recent
> Rust:
> 
> * rust-1.19.0 is built using mrustc
> * rust-1.20.0 is built using rust-1.19.0
> * rust-1.21.0 is built using rust-1.20.0
> * rust-1.22.1 is built using rust-1.21.0
> * rust-1.23.0 is built using pre-built 'rust-bootstrap' (1.22.1)  (???)
> * rust-1.24.1 is built using rust-1.23.0
> * rust-1.25.0 is built using rust-1.24.1
> * rust-1.26.2 is built using rust-1.25.0
> * rust-1.27.2 is built using rust-1.26.2
> 
> This chain would be complete if 'rust-1.23' were built using 'rust-1.22'
> instead of 'rust-bootstrap'.  Since both 'rust-1.22' and
> 'rust-bootstrap' are apparently for the same version of Rust (1.22.1),
> I would naturally expect one to work in place of the other one.
> Have you tried it?

rust 1.20.0 has a failure when creating the documentation (check phase)
because it does not create "version_info.html" from "version_info.html.template"
- although it should.  On the other hand it passes all the tests (about 7000
of them).

I'm investigating why the documentation does not build.

Every guix build rust takes about half a day to complete on my machine, so it
will still take a week or so I'd say.

The build rule for version_info.html is in src/bootstrap/doc.rs , search
for "version_info.html".

I'm tempted to just patch "!up_to_date(&version_input, &version_info)" out of
it - but maybe it's covering up a deeper issue.

There's this:

pub fn mtime(path: &Path) -> FileTime {
    fs::metadata(path).map(|f| {
        FileTime::from_last_modification_time(&f)
    }).unwrap_or(FileTime::zero())
}

pub fn up_to_date(src: &Path, dst: &Path) -> bool {
    let threshold = mtime(dst);
    let meta = match fs::metadata(src) {
        Ok(meta) => meta,
        Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
    };
    if meta.is_dir() {
        dir_up_to_date(src, &threshold)
    } else {
        FileTime::from_last_modification_time(&meta) <= threshold
    }
}

So what if the destination does not exist?
Then the source would have to have zero timestamp for up_to_date to return true
(which we don't want), right?
So we should have non-zero timestamps for source files.
And I've checked the guix-build-rust directory, they all have timestamps of 
zero.

Sigh.  So I'll change all the source timestamps to 1, problem maybe solved.
Rebuilding...

Aha, newer rust version have:

pub fn up_to_date(src: &Path, dst: &Path) -> bool {
    if !dst.exists() { //             !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        return false;
    }
    let threshold = mtime(dst);
    let meta = match fs::metadata(src) {
        Ok(meta) => meta,
        Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
    };
    if meta.is_dir() {
        dir_up_to_date(src, threshold)
    } else {
        meta.modified().unwrap_or(UNIX_EPOCH) <= threshold
    }
}

Attachment: pgpykAU8irDXv.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]