Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Binary Releases #6003

Merged
merged 4 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ if(ENABLE_COVERAGE_TESTING)
find_program( GENHTML_PATH NAMES genhtml)
endif()

include(utils)
add_subdirectory( externals )

if ("${CORE_SYMBOL_NAME}" STREQUAL "")
Expand All @@ -207,7 +208,6 @@ endif()
message( STATUS "Using '${EOSIO_ROOT_KEY}' as public key for 'eosio' account" )

include(wasm)

add_subdirectory( libraries )
add_subdirectory( contracts )
add_subdirectory( plugins )
Expand Down Expand Up @@ -240,6 +240,6 @@ install(FILES libraries/fc/secp256k1/upstream/COPYING DESTINATION ${CMAKE_INSTAL
install(FILES externals/binaryen/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.binaryen)
install(FILES libraries/fc/src/network/LICENSE.go DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ )

include(installer)

#include(installer)
include(package)
include(doxygen)
11 changes: 11 additions & 0 deletions CMakeModules/package.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(VENDOR "block.one")
set(PROJECT_NAME "eosio")
set(DESC "Software for the EOS.IO network")
set(URL "https://github.com/eosio/eos")
set(EMAIL "[email protected]")

configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_package.sh.in ${CMAKE_BINARY_DIR}/packages/generate_package.sh @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_bottle.sh ${CMAKE_BINARY_DIR}/packages/generate_bottle.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_deb.sh ${CMAKE_BINARY_DIR}/packages/generate_deb.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_rpm.sh ${CMAKE_BINARY_DIR}/packages/generate_rpm.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/scripts/generate_tarball.sh ${CMAKE_BINARY_DIR}/packages/generate_tarball.sh COPYONLY)
4 changes: 4 additions & 0 deletions CMakeModules/utils.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
macro( copy_bin file )
add_custom_command( TARGET ${file} POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
add_custom_command( TARGET ${file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${file} ${CMAKE_BINARY_DIR}/bin/ )
endmacro( copy_bin )
5 changes: 4 additions & 1 deletion plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,9 @@ read_only::get_account_results read_only::get_account( const get_account_params&

auto core_symbol = extract_core_symbol();

if (params.expected_core_symbol.valid())
core_symbol = *(params.expected_core_symbol);

const auto* t_id = d.find<chain::table_id_object, chain::by_code_scope_table>(boost::make_tuple( token_code, params.account_name, N(accounts) ));
if( t_id != nullptr ) {
const auto &idx = d.get_index<key_value_index, by_scope_primary>();
Expand Down Expand Up @@ -1783,7 +1786,7 @@ namespace detail {
}

chain::symbol read_only::extract_core_symbol()const {
symbol core_symbol; // Default to CORE_SYMBOL if the appropriate data structure cannot be found in the system contract table data
symbol core_symbol(0);

// The following code makes assumptions about the contract deployed on eosio account (i.e. the system contract) and how it stores its data.
const auto& d = db.db();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace eosio {
using fc::optional;
using boost::container::flat_set;
using chain::asset;
using chain::symbol;
using chain::authority;
using chain::account_name;
using chain::action_name;
Expand Down Expand Up @@ -137,7 +138,8 @@ class read_only {
};

struct get_account_params {
name account_name;
name account_name;
optional<symbol> expected_core_symbol;
};
get_account_results get_account( const get_account_params& params )const;

Expand Down Expand Up @@ -697,7 +699,7 @@ FC_REFLECT( eosio::chain_apis::read_only::get_account_results,
FC_REFLECT( eosio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) )
FC_REFLECT( eosio::chain_apis::read_only::get_code_hash_results, (account_name)(code_hash) )
FC_REFLECT( eosio::chain_apis::read_only::get_abi_results, (account_name)(abi) )
FC_REFLECT( eosio::chain_apis::read_only::get_account_params, (account_name) )
FC_REFLECT( eosio::chain_apis::read_only::get_account_params, (account_name)(expected_core_symbol) )
FC_REFLECT( eosio::chain_apis::read_only::get_code_params, (account_name)(code_as_wasm) )
FC_REFLECT( eosio::chain_apis::read_only::get_code_hash_params, (account_name) )
FC_REFLECT( eosio::chain_apis::read_only::get_abi_params, (account_name) )
Expand Down
2 changes: 2 additions & 0 deletions programs/cleos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ target_include_directories(${CLI_CLIENT_EXECUTABLE_NAME} PUBLIC ${Intl_INCLUDE_D

target_link_libraries( ${CLI_CLIENT_EXECUTABLE_NAME}
PRIVATE appbase chain_api_plugin producer_plugin chain_plugin http_plugin eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ${Intl_LIBRARIES} )


copy_bin( ${CLI_CLIENT_EXECUTABLE_NAME} )
install( TARGETS
${CLI_CLIENT_EXECUTABLE_NAME}

Expand Down
16 changes: 12 additions & 4 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,10 +1466,16 @@ struct canceldelay_subcommand {
}
};

void get_account( const string& accountName, bool json_format ) {
auto json = call(get_account_func, fc::mutable_variant_object("account_name", accountName));
auto res = json.as<eosio::chain_apis::read_only::get_account_results>();
void get_account( const string& accountName, const string& coresym, bool json_format ) {
fc::variant json;
if (coresym.empty()) {
json = call(get_account_func, fc::mutable_variant_object("account_name", accountName));
}
else {
json = call(get_account_func, fc::mutable_variant_object("account_name", accountName)("expected_core_symbol", symbol::from_string(coresym)));
}

auto res = json.as<eosio::chain_apis::read_only::get_account_results>();
if (!json_format) {
asset staked;
asset unstaking;
Expand Down Expand Up @@ -1912,11 +1918,13 @@ int main( int argc, char** argv ) {

// get account
string accountName;
string coresym;
bool print_json;
auto getAccount = get->add_subcommand("account", localized("Retrieve an account from the blockchain"), false);
getAccount->add_option("name", accountName, localized("The name of the account to retrieve"))->required();
getAccount->add_option("core-symbol", coresym, localized("The expected core symbol of the chain you are querying"));
getAccount->add_flag("--json,-j", print_json, localized("Output in JSON format") );
getAccount->set_callback([&]() { get_account(accountName, print_json); });
getAccount->set_callback([&]() { get_account(accountName, coresym, print_json); });

// get code
string codeFilename;
Expand Down
1 change: 1 addition & 0 deletions programs/keosd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target_include_directories(${KEY_STORE_EXECUTABLE_NAME} PUBLIC ${CMAKE_CURRENT_B

mas_sign(${KEY_STORE_EXECUTABLE_NAME})

copy_bin( ${KEY_STORE_EXECUTABLE_NAME} )
install( TARGETS
${KEY_STORE_EXECUTABLE_NAME}

Expand Down
1 change: 1 addition & 0 deletions programs/nodeos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ endif()

include(additionalPlugins)

copy_bin( ${NODE_EXECUTABLE_NAME} )
install( TARGETS
${NODE_EXECUTABLE_NAME}

Expand Down
67 changes: 67 additions & 0 deletions scripts/generate_bottle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#! /bin/bash

VERS=`sw_vers -productVersion | awk '/10\.13\..*/{print $0}'`
if [[ -z "$VERS" ]];
then
VERS=`sw_vers -productVersion | awk '/10\.14\..*/{print $0}'`
if [[ -z "$VERS" ]];
then
echo "Error, unsupported OS X version"
exit -1
fi
MAC_VERSION="mojave"
else
MAC_VERSION="high_sierra"
fi

NAME="${PROJECT}-${VERSION}.${MAC_VERSION}.bottle.tar.gz"

mkdir -p ${PROJECT}/${VERSION}/opt/eosio/lib/cmake

PREFIX="${PROJECT}/${VERSION}"
SPREFIX="\/usr\/local"
SUBPREFIX="opt/${PROJECT}"
SSUBPREFIX="opt\/${PROJECT}"

export PREFIX
export SPREFIX
export SUBPREFIX
export SSUBPREFIX

bash generate_tarball.sh ${NAME}

hash=`openssl dgst -sha256 ${NAME} | awk 'NF>1{print $NF}'`

echo "class Eosio < Formula

homepage \"${URL}\"
revision 0
url \"https://github.com/eosio/eos/archive/v${VERSION}.tar.gz\"
version \"${VERSION}\"

option :universal

depends_on \"cmake\" => :build
depends_on \"automake\" => :build
depends_on \"libtool\" => :build
depends_on \"wget\" => :build
depends_on \"gmp\" => :build
depends_on \"gettext\" => :build
depends_on \"doxygen\" => :build
depends_on \"graphviz\" => :build
depends_on \"lcov\" => :build
depends_on :xcode => :build
depends_on :macos => :high_sierra
depends_on :arch => :intel

bottle do
root_url \"https://github.com/eosio/eos/releases/download/v${VERSION}\"
sha256 \"${hash}\" => :${MAC_VERSION}
end
def install
raise \"Error, only supporting binary packages at this time\"
end
end
__END__" &> eosio.rb

rm -r ${PROJECT}
29 changes: 29 additions & 0 deletions scripts/generate_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash

NAME="${PROJECT}-${VERSION}.x86_64"
PREFIX="usr"
SPREFIX=${PREFIX}
SUBPREFIX="opt/${PROJECT}/${VERSION}"
SSUBPREFIX="opt\/${PROJECT}\/${VERSION}"

mkdir -p ${PROJECT}/DEBIAN
echo "Package: ${PROJECT}
Version: ${VERSION}
Section: devel
Priority: optional
Architecture: amd64
Homepage: ${URL}
Maintainer: ${EMAIL}
Description: ${DESC}" &> ${PROJECT}/DEBIAN/control

export PREFIX
export SUBPREFIX
export SPREFIX
export SSUBPREFIX

bash generate_tarball.sh ${NAME}.tar.gz

tar -xvzf ${NAME}.tar.gz -C ${PROJECT}
dpkg-deb --build ${PROJECT}
mv ${PROJECT}.deb ${NAME}.deb
rm -r ${PROJECT}
35 changes: 35 additions & 0 deletions scripts/generate_package.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /bin/bash

VARIANT=$1

VERSION="@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"

BUILD_DIR="@CMAKE_BINARY_DIR@"

VENDOR="@VENDOR@"
PROJECT="@PROJECT_NAME@"
DESC="@DESC@"
URL="@URL@"
EMAIL="@EMAIL@"

export BUILD_DIR
export VERSION
export VENDOR
export PROJECT
export DESC
export URL
export EMAIL

mkdir tmp

if [[ ${VARIANT} == "brew" ]]; then
bash generate_bottle.sh
elif [[ ${VARIANT} == "deb" ]]; then
bash generate_deb.sh
elif [[ ${VARIANT} == "rpm" ]]; then
bash generate_rpm.sh
else
echo "Error, unknown package type. Use either ['brew', 'deb', 'rpm']."
exit -1
fi
rm -r tmp
43 changes: 43 additions & 0 deletions scripts/generate_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /bin/bash

NAME="${PROJECT}-${VERSION}.x86_64"
PREFIX="usr"
SPREFIX=${PREFIX}
SUBPREFIX="opt/${PROJECT}/${VERSION}"
SSUBPREFIX="opt\/${PROJECT}\/${VERSION}"

export PREFIX
export SUBPREFIX
export SPREFIX
export SSUBPREFIX

bash generate_tarball.sh ${NAME}.tar.gz

RPMBUILD=`realpath ~/rpmbuild/BUILDROOT/${NAME}-0.x86_64`
mkdir -p ${RPMBUILD}
FILES=$(tar -xvzf ${NAME}.tar.gz -C ${RPMBUILD})
PFILES=""
for f in ${FILES[@]}; do
if [ -f ${RPMBUILD}/${f} ]; then
PFILES="${PFILES}/${f}\n"
fi
done
echo -e ${PFILES} &> ~/rpmbuild/BUILD/filenames.txt

mkdir -p ${PROJECT}
echo -e "Name: ${PROJECT}
Version: ${VERSION}.x86_64
License: MIT
Vendor: ${VENDOR}
Source: ${URL}
URL: ${URL}
Packager: ${VENDOR} <${EMAIL}>
Summary: ${DESC}
Release: 0
%description
${DESC}
%files -f filenames.txt" &> ${PROJECT}.spec

rpmbuild -bb ${PROJECT}.spec
mv ~/rpmbuild/RPMS/x86_64 ./
rm -r ${PROJECT} ~/rpmbuild/BUILD/filenames.txt ${PROJECT}.spec
40 changes: 40 additions & 0 deletions scripts/generate_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash

NAME=$1
EOS_PREFIX=${PREFIX}/${SUBPREFIX}
mkdir -p ${PREFIX}/bin/
#mkdir -p ${PREFIX}/lib/cmake/${PROJECT}
mkdir -p ${EOS_PREFIX}/bin
#mkdir -p ${EOS_PREFIX}/include
#mkdir -p ${EOS_PREFIX}/lib/cmake/${PROJECT}
#mkdir -p ${EOS_PREFIX}/cmake
#mkdir -p ${EOS_PREFIX}/scripts

# install binaries
cp -R ${BUILD_DIR}/bin/* ${EOS_PREFIX}/bin

# install libraries
#cp -R ${BUILD_DIR}/lib/* ${EOS_PREFIX}/lib

# install cmake modules
#sed "s/_PREFIX_/\/${SPREFIX}/g" ${BUILD_DIR}/modules/EosioTesterPackage.cmake &> ${EOS_PREFIX}/lib/cmake/${PROJECT}/EosioTester.cmake
#sed "s/_PREFIX_/\/${SPREFIX}\/${SSUBPREFIX}/g" ${BUILD_DIR}/modules/${PROJECT}-config.cmake.package &> ${EOS_PREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake

# install includes
#cp -R ${BUILD_DIR}/include/* ${EOS_PREFIX}/include

# make symlinks
#pushd ${PREFIX}/lib/cmake/${PROJECT} &> /dev/null
#ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake ${PROJECT}-config.cmake
#ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/EosioTester.cmake EosioTester.cmake
Copy link
Contributor

Choose a reason for hiding this comment

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

All these commented out lines in this file. Is it supposed to be that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, when we create full binary releases with libeosio and tester hopefully all that needs to be done in the generator scripts is uncomment these lines.

#popd &> /dev/null

pushd ${PREFIX}/bin &> /dev/null
for f in `ls ${BUILD_DIR}/bin/`; do
bn=$(basename $f)
ln -sf ../${SUBPREFIX}/bin/$bn $bn
done
popd &> /dev/null

tar -cvzf $NAME ./${PREFIX}/*
rm -r ${PREFIX}