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

RFC: Simpelify packaging by splitting out collection of git version info #5095

Closed
wants to merge 7 commits into from

Conversation

ivarne
Copy link
Sponsor Member

@ivarne ivarne commented Dec 10, 2013

This is intended to be part of the solution to #5068. I tried to look at the submodules also, but I was confused, and hope someone else will tackle that problem.

It would be nice to get some feedback on the changes. I have only tried it on Ubuntu, because I tried to dual boot my MacBook Pro, but now I can't boot into OSX.

  • Renamed BUILD_INFO to GIT_VERSION_INFO (I'm not sure about this one, but it makes sense)
  • Put the git parts of build_h.jl into version_git.jl
  • Made sure that an existing version_git.jl file does not get overwritten if
    if no git information is availible.

* Renamed BUILD_INFO to GIT_VERSION_INFO
* Put the git parts of build_h.jl into version_git.jl
* Made sure that an existing version_git.jl file does not get overwritten if
  if no git information is availible.
@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 10, 2013

Hmm.. Adding another file that must not be committed has the unfortunate consequence that it will suddenly show up when you checkout another branch (or a older tagged commit). Now, if you do make clean before you change branch, you'll not get that orphaned file.

version_git.jl.phony:
@# The first check is to ensure that we don't overwrite version.git if git is unavailible.
@if !( [ -f version_git.jl ] && ! [ -d ../.git ] ); then \
sh version_git.sh >> $@ \
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

My shell (bash in OSX) needs a semicolon at the end of this command

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 11, 2013

@staticfloat Thanks, I'll try to implement your suggestions

NO_GIT flag seems like a good suggestion. I'll also issue a warning if git status fails, to instruct users to pregenerate version_git.jl and set the flag.

JULIA_COMMIT = $(shell git rev-parse --short=10 HEAD)
else
JULIA_COMMIT = "NotAvailible"
endif
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

These variables JULIA_COMMIT and JULIA_VERSION are almost not used. See https://gist.github.com/ivarne/8130d4cac3aa3e7772ee

It should be the same info that is used in all processes involving version and commit

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Since JULIA_COMMIT is only used for file naming, I think it'd be better to just set JULIA_COMMIT = JULIA_VERSION instead of "Not Available".

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

That seems right

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 11, 2013

Now we have to decide if we want to name-space the other build constants that I left in build_h.jl. Having them in a type or dictionary is kind of nicer than global constants.

@staticfloat
Copy link
Sponsor Member

Let's leave the rest of build_h.jl alone for now. This works well for me on OSX. (Tested both with git information, and with .git moved away). I'd say this is good to merge.

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 11, 2013

It would be nice if it could be tested in the supported environmens on windows first. I will also add a notice in DISTRIBUTING.md, but that will have to wait until tomorrow.

@staticfloat
Copy link
Sponsor Member

@vtjnash @loladiro Could one of you two test on windows?

Also tweaked output from make
staticfloat added a commit to staticfloat/julia-nightly-packaging that referenced this pull request Dec 15, 2013
Attemt at cleaning up nighty packaging after JuliaLang/julia#5095
@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

@nalimilan Have you tried this patch? Does it solve your problems?

PS. Sorry that I did not recognize you in the other issue.

@nalimilan
Copy link
Member

I've grabbed the tarball from this branch, disabled my no-git patch and built the RPM, and I get an error:

Warning: git information unavailable; versioning information limited
Warning: git information unavailable; versioning information limited
version_git.jl
error during bootstrap: LoadError(at "sysimg.jl" line 25: LoadError(at "version_git.jl" line 2: ErrorException("syntax: extra token "commit_short" after end of expression")))
make[1]: *** [/home/makerpm/rpmbuild/BUILD/julia-1bed8950421f195b7cd6c8305009f4636cf1aeab/usr/lib64/julia/sys0.ji] Error 1

The file itself contains this:

# This file was autogenerated in base/version_git.sh
immutable GitVersionInfo\n    commit::String\n    commit_short::String\n    branch::String\n    build_number::Int\n    date_string::String\n    tagged_commit::Bool\n    fork_master_distance::Int\n    fork_master_timestamp::Float64\nend\n
# Default output if git is not availible.
const GIT_VERSION_INFO = GitVersionInfo("" ,"" ,"" ,0 ,"" ,true ,0 ,0.)

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

Thanks for trying this out. Do you really get the \n in the output?

If so, your system probably have a echo command that does not substitute \n with newlines. I will make a fix, where i have a new echo statement for every line instead of a multiline string with newlines inside.

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

Please also read my modified DISTRIBUTING.md to find out how to pregenerate the version_git.jl file on a git enabled system before bundeling.

@nalimilan
Copy link
Member

Cool, with the new commit it works.

Why don't you build version_git.jl automatically if .git does not exist? It's not very nice to require packagers (and users installing from the tarball) to find out that very specific trick. make && make install should be enough if we want Julia to be packaged everywhere. :-)

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

The problem is that there is no way to put anything useful in the version_git.sh if there is no git repository. On my machine I can make without git info, but then GIT_VERSION_INFO will only be empty strings, and make will issue a warning. So it kind of works the way you describe. Does it not work for you?

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

I also think I will try to convince the core maintainers to check in a version_git.jl before tagging releases, and delete it in the next commit. That will probably fix that issue, but there is still the submodules that need to be handled somehow, if we are going to support building from a tarball.

@StefanKarpinski
Copy link
Sponsor Member

We've already reached the point where tagging a release has enough steps that we should automate it. Creating version_git.jl, checking it in, tagging a release, and git rm:ing it can be part of that process. But we can only make that part of the release process if it becomes automated.

@nalimilan
Copy link
Member

Agreed. You should also remove all .gitignore files as they make package checkers complain.

@ivarne When .git is missing, assume the VERSION file contains the correct version, and not git commit is needed. The way it currently works when you call make -C base version_git.jl.phony seems fine to me, it should just happen automatically.

FWIW, I've spotted a few typos in the code:

+  $(warn "Submodules could not be updated because git is unavailible")

+  @# This to avoid touching git_version.jl when it is not modified, so that the
+  @# so that the system image does not need to be rebuilt.

+  @if grep -q "Default output if git is not availible" version_git.jl; then \

+# Collect tempoarty variables

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 16, 2013

If the package checker complains about .gitignore you should delete them. I think they should be part of the repository, and it will mess up the history if they get deleted every now and then. Maybe we should just add a make target for a git free tarball instead. The problem is that it needs to be maintained, but that is the case if it is done in packaging scripts also.

What do you mean automatically? If the code works the same for you as for me, I get two warnings if .git is missing. One because submodules could not be updated, and one that tells you that you use a old version_git.jl or that an empty (automatically generated?) version_git.jl is used. Is the warnings a problem?

I'll try to fix the spelling issues tomorrow, thanks for noticing.

@StefanKarpinski
Copy link
Sponsor Member

Having a target that creates a git-free tarball without .gitignore and with a generated version_git.jl file seems like the better option.

@ivarne ivarne mentioned this pull request Dec 17, 2013
4 tasks
@nalimilan
Copy link
Member

@ivarne Currently indeed I delete .gitignore files, but I was asked to ask by Fedora people to ask Julia maintainers to produce a proper tarball free of any revision control elements; this makes life simpler for everybody. A make target to build the tarball is the way to go.

By "automatically", I meant that people should not need to call make -C base version_git.jl.phony. But I just tried and actually it's not needed. I misunderstood what you wrote in DISTRIBUTING.md. Maybe you should make it clear that the command is only needed if you care about git version information. When using a release tarball, that's not useful.

@ivarne
Copy link
Sponsor Member Author

ivarne commented Dec 17, 2013

My guess was that "nobody reads documentation", especially if it is long and convoluted. Therefore I made it so that it should never fail, but do the best job possible, and issue a warning if I think I miss some information. In the documentation I tell people how to do it correctly, not how they can be lazy and get a less desirable result.

@nalimilan
Copy link
Member

Sure. After #5181 is fixed, it would be cool to avoid printing the warning when building from a tarball, and to update DISTRIBUTING.md to explain that the git stuff is not useful in that case.

@ivarne
Copy link
Sponsor Member Author

ivarne commented Jan 3, 2014

@staticfloat While cleaning up this I found out that all the dependencies that require updated submodules also update submodules. Is there then any reason to update submodules in the main Makefile?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jan 3, 2014

That was originally done because the submodules don't know they need to update unless that is handled by the main Makefile. Conversely, the rules can be run separately, independent of the main Makefile updating them.

@staticfloat
Copy link
Sponsor Member

@ivarne any chance this can get rebased/merged soon? I'd love to have this to streamline the ubuntu nightly process.

staticfloat added a commit to staticfloat/julia-nightly-packaging that referenced this pull request Jan 15, 2014
staticfloat added a commit to staticfloat/julia-nightly-packaging that referenced this pull request Jan 26, 2014
@ivarne
Copy link
Sponsor Member Author

ivarne commented Jan 26, 2014

Merged in #5528

@ivarne ivarne closed this Jan 26, 2014
@ivarne ivarne deleted the distributing-fix branch January 26, 2014 23:07
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.

5 participants