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

Ported update.sh to D which will make it easier to run on Windows/OS X also #158

Closed
wants to merge 7 commits into from

Conversation

Laeeth
Copy link

@Laeeth Laeeth commented Jan 29, 2015

Hi.

Ported update.sh to D - hope this might be of some use. I don't pretend it is pretty generally, and in particular I tried to stick to the structure of the original script for clarity, even though it would be more elegant to factor out the repetition.

Just run makeit.sh to compile - you may want to change the compiler to dmd. I destroyed my system dmd with a null file when working on it, so changed to ldc temporarily.

Laeeth.

@andralex
Copy link
Member

This requires some additional work:

  • add building the binaries to the build (*.mak)
  • create pages on the website for explaining what it does and downloading it (this is a logistics matter you could take with @CyberShadow)

There's also significant tactical work you need to do on the sources. I'll make some notes.

@@ -0,0 +1,184 @@
module scriptutil;
import core.sys.posix.unistd:geteuid;
Copy link
Member

Choose a reason for hiding this comment

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

spaces around :

@andralex
Copy link
Member

that's what I got for now

@Laeeth
Copy link
Author

Laeeth commented Jan 29, 2015

Thanks, Andrei.

I am honoured to be destroyed, and will make the changes you suggest.

Laeeth.

Sent from my iPad

On 29 Jan 2015, at 18:59, Andrei Alexandrescu notifications@github.com wrote:

that's what I got for now


Reply to this email directly or view it on GitHub.

@Laeeth
Copy link
Author

Laeeth commented Jan 29, 2015

Btw just as some background - I started learning to code when I was ten (1983) but pursued hedge fund money management as a career. I need to refresh my skills to develop some big data ideas. So many of the developments that took place whilst I was busy doing other things passed me by, and I have spent the past year as a sabbatical catching up a little. But practice makes better, and so does good critique and I thank you for the latter.

Laeeth.

Sent from my iPad

On 29 Jan 2015, at 18:53, Andrei Alexandrescu notifications@github.com wrote:

This requires some additional work:

add building the binaries to the build (*.mak)
create pages on the website for explaining what it does and downloading it (this is a logistics matter you could take with @CyberShadow)
There's also significant tactical work you need to do on the sources. I'll make some notes.


Reply to this email directly or view it on GitHub.

@andralex
Copy link
Member

Awesome, thanks. FWIW your style is totally fine, just a bit different from the usual in this codebase.

@Laeeth
Copy link
Author

Laeeth commented Jan 30, 2015

Thanks. I incorporated your suggestions - hope that is okay now. I haven't yet been able to test on Windows as I am rebuilding my VM and might be a couple of days before I have time. So in the meantime I changed posix.mak but didn't want to touch the windows makefile in case doing so broke the whole build.

@CyberShadow
Copy link
Member

Before too much work is expended here, I'm going to plug my project again:

https://github.com/CyberShadow/Digger

It does almost all that this small script does, and much more. Crucially, it obtains all the dependencies needed to build D on Windows - even Visual Studio components for Win64 builds - and installs them in a directory, without affecting the host system.

There is also DVM, which doesn't download D but knows how to build and install downloaded D source.

I know Andrei knows about Digger, and I've posted a link to the forum thread, so I'd like to question the reason for spending efforts on solved problems.

@Laeeth
Copy link
Author

Laeeth commented Jan 30, 2015

I had a chat with Vladimir on irc earlier. I didn't know about Digger before, and it does look nice, and it is easy enough to use.

I don't think it's a terrible thing to have choices in build/fetch tools, and it is good to have the option of a minimal tool because less brittle and easy to fix. (Nassim Taleb's antifragility).

But I will leave it to you. A basic README.MD is in the repo, although my markup knowledge is very basic, and it needs a slight tidyup. The other changes you asked for have been incorporated.

@marler8997
Copy link
Contributor

@CyberShadow I'm putting the nightly build together for asm.dlang.org. I used update.sh to download and update and build but I can switch to Digger. I have tried to use digger before but I really didn't like using a browser to connect to it. I believe you can also use the command line but that kinda turned me off so I moved on to other things. However, I do want the setup the nightly build the right way so I'm asking for your advice on this. Which tool should we use? update.sh? Digger? Dvm? and why? Thanks.


// Take care of the command line arguments
writefln("* fetchdlang: a tool for building and maintaining the dlang toolchain from github");
foreach(arg; args[1 .. $])
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you not able to use std.getopt for this?

Copy link
Author

Choose a reason for hiding this comment

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

honestly, as I wrote it, I sort of clenched my teeth and forced myself to choose the path of a line of line translation rather than a write the functionality from scratch path. if I were writing from scratch, I would also have made as much as possible data rather than hard coding it - so you have a json table of what you need to do. but it is harder to understand, and harder to see what it is doing that way.

On the one hand, the reason to have done this is because it is appealing to have a native code tool and to eat your own dogfood. On the other everything that goes in here is somewhat a showcase, so it makes sense to do things as elegantly as possible.

I am happy to change if people feel strongly about it.

Wrt digger vs a simple little tool, I wasn't aware of digger, and it is beautiful, like Vladimir's other projects. It is a philosophical choice about simple tools that do one thing versus powerful tools that unavoidably are more complex and intimidating. I do not think it hurts to give people a choice, because of the compounding of complexity problem when you are new to a domain. I think thtat's why Andrei was excited about update.sh - his focus being to make it easy and unintimidating for new developers to get involved, and because small initial frictions have large consequences.

Anyway - I leave it to you to decide.

Laeeth.

@CyberShadow
Copy link
Member

have tried to use digger before but I really didn't like using a browser to connect to it. I believe you can also use the command line but that kinda turned me off

The web interface is a completely separate program built on top of the command-line "core".

However, I do want the setup the nightly build the right way so I'm asking for your advice on this. Which tool should we use? update.sh? Digger? Dvm? and why? Thanks.

At last year's DConf, Andrei told me we should get Digger into the D-P-L.org repository. If he still means it, then it could probably replace update.sh.

@marler8997
Copy link
Contributor

Good to know the web interface is separate. I'll look into it again.

@CyberShadow
Copy link
Member

@marler8997 BTW, would you be interested in looking at DPaste as well? It is in dire need of a maintainer, and I have my hands full already unfortunately.

@marler8997
Copy link
Contributor

Sure. Email me the details, what needs to be done.

@mihails-strasuns
Copy link

On a related topic, @CyberShadow could you please check the readme for https://github.com/Dicebot/TestDlangAggregated and say what do you think about the design described there? It has rather different goals from https://bitbucket.org/cybershadow/d but still seems very relevant to your work.

@CyberShadow
Copy link
Member

Sure:

This may seem surprising but rationale is very simple - there is no scripting language that would be guaranteed to be installed on any operating system.

Also people will need a D compiler to build D anyway (ddmd).

It doesn't try to always track the master HEAD of submodule repositories - sadly, git does not allow to use branches-submodules without saving specific commit hash.

Git 1.8.2 added the ability to track branches in submodules.

You may notice that after the build all binaries get placed into ./bin folder inside the cloned repo with a -dev suffix.

This may make using tools such as rdmd or dub difficult. Something like what dvm does might be better. Right now I'm working on an "install" command for digger, alongside an "uninstall" command - with caching, you could use it as a dvm replacement. But for a simple "just get me on my feet" tool, this might be the simplest solution.

Integration with Digger is planned for advanced traversal through D-Programming-Language repository history (bisection, for example)

Care to go into more detail here?

@mihails-strasuns
Copy link

Git 1.8.2 added the ability to track branches in submodules

I have experimented with that feature. It doesn't work as one would expect it to work - git still stores specific commit hash. Only difference with "normal" submodule seems that it knows remote tracking branch and thus git submodule update --remote can be used to keep moving to current master.

Unless I missed some obscure documentation part?

This may make using tools such as rdmd or dub difficult.

I don't see how. It provides full copy of the toolchain with -dev suffixes, including rdmd-dev and dub-dev - this is layout I have been using personally for few years now to do DMD/Phobos development.

Something like what dvm does might be better. Right now I'm working on an "install" command for digger, alongside an "uninstall" command - with caching, you could use it as a dvm replacement.

That is simply different level of operation and I think it is better left to Digger. Adding any state to user system goes beyond the concept of "quick to try, quick to get rid of" startup repository. I see those as different approaches for different use cases.

Care to go into more detail here?

At the very least - have digger as one of submodules / move it to D-Programming-Language/tools and provide wrapper commands to top-level scripts that call it using the same sandbox layout. I was actually hoping you could spot more opportunities for Digger from such standardized layout :)

@CyberShadow
Copy link
Member

Only difference with "normal" submodule seems that it knows remote tracking branch and thus git submodule update --remote can be used to keep moving to current master.

I see. I haven't used it myself.

I don't see how. It provides full copy of the toolchain with -dev suffixes, including rdmd-dev and dub-dev - this is layout I have been using personally for few years now to do DMD/Phobos development.

So rdmd-dev and dub-dev are patched to run dmd-dev instead of dmd?

At the very least - have digger as one of submodules / move it to D-Programming-Language/tools and provide wrapper commands to top-level scripts that call it using the same sandbox layout. I was actually hoping you could spot more opportunities for Digger from such standardized layout :)

Well, for one, I think it wouldn't be hard to implement this script's functionality on top of Digger, which shouldn't be very difficult, and which would give it Digger's advantages (caching, getting all dependencies for Win32/Win64, etc.)

@andralex
Copy link
Member

With apologies to @Laeeth, I think we should double down on Digger instead of diverting into creating and maintaining a new tool. tools/update.sh does remain a fine option for people who can't use Digger because they don't have any installation of D and just want to get started.

I knew about Digger but never used it so I neglected its relevance to this. Apologies.

I filed https://issues.dlang.org/show_bug.cgi?id=14091. @Laeeth @CyberShadow if there is agreement on the course of action please close this. Thanks.

@Laeeth
Copy link
Author

Laeeth commented Jan 31, 2015

It certainly makes sense to build on what we have, and it is normal to have experiments that one decides against using. So I shall close this pull request.

@Laeeth Laeeth closed this Jan 31, 2015
@CyberShadow
Copy link
Member

because they don't have any installation of D and just want to get started.

Incidentally, I've started creating binary packages of Digger for all major platforms:
https://github.com/CyberShadow/Digger/releases/tag/1.1-alpha-1

@mihails-strasuns
Copy link

I've started creating binary packages of Digger for all major platforms

I have also Arch Linux package for Digger in progress but need to decide on standard layout for file artifact placement first.

@CyberShadow
Copy link
Member

@ibuclaw was dealing with the same question while creating Debian/Ubuntu packages just a few days ago. I believe he patched the code to move the "www" directory somewhere else.

Let me know if I can help.

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