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

Deprecate "mason link" command #377

Closed
springmeyer opened this issue Mar 7, 2017 · 2 comments
Closed

Deprecate "mason link" command #377

springmeyer opened this issue Mar 7, 2017 · 2 comments

Comments

@springmeyer
Copy link
Contributor

springmeyer commented Mar 7, 2017

The mason link command collapses all linked packages into an unversioned directory structure. This was inspired by the hombrew link command and is useful if you want to install lots of dependencies with mason and point to a single, predictable, location for their headers and libs.

However, per chat with @kkaefer we want to move to a future where all apps using mason for deps consistently use the mason client (either mason.cmake or mason bash client) to fetch versioned paths. Removing mason link will remove surface area to maintain and limit the amount of ways downstream apps use mason. By using the mason client we can help downstream apps using mason packages without suffering through difficultings of using existing *-config tools that likely will not work with the relative structure of mason packages, like pkg-config, freetype-config, or gdal-config. For example code like

function relativize_gdal_config() {
path_to_gdal_config=${1}
prefix_path=${2}
build_path=${3}
RESOLVE_SYMLINK="readlink"
if [[ $(uname -s) == 'Linux' ]];then
RESOLVE_SYMLINK="readlink -f"
fi
mv ${path_to_gdal_config} /tmp/gdal-config-backup
# append code at start
echo 'if test -L $0; then BASE=$( dirname $( '${RESOLVE_SYMLINK}' "$0" ) ); else BASE=$( dirname "$0" ); fi' > ${path_to_gdal_config}
cat /tmp/gdal-config-backup >> ${path_to_gdal_config}
chmod +x ${path_to_gdal_config}
# now modify in place
python -c "data=open('${path_to_gdal_config}','r').read();open('${path_to_gdal_config}','w').write(data.replace('${prefix_path}','\$( cd \"\$( dirname \${BASE} )\" && pwd )'))"
# fix the path to dep libs (CONFIG_DEP_LIBS)
python -c "data=open('${path_to_gdal_config}','r').read();open('${path_to_gdal_config}','w').write(data.replace('${build_path}','\$( cd \"\$( dirname \$( dirname \$( dirname \${BASE} ) ))\" && pwd )'))"
# hack to re-add -lpq since otherwise it will not end up in --dep-libs
python -c "data=open('${path_to_gdal_config}','r').read();open('${path_to_gdal_config}','w').write(data.replace('\$CONFIG_DEP_LIBS','\$CONFIG_DEP_LIBS -lpq'))"
}
could be avoided if we started to make no promise that gdal-config works in mason packages (or even removed packaging it) because we only support downstream apps using the mason client to get include and lib paths.

Note: there are a lot of uses of mason link, so only proposing deprecating and not removing. I imagine I'll need several months at least to migrate all usage off mason link in external repos like

