Skip to content

Generate CFG_FILENAME_EXTRA from the version #25208

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

Merged
merged 3 commits into from
May 14, 2015
Merged

Generate CFG_FILENAME_EXTRA from the version #25208

merged 3 commits into from
May 14, 2015

Conversation

lambda-fairy
Copy link
Contributor

The code takes a prefix of the MD5 hash of the version string.

Since the hash command differs across GNU and BSD platforms, we scan for
the right one in the configure script.

Closes #25007

The code takes a prefix of the MD5 hash of the version string.

Since the hash command differs across GNU and BSD platforms, we scan for
the right one in the configure script.

Closes #25007
The old code simply scanned for the first digit, then munched anything
after that. This didn't work for md5sum, as it would see the "5" and
treat "5sum" as the version instead.

This patch tweaks the algorithm so that it looks for a second
consecutive digit (or dot) after the first. Since "md5sum" has only one
digit, the new code skips over it as intended.
@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@lambda-fairy
Copy link
Contributor Author

r? @brson

@rust-highfive rust-highfive assigned brson and unassigned alexcrichton May 8, 2015
CFG_FILENAME_EXTRA=4e7c5e5c
# Append a version-dependent hash to each library, so we can install different
# versions in the same place
CFG_FILENAME_EXTRA=$(shell echo -n $(CFG_RELEASE) | $(CFG_HASH_COMMAND))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember the details but echo -n can't be counted on to behave the same everywhere. Can you change this to just echo? Hopefully that results in the same output everywhere - we need these hashes to come out the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I think I'll use printf '%s' instead, which has more consistent behavior than echo.

The configure script depends on printf already, so it should be okay to use it.

According to POSIX, the behavior of `echo -n` is "implementation
defined". So we can't guarantee that it gives the same result
everywhere.

See also:
* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
* http://unix.stackexchange.com/q/65803/9814
@brson
Copy link
Contributor

brson commented May 13, 2015

Ah good idea with printf.

@bors: r+

@bors
Copy link
Collaborator

bors commented May 13, 2015

📌 Commit 2c0db5e has been approved by brson

@bors
Copy link
Collaborator

bors commented May 13, 2015

⌛ Testing commit 2c0db5e with merge 32504ca...

@bors
Copy link
Collaborator

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Collaborator

bors commented May 13, 2015

⌛ Testing commit 2c0db5e with merge 4349cc8...

@bors
Copy link
Collaborator

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Collaborator

bors commented May 14, 2015

⌛ Testing commit 2c0db5e with merge e539424...

bors added a commit that referenced this pull request May 14, 2015
The code takes a prefix of the MD5 hash of the version string.

Since the hash command differs across GNU and BSD platforms, we scan for
the right one in the configure script.

Closes #25007
@bors bors merged commit 2c0db5e into rust-lang:master May 14, 2015
@lambda-fairy lambda-fairy deleted the version-hash branch May 14, 2015 03:15
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

Successfully merging this pull request may close these issues.

Calculate the value of CFG_FILENAME_EXTRA from the version
5 participants