crystal-lang / distribution-scripts

40 stars 24 forks source link

Missing VERSION file in Debian and Arch packages #35

Closed olbat closed 5 years ago

olbat commented 5 years ago

The VERSION file that is used by compiler/crystal/config.cr is missing from both Debian and Archlinux packaging.

This leads to errors when using the Crystal::Config package.

To reproduce (full log):

$ docker run --rm crystallang/crystal:0.28.0 sh -c 'apt-get update && apt-get install -y llvm-dev && crystal eval '"'"'require "compiler/crystal/**"; puts Crystal::Config.default_config'"'"''
...
in usr/share/crystal/src/compiler/crystal/config.cr:11: error executing command: cat /usr/share/crystal/src/compiler/crystal/../../../VERSION, got exit status 1

        {{ `cat #{__DIR__}/../../../VERSION`.stringify.chomp }}

There is no more issue when creating the missing VERSION file on the two distributions. However, for Archlinux, this file is located at /usr/lib/VERSION which might be problematic :-)

I'm not really sure if this is a packaging or code issue. Please just let me know if I should open an issue in the core's repo.

More info about the packages:

Debian

$ pacman -Ql crystal | grep -q VERSION && echo OK || echo KO
KO

$  pacman -Qi crystal
Name            : crystal
Version         : 0.28.0-1
Description     : The Crystal Programming Language
Architecture    : x86_64
URL             : http://crystal-lang.org
Licenses        : Apache
Groups          : None
Provides        : None
Depends On      : gc  libatomic_ops  pcre  libevent  llvm6-libs
Optional Deps   : shards: crystal language package manager [installed]
                  libyaml: For YAML support [installed]
                  gmp: For BigInt support [installed]
                  libxml2: For XML support [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 95.62 MiB
Packager        : Anatol Pomozov <anatol.pomozov@gmail.com>
Build Date      : Wed 17 Apr 2019 07:41:48 PM CEST
Install Date    : Sun 28 Apr 2019 08:04:36 PM CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Archlinux

$ dpkg -L crystal | grep -q VERSION && echo OK || echo KO
KO

$ apt-cache show crystal
Package: crystal
Status: install ok installed
Priority: extra
Section: default
Installed-Size: 88303
Maintainer: Crystal Team <crystal@manas.tech>
Architecture: amd64
Version: 0.28.0-1
Depends: gcc, pkg-config, libpcre3-dev, libevent-dev
Recommends: git, libssl-dev, libz-dev
Suggests: libxml2-dev, libgmp-dev, libyaml-dev, libreadline-dev
Description: no description given
Description-md5: c0af8b65ef8df63b3bfb124d96da1778
License: APACHE-2.0
Vendor: Crystal Team <crystal@manas.tech>
Homepage: https://crystal-lang.org/

(I only tested with Crystal 0.28.0 on Debian Buster and an up to date Archlinux)

bew commented 5 years ago

I reported this on the compiler some time ago: https://github.com/crystal-lang/crystal/issues/7602 Not sure how to fix that though

olbat commented 5 years ago

You're right, I think this is the same issue. Seems that I missed it :-s Apparently it was affecting Crystal 0.27.2 as well...

Not sure how to fix that though

Same thing for me, I don't really know what would be the best way to fix it.

Packaging can be fixed, however I find the way it's done ATM is a bit weird. I mean having some piece of code in the source making a relative reference to something outside of the source path.

Having the VERSION file in the src/ directory does not seems OK either and having a version.cr class/module has a lot of drawbacks...