$ grep 'mason link' scripts/ -r
scripts//gdal/1.11.1-big-pants/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//gdal/2.0.2/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//gdal/dev/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//gdal/dev/script.sh:    ${MASON_DIR}/mason link $1 $2
scripts//geos/3.4.2/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//geos/3.5.0/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//geowave-jace/0.8.7/script.sh:    ${MASON_DIR}/mason link $1 $2
scripts//gflags/2.1.2/script.sh:    ${MASON_DIR}/mason link cmake 3.7.2
scripts//libosmium/2.6.1/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//libpng/1.6.25/script.sh:        ${MASON_DIR}/mason link zlib_shared ${ZLIB_SHARED_VERSION}
scripts//libpng/1.6.28/script.sh:        ${MASON_DIR}/mason link zlib_shared ${ZLIB_SHARED_VERSION}
scripts//mapnik/3.0.0/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//mapnik/3.0.0-rc2/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//mapnik/3.0.0-rc3/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//mapnik/dev/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//mapnik/geom/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//mapnik/latest/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link cmake 3.7.1
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link utfcpp 2.3.4
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link protozero 1.5.1
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link rapidjson 2016-07-20-369de87
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link libosmium 2.11.0
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link boost 1.63.0
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link expat 2.2.0
scripts//minjur/0.1.0/script.sh:    ${MASON_DIR}/mason link bzip2 1.0.6
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link boost 1.57.0
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options 1.57.0
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link expat 2.1.0
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link osmpbf 1.3.3
scripts//minjur/a2c9dc871369432c7978718834dac487c0591bd6/script.sh:    ${MASON_DIR}/mason link bzip 1.0.6
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link boost 1.57.0
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options 1.57.0
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link expat 2.1.0
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link osmpbf 1.3.3
scripts//minjur/feac70472f46c3145b6bdf7a02fdc37777828318/script.sh:    ${MASON_DIR}/mason link bzip 1.0.6
scripts//osm2pgsql/0.87.2/script.sh:    ${MASON_DIR}/mason link boost_libsystem 1.57.0
scripts//osm2pgsql/0.87.2/script.sh:    ${MASON_DIR}/mason link boost_libthread 1.57.0
scripts//osm2pgsql/0.87.2/script.sh:    ${MASON_DIR}/mason link boost_libfilesystem 1.57.0
scripts//osm2pgsql/0.88.1/script.sh:    ${MASON_DIR}/mason link boost_libsystem 1.57.0
scripts//osm2pgsql/0.88.1/script.sh:    ${MASON_DIR}/mason link boost_libthread 1.57.0
scripts//osm2pgsql/0.88.1/script.sh:    ${MASON_DIR}/mason link boost_libfilesystem 1.57.0
scripts//osm2pgsql/0.88.1/script.sh:    ${MASON_DIR}/mason link libxml2 2.9.2
scripts//osm2pgsql/0.88.1/script.sh:    ${MASON_DIR}/mason link geos 3.4.2
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link boost 1.57.0
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options 1.57.0
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link expat 2.1.0
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link osmpbf 1.3.3
scripts//osmium-tool/1.0.0/script.sh:    ${MASON_DIR}/mason link bzip 1.0.6
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link boost 1.57.0
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options 1.57.0
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link expat 2.1.0
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link osmpbf 1.3.3
scripts//osmium-tool/1.3.0/script.sh:    ${MASON_DIR}/mason link bzip 1.0.6
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link boost ${BOOST_VERSION}
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options ${BOOST_VERSION}
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link libosmium 2.8.0
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link protozero 1.4.0
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link utfcpp 2.3.4
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link expat 2.1.0
scripts//osmium-tool/1.3.1/script.sh:    ${MASON_DIR}/mason link bzip2 1.0.6
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link cmake 3.7.1
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link utfcpp 2.3.4
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link protozero 1.5.1
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link rapidjson 2016-07-20-369de87
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link libosmium 2.11.0
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link boost ${BOOST_VERSION}
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link boost_libprogram_options ${BOOST_VERSION}
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link zlib 1.2.8
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link expat 2.2.0
scripts//osmium-tool/1.5.1/script.sh:    ${MASON_DIR}/mason link bzip2 1.0.6
scripts//osmpbf/1.3.3/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//osrm/0.4.1/script.sh:    ${MASON_DIR}/mason link $1 $2
scripts//protozero/1.3.0/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//protozero/1.4.0/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//protozero/1.4.2/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//stxxl_shared/1.4.1/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//tippecanoe/1.15.1/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//tippecanoe/1.9.7/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
scripts//tippecanoe/1.9.7/script.sh:    ${MASON_DIR}/mason link protobuf 2.6.1
scripts//tippecanoe/1.9.7/script.sh:    ${MASON_DIR}/mason link sqlite 3.9.1
scripts//zlib/system/.travis.yml:- ./mason link ${MASON_NAME} ${MASON_VERSION}
@springmeyer
Copy link
Contributor Author

/cc @kkaefer I've been looking at various mason link usage. It is widespread for a reason: it is useful to collapse down paths to predicable places. This helps enormously with node-gyp binding.gyp situations. I'm no longer thinking it is feasible to deprecate this and I'm going to close this issue and plan to keep supporting link. If people have feedback about the design of it, feel free to open new issues.

@kkaefer
Copy link
Member

kkaefer commented Mar 16, 2017

This helps enormously with node-gyp binding.gyp situations.

Can you please describe how it helps there? Instead of providing the one .link directory, can we just supply paths to all individual directories (that's how we did it in Mapbox GL Native when we were using gyp). The massive flaw of link is still that it completely breaks any setups that use more than one architecture (cross-compiling), and that it breaks setups that upgrade dependencies.

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

No branches or pull requests

2 participants