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

Add create_dmd_release utility. #24

Merged
merged 6 commits into from Dec 21, 2013

Conversation

Abscissa
Copy link
Contributor

This is a tool to automatically generate both OS-specific and "all OSes" releases of DMD in both zip and 7z format, directly from the github sources.

The "how to" documentation is at the top of the source file:

https://github.com/Abscissa/installer/blob/create_dmd_release/create_dmd_release/create_dmd_release.d

NOTE: This tool "sort of" depends on itself actually being in the official repo. It will work fine before being pulled into the official repo, but the files in the "create_dmd_release/extras" won't be included in the releases it generates. Until this pull request gets merged, you can work around that like this:

After performing step #1 in the "Typical Usage" instructions at the top of the file (ie, extracting dmd-localextras.7z), then download the "create_dmd_release/extras" directory tree in this pull request. Merge both the "extras/all/dmd2" and "extras/[your os]/dmd2" trees into your "localextras-[your os]/dmd2" directory, and then proceed as normal.

I've tested this on the following platforms:

  • Windows: Building both 32- and 64-bit on a Win7 64-bit machine.
  • Linux 32-bit: Building --only-32 on a Debian 7 32-bit machine.
  • Linux 64-bit: Building --only-64 on a Debian 6 64-bit (non-multilib) machine.
  • FreeBSD 32-bit: Building --only-32 on a FreeBSD 9.1 32-bit machine.
  • OSX: Building both 32- and 64-bit on an OSX 10.7 machine, however, that was a week ago so it's possible this tool could have had a regression from one of the changes I've made since.

BTW, This won't work out-of-the-box for the current DMD releases, because it relies on several fixes/changes (mainly in makefiles) that currently only exist in master. (Ie, You can compile this tool just fine using DMD v2.063.2, but it won't generate a v2.063.2 release without some hacking.)

@MartinNowak
Copy link
Member

The baseline is that the module is quite complex for what it does and has many external dependencies.
Both of which make it pretty hard to maintain.
I agree with @braddr that a makefile seems like the better idea in the longer term.

fetching sources

extra tools

  • Don't force people to install 7z, provide a dmd-localextras.zip instead.
  • Directly process the zip file instead of manually pointing to localextras-linux.
  • Host dmd-localextras.zip on http://downloads.dlang.org/other/
  • Even better, drop non-D tools and host the rest in git.

use std.zip

use std.net.curl

  • Same as above downloading a file goes like get!(HTTP, ubyte)(url).

other stuff

  • Do something useful when no arguments are given (print help or build zip for current arch).
  • delete-trailing-whitespace

---------------------
- Git
- Posix: zip (Info-ZIP) and 7z (p7zip) (On Windows, these will automatically
be downloaded if necessary.)
Copy link
Member

Choose a reason for hiding this comment

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

As written you can get rid of git and zip. I think 7z is a separate topic and converting from zip to 7z is a 2-liner.

@MartinNowak
Copy link
Member

Building all linux releases in a single distro doesn't work (Issue 10710), so we kind of need to kill the one-for-all zip release.

@Abscissa
Copy link
Contributor Author

All your suggestions are good ones, but none of them are blockers for actually using this tool. If this actually gets used, then I'll be happy to improve it by addressing all those issues. Otherwise, there's no point in me pushing this any further and people can just improve it, replace it, or theorize over ideal approaches all they want.

So far there doesn't seem to be much interest in it, aside from Walter's desire to have the auto-tester do automated packaging. But for this particular tool, that appears to be a no-go as far as the auto-tester's admin is concerned. So again, either this gets used or it's DOA. If it does get used, then we can worry about making it perfect, in which case I'd be perfectly happy to do so. If not, then screw it we can fix our release process via the makefiles whenever anyone gets around to it.

if(do32Bit)
{
copyFile(cloneDir~"/dmd/src/dmd32"~exe, releaseBin32Dir~"/dmd"~exe);
copyDir(cloneDir~"/tools/generated/"~osDirName~"/32", releaseBin32Dir, file => !file.endsWith(obj));
Copy link
Member

Choose a reason for hiding this comment

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

BTW this fails for me on linux 64.

@MartinNowak
Copy link
Member

So again, either this gets used or it's DOA. If it does get used, then we can worry about making it perfect, in which case I'd be perfectly happy to do so.

True. I still think this tool is pretty good suited for our current release process, but the process itself is too complex, taking bits from too many locations to stuff everything into an all-in-one zip that nobody needs.

@Abscissa
Copy link
Contributor Author

On Mon, 14 Oct 2013 10:29:44 -0700
Martin Nowak notifications@github.com wrote:

True. I still think this tool is pretty good suited for our current
release process, but the process itself is too complex, taking bits
from too many locations to stuff everything into an all-in-one zip
that nobody needs.

I do agree with that. The upside is that any improvements to the
process will simplify this tool's implementation anyway (or at the
very least make certain parts less fragile).

@jordisayol
Copy link
Member

I'm unable to build 64-bit Linux on Debian.

[...]
create_dmd_release: Error: Directory not found: /tmp/.create_dmd_release/tools/generated/linux/64/

Until now the binaries contained on the zip release package Walter generates are compiled on an specific machine. So, to avoid mistakes and make it easier it can be a good idea to generate temp zip files containing only the binaries generated on every platform. After that, place all these temp zip files on a single directory and generate the final release zip file using them.

Another improvable point is to avoid to download all repositories every time we generate them in a new machine. Something like, if file "git-dmd-2.064.zip" is resent on current directory, use it, if not then download and generate this zip file, for the future buildings on other platforms.

@ghost ghost assigned MartinNowak Nov 3, 2013
@andralex
Copy link
Member

andralex commented Nov 3, 2013

Assigning this task to @dawgfoto.

@llucax
Copy link

llucax commented Nov 3, 2013

Could you also include a tar.gz version (and optionally .tar.bz2 too)? Linux distributions usually don't ship with 7z (yet). What you want from an installer is to make people's life easier, and require tools that are not installed everywhere just to save a few bytes seems counterproductive. I know zip works too in Linux, but it kind of sucks to use zip in Linux, the more natural option for Linux is tar.gz.

Thanks for addressing this!

@MartinNowak
Copy link
Member

I think that we need to replace the multi-platform dmd.zip with a platform specific binary release so that building can be fully automated.

@MartinNowak
Copy link
Member

Nick (@Abscissa), can we get this in shape as intermediate solution for the next few releases so that Andrew can take over release building?
I'll retest and post the outstanding issues this evening.

@Abscissa
Copy link
Contributor Author

Abscissa commented Dec 4, 2013

On 12/4/2013 3:43 AM, Martin Nowak wrote:

Nick (@Abscissa), can we get this in shape as intermediate solution for the next few releases so that Andrew can take over release building.

It might take me a little time to get to it, since I've just moved and
I'm still kinda swamped with stuff related to that, but yea, that sounds
good. I'll jump back in as soon as I have a chance.

@MartinNowak
Copy link
Member

I might just make a pull request for your branch.

@AndrewEdwards
Copy link
Contributor

Just wanted to check if there is any progress on this. I'm planning on producing the 2.065 betas on 17 Dec and this would help out tremendously.

@Abscissa
Copy link
Contributor Author

On 12/12/2013 8:28 AM, AndrewEdwards wrote:

Just wanted to check if there is any progress on this. I'm planning on producing the 2.065 betas on 17 Dec and this would help out tremendously.

I'm re-reading back through the comments/code refreshing my memory on
everything (sorry for my disappearance). Aside from the reports of it
failing on Linux64 (which is obviously a blocker), what other issues are
the most important to help you in the upcoming release?

- use std.zip for archiving and extracting
- rename --archive-zip option to --archive
  and --combine-zip to --combine
@AndrewEdwards
Copy link
Contributor

Not sure exactly. Maybe my setup is just not accurate. I was able to build on OSX without issues. Not so lucky on Ubuntu or Fedora. I did not try on Windows or FreeBSD yet.

On Fedora the following error occurs:

Building DMD 32-bit
make: g++: Command not found
make: *** [idgen] Error 127
create_dmd_release: Error: Command failed (ran from dir '/tmp/.create_dmd_release/dmd/src'): make MODEL=32 dmd -f posix.mak > /dev/null

Note that I have installed the gcc toolchain as required by the documentation. Even so, there is no g++ command on Fedora.

The error on Ubuntu reads:
Building Phobos 32-bit
The 'crc32' module has been scheduled for deprecation. Please use 'std.digest.crc' instead.
std.md5 is scheduled for deprecation. Please use std.digest.md instead
/usr/bin/ld: cannot find -lcurl
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
make[1]: *** [generated/linux/release/32/libphobos2.0.65.0] Error 1
make: *** [release] Error 2
create_dmd_release: Error: Command failed (ran from dir 'tmp/.create_dmd_release/phobos'): make MODEL=32 DMD=../dmd/src/dmd -f posix.mak > /dev/null

I've verified that libcurl (first libcurl4-openssl-dev, then libcurl4-gnutls-dev) is installed. However, this did not solve the problem.

Would be great if we could run from one OS and generate the binaries for all other OSes but alas that does not seem possible just yet.

@MartinNowak
Copy link
Member

make: g++: Command not found

On Fedora you need to install gcc-c++ to get a C++ compiler.

@AndrewEdwards
Copy link
Contributor

Got it. Thanks. In that case, the error is the same as with Ubuntu.

[andrew@tenken 065]$ sudo yum install libcurl
Loaded plugins: langpacks, refresh-packagekit
Package libcurl-7.29.0-12.fc19.x86_64 already installed and latest version
Nothing to do

Seems to be searching for a 32bit version of libcurl. Let me install that. Hmmm.... Everything seems to be working. 32 Bit build completed successfully. Now the 64bit version errors out with the same problems as before. That's annoying. Is there no way to install both 64 and 32 bit curl libraries on the same computer? Wait, that can't be the problem: "yum info libcurl" shows that both versions are installed.

@MartinNowak
Copy link
Member

What about libcurl-devel?

@AndrewEdwards
Copy link
Contributor

Ok. That works on Fedora. Not so lucky on Ubuntu.

@jordisayol
Copy link
Member

On Debian/Ubuntu is not possible to install 32 and 64 bit development curl library together due to dependencies, but no problem with run-time libcurl. @AndrewEdwards, can you try to remove any libcurl dev package, install 32 and 64 bit of libcurl3, and then link them with:
$ sudo ln -s libcurl.so.4 /usr/lib/i386-linux-gnu/libcurl.so
$ sudo ln -s libcurl.so.4 /usr/lib/x86_64-linux-gnu/libcurl.so

@MartinNowak
Copy link
Member

Ouch, I've resurrected dlang/phobos#1772 which makes this simpler.

@AndrewEdwards
Copy link
Contributor

Following errors encountered:

create_dmd_release.d(1526): Error: undefined identifier CompressionMethod
create_dmd_release.d(1527): Error: cannot implicitly convert expression (de.timeLastModified()) of type SysTime to uint
create_dmd_release.d(1530): Error: no property 'fileAttributes' for type 'std.zip.ArchiveMember'

@MartinNowak
Copy link
Member

create_dmd_release.d(1526): Error: undefined identifier CompressionMethod
create_dmd_release.d(1527): Error: cannot implicitly convert expression (de.timeLastModified()) of type SysTime to uint
create_dmd_release.d(1530): Error: no property 'fileAttributes' for type 'std.zip.ArchiveMember'

It requires the recent std.zip fixes, so either you can build the tool with a dmd/druntime/phobos from HEAD or 2.065 (which now contains the std.zip changes too).

MartinNowak added a commit that referenced this pull request Dec 21, 2013
@MartinNowak MartinNowak merged commit d072527 into dlang:master Dec 21, 2013
@MartinNowak
Copy link
Member

@rainers came up with the idea that we can use the old dmd.zip releases to fetch the external binary dependencies.
So this could be used as default if no --extra folder is given.

@MartinNowak
Copy link
Member

And we should use the ini files from the dmd repo.

@Abscissa
Copy link
Contributor Author

On 12/20/2013 7:16 PM, Martin Nowak wrote:

@rainers came up with the idea that we can use the old dmd.zip releases to fetch the external binary dependencies.
So this could be used as default if no --extra folder is given.

I specifically avoided making it do that to decrease the chance of
outdated versions of files being included by accident. The --extra stuff
is admittedly a pain, but my #1 motivation for this tool was to get rid
of all the user error (such as accidentally outdated files) that kept
creeping in with Walter's old packaging process (no offence, Walter! :) )

Besides, if anything, those files really should just be under version
control anyway. The only real reason I didn't just simply add them to
the pull request is because I wasn't sure whether there might be some
licensing issue preventing some of them from going in the VCS. If
someone can confirm that we're safe to add some/all into Git then we
should just do so.

@Abscissa
Copy link
Contributor Author

On 12/21/2013 12:34 AM, Martin Nowak wrote:

And we should use the ini files from the dmd repo.

Yea, definitely. The ini stuff wasn't in the repo at the time, so that's
why it's not using it, but I guess the ini's are in the repo now.

@MartinNowak
Copy link
Member

Would be great if we could run from one OS and generate the binaries for all other OSes but alas that does not seem possible just yet.

I started to build vagrant boxes that are prepared with a prebuild create_dmd_release executable.
If you call this script (with VirtualBox and vagrant installed), it will generate the dmd.${VERSION}.freebsd-32.zip and the dmd.${VERSION}.freebsd-64.zip files.

#!/bin/sh


set -e -o pipefail

# error function
ferror(){
    echo "==========================================================" >&2
    echo $1 >&2
    echo $2 >&2
    echo "==========================================================" >&2
    exit 1
}

# check if too many parameters
if test $# -ne 1 ;then
    ferror "Expected <git-branch-or-tag> as first argument, e.g. v2.064.2." "Exiting..."
fi

ROOT=${PWD}
TMPDIR=$(mktemp -d)
echo "using TMPDIR ${TMPDIR}"
cd ${TMPDIR}

VERSION=$1

for OS in freebsd; do
    for MODEL in 32 64; do
        cat > Vagrantfile <<EOF
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "create_dmd_release-${OS}-${MODEL}"
  config.vm.box_url = "http://dlang.dawg.eu/vagrant/create_dmd_release-${OS}-${MODEL}.box"
  # disable shared folders, because the guest additions are missing
  config.vm.synced_folder ".", "/vagrant", :disabled => true
end

EOF

        vagrant up
        vagrant ssh-config > ssh.cfg
        ssh -F ssh.cfg default ./create_dmd_release --extras=localextras-${OS} --archive --only-${MODEL} ${VERSION}
        scp -F ssh.cfg default:dmd.${VERSION}.${OS}-${MODEL}.zip ${ROOT}/
        vagrant destroy -f
    done
done

cd ${ROOT}
rm -rf ${TMPDIR}

MartinNowak added a commit that referenced this pull request Dec 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants