This commit is contained in:
pmitchev
2018-01-11 09:34:40 +02:00
parent b56325ab99
commit d355df4bb6
14 changed files with 1277 additions and 62 deletions
+1 -43
View File
@@ -42,53 +42,11 @@ fi
# Move and zip binaries
if [[ $archive == "1" ]]; then
BUILD_PATH="${WORK_FOLDERS_PATH}/builds"
MAC_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-mac"
LINUX_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-linux"
WINDOWS_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-windows"
ALL_BUILD_FILES="${__CONFIG_core_CRYPTONOTE_NAME}-all-files"
case "$OSTYPE" in
msys*) rm -f ${BUILD_PATH}/${WINDOWS_BUILD_NAME}.zip
rm -rf ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monerod.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monero-wallet-cli.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
if [[ " ${__CONFIG_extensions_text} " == *"multiply.json"* ]]; then
rm -rf ${BUILD_PATH}/${WINDOWS_BUILD_NAME}/configs/.git
rm -rf ${BUILD_PATH}/${WINDOWS_BUILD_NAME}/configs/.gitignore
fi
cd ${BUILD_PATH}
zip -r ${WINDOWS_BUILD_NAME}.zip ${WINDOWS_BUILD_NAME}/
;;
darwin*) rm -f ${BUILD_PATH}/${MAC_BUILD_NAME}.zip
rm -rf ${BUILD_PATH}/${MAC_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monerod ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monero-wallet-cli ${BUILD_PATH}/${MAC_BUILD_NAME}
if [[ " ${__CONFIG_extensions_text} " == *"multiply.json"* ]]; then
rm -rf ${BUILD_PATH}/${MAC_BUILD_NAME}/configs/.git
rm -rf ${BUILD_PATH}/${MAC_BUILD_NAME}/configs/.gitignore
fi
cd ${BUILD_PATH}
zip -r ${MAC_BUILD_NAME}.zip ${MAC_BUILD_NAME}/
;;
*) rm -f ${BUILD_PATH}/${LINUX_BUILD_NAME}.tar.gz
rm -rf ${BUILD_PATH}/${LINUX_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monerod ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/bin/monero-wallet-cli ${BUILD_PATH}/${LINUX_BUILD_NAME}
if [[ " ${__CONFIG_extensions_text} " == *"multiply.json"* ]]; then
rm -rf ${BUILD_PATH}/${LINUX_BUILD_NAME}/configs/.git
rm -rf ${BUILD_PATH}/${LINUX_BUILD_NAME}/configs/.gitignore
fi
cd ${BUILD_PATH}
tar -zcvf ${LINUX_BUILD_NAME}.tar.gz ${LINUX_BUILD_NAME}
;;
esac
rm -rf ${BUILD_PATH}/${ALL_BUILD_FILES}
mkdir -p ${BUILD_PATH}/${ALL_BUILD_FILES}
cp -R ${NEW_COIN_PATH}/build/release/src/ ${BUILD_PATH}/${ALL_BUILD_FILES}/
cp -R ${NEW_COIN_PATH}/build/release/bin/ ${BUILD_PATH}/${ALL_BUILD_FILES}/
if [[ " ${__CONFIG_extensions_text} " == *"multiply.json"* ]]; then
git clone https://github.com/forknote/configs.git ${BUILD_PATH}/${ALL_BUILD_FILES}/configs
rm -rf ${BUILD_PATH}/${ALL_BUILD_FILES}/configs/.git
+51
View File
@@ -0,0 +1,51 @@
{
"extensions": [
"core/monero.json",
"donations.json",
"aeon.json"
],
"base_coin": {
"name": "monero",
"git": "https://github.com/monero-project/monero.git"
},
"core": {
"COIN_NAME": "Aeon",
"CRYPTONOTE_NAME": "aeon",
"CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX": 178,
"CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX": 179,
"CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX": 42,
"MAINNET_P2P_DEFAULT_PORT": 11180,
"MAINNET_RPC_DEFAULT_PORT": 11181,
"MAINNET_ZMQ_RPC_DEFAULT_PORT": 11182,
"TESTNET_P2P_DEFAULT_PORT": 22280,
"TESTNET_RPC_DEFAULT_PORT": 22281,
"TESTNET_ZMQ_RPC_DEFAULT_PORT": 22282,
"MAINNET_SEED_NODES":"full_addrs.insert(\"74.91.23.186:11180\");\nfull_addrs.insert(\"192.187.114.114:11180\");\nfull_addrs.insert(\"34.200.218.170:11180\");\nfull_addrs.insert(\"144.76.104.208:11180\");\n",
"MAINET_CHECKPOINTS":" ADD_CHECKPOINT(1, \"1440a20f078bf3264822234b347f8382606577d73d4e9d3cb7296d73889bc421\");\n ADD_CHECKPOINT(100, \"6dd13aaab16679f49ee6b2b75c7dc99b1fd09ab2282b18cb4b55b73110655742\");\n ADD_CHECKPOINT(1000, \"bc6458452fd0575a314089bf302f6fd68ebaa2d689c42f3365293b96bbdf1f25\");\n ADD_CHECKPOINT(10000, \"1ac1ebd25baf0d6ec593daa3389f1aa7e860ff2cc29f3cf1be586d245b379da4\");\n ADD_CHECKPOINT(15000, \"15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87\");\n ADD_CHECKPOINT(175500, \"3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35\");\n ADD_CHECKPOINT(450000, \"f69a6e57c4dd5df2f492c9d31c50f11aad2c25a64d540ce5f5d11b572aec8ab7\");\n ADD_CHECKPOINT(540000, \"94e19cf9d5a16ae90f67c321f8376b87da21d6d6c2cb0957b9ab558dca66c1dc\");\n ADD_CHECKPOINT(592001, \"e8bc936b287a9c426a15cf127624b064c88e6d37655cc87f9a62cf1623c62385\");\n ADD_CHECKPOINT(798358, \"804c7fe07511d9387e7cda534c9e8b644d406d8d0ff299799a8177850d4e75a0\");\n ADD_CHECKPOINT(871000, \"99f7e5460da3fb4e2b15214017b0a17ff0294823ad852259ff837f0ffeeb90f0\");\n",
"MAINNET_HARDFORKS":"{ 1, 1, 0, 1341378000 }",
"MAINNET_HARDFORK_V1_LAST_BLOCK":18446744073709551615,
"MAINNET_HARDFORK_V1HF":592000,
"P2P_STAT_TRUSTED_PUB_KEY": "",
"MAINNET_GENESIS_TX": "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121012bf2d282da90cee9c7a28c16e81418101ee28607d9e50f706594ee144a453b68",
"TESTNET_GENESIS_TX": "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017c18fb180e05e89625b8324cd22ceeb3d4925ebaa5c274c9e927b2cf5669ffd6",
"MAINNET_NETWORK_ID": "0x32 ,0x32, 0xF3, 0x91 , 0x81, 0x18 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10",
"TESTNET_NETWORK_ID": "0x32 ,0x32, 0xF3, 0x91 , 0x81, 0x18 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x11",
"MONEY_SUPPLY": 18446744073709551615,
"FINAL_SUBSIDY_PER_MINUTE": 0,
"DEFAULT_FEE": 10000000000,
"EMISSION_SPEED_FACTOR_PER_MINUTE_V1": 20,
"EMISSION_SPEED_FACTOR_PER_MINUTE_V1HF":18,
"DIFFICULTY_WINDOW_V1": 720,
"DIFFICULTY_WINDOW_V1HF": 360,
"DIFFICULTY_WINDOW_V2": 360,
"DIFFICULTY_TARGET_V1": 60,
"DIFFICULTY_TARGET_V1HF": 240,
"DIFFICULTY_TARGET_V2": 240,
"POW_SPEED_MULTIPLIER_V1HF": 2,
"MEMORY_MULTIPLIER_V1HF": 0.5,
"CONFIG_DONATION_ADDRESS": "WmsSWgtT1JPg5e3cK41hKXSHVpKW7e47bjgiKmWZkYrhSS5LhRemNyqayaSBtAQ6517eo5PtH9wxHVmM78JDZSUu2W8PqRiNs"
}
}
+473
View File
@@ -0,0 +1,473 @@
{
"file": "aeon.json",
"description": "Changes for aeon",
"required": [
"core/monero.json"
],
"files": [
{
"path": "/src/cryptonote_config.h",
"changes": [
{
"action": "add_below",
"marker": "#define DIFFICULTY_TARGET_V1",
"parameters": {
"text": [
"#define DIFFICULTY_TARGET_V1HF %s"
],
"replace_text_alt": [
"#define DIFFICULTY_TARGET_V1HF DIFFICULTY_TARGET_V1"
],
"var": "DIFFICULTY_TARGET_V1HF"
}
},
{
"action": "add_below",
"marker": "#define DIFFICULTY_WINDOW 720",
"parameters": {
"text": [
"#define DIFFICULTY_WINDOW_V1HF %s"
],
"replace_text_alt": [
"#define DIFFICULTY_WINDOW_V1HF DIFFICULTY_WINDOW"
],
"var": "DIFFICULTY_WINDOW_V1HF"
}
},
{
"action": "add_below",
"marker": "#define EMISSION_SPEED_FACTOR_PER_MINUTE (20)",
"parameters": {
"text": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V1HF (%s)"
],
"replace_text_alt": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V1HF EMISSION_SPEED_FACTOR_PER_MINUTE"
],
"var": "EMISSION_SPEED_FACTOR_PER_MINUTE_V1HF"
}
},
{
"action": "add_below",
"marker": "#define DIFFICULTY_CUT 60",
"parameters": {
"text": [
"#define MAINNET_HARDFORK_V1HF %s"
],
"replace_text_alt": [
"#define MAINNET_HARDFORK_V1HF 18446744073709551615"
],
"var": "MAINNET_HARDFORK_V1HF"
}
},
{
"action": "add_below",
"marker": "#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG",
"parameters": {
"text": [
"#define POW_SPEED_MULTIPLIER_V1HF %s"
],
"var": "POW_SPEED_MULTIPLIER_V1HF"
}
},
{
"action": "add_below",
"marker": "#define HASH_OF_HASHES_STEP 256",
"parameters": {
"text": [
"#define MEMORY_MULTIPLIER_V1HF %s"
],
"replace_text_alt": [
"#define MEMORY_MULTIPLIER_V1HF 1"
],
"var": "MEMORY_MULTIPLIER_V1HF"
}
}
]
},
{
"path": "/src/crypto/slow-hash.c",
"changes": [
{
"action": "replace",
"marker": "#define state_index(x) (((*((uint64_t *)x) >> 4) & (TOTALBLOCKS - 1)) << 4)",
"parameters": {
"text": [
"#define state_index(x,mul) (((*((uint64_t *)x) >> 4) & ((int)(TOTALBLOCKS*(mul)) - 1)) << 4)"
]
}
},
{
"action": "replace",
"marker": "j = state_index(a); \\",
"parameters": {
"text": [
" j = state_index(a, memory_multiplier); \\"
]
}
},
{
"action": "replace",
"marker": "j = state_index(c); \\",
"parameters": {
"text": [
" j = state_index(c, memory_multiplier); \\"
]
}
},
{
"action": "replace",
"marker": "for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)",
"parameters": {
"text": [
" for(i = 0; i < (MEMORY * memory_multiplier) / INIT_SIZE_BYTE; i++)"
]
}
},
{
"action": "replace",
"marker": "for(i = 0; i < ITER / 2; i++)",
"parameters": {
"text": [
" for(i = 0; i < (ITER * memory_multiplier) / 2; i++)"
]
}
},
{
"action": "replace",
"marker": "void cn_slow_hash(const void *data, size_t length, char *hash) {",
"parameters": {
"text": [
"void cn_slow_hash(const void *data, size_t length, char *hash) {",
" cn_slow_hash_with_multiplier(data, length, hash, 1);",
"}",
"",
"void cn_slow_hash_with_multiplier(const void *data, size_t length, char *hash, double memory_multiplier) {"
]
}
},
{
"action": "replace",
"marker": "void cn_slow_hash(const void *data, size_t length, char *hash)",
"parameters": {
"text": [
"void cn_slow_hash(const void *data, size_t length, char *hash)",
"{",
" cn_slow_hash_with_multiplier(data, length, hash, 1);",
"}",
"",
"void cn_slow_hash_with_multiplier(const void *data, size_t length, char *hash, double memory_multiplier)"
]
}
},
{
"action": "replace",
"marker": "for (i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) {",
"parameters": {
"text": [
" for (i = 0; i < (MEMORY * memory_multiplier) / INIT_SIZE_BYTE; i++) {"
]
}
},
{
"action": "replace",
"marker": "for (i = 0; i < ITER / 2; i++) {",
"parameters": {
"text": [
" for (i = 0; i < (ITER * memory_multiplier) / 2; i++) {"
]
}
},
{
"action": "replace",
"marker": "j = e2i(a, MEMORY / AES_BLOCK_SIZE);",
"parameters": {
"text": [
" j = e2i(a, (MEMORY * memory_multiplier) / AES_BLOCK_SIZE);"
]
}
},
{
"action": "replace",
"marker": "assert(j == e2i(a, MEMORY / AES_BLOCK_SIZE));",
"parameters": {
"text": [
" assert(j == e2i(a, (MEMORY * memory_multiplier) / AES_BLOCK_SIZE));"
]
}
}
]
},
{
"path": "/src/crypto/hash-ops.h",
"changes": [
{
"action": "add_below",
"marker": "void cn_slow_hash(const void *data, size_t length, char *hash);",
"parameters": {
"text": [
"void cn_slow_hash_with_multiplier(const void *data, size_t length, char *hash, double memory_multiplier);" ]
}
}
]
},
{
"path": "/src/crypto/hash.h",
"changes": [
{
"action": "add_above",
"marker": "inline void cn_slow_hash(const void *data, std::size_t length, hash &hash) {",
"parameters": {
"text": [
"inline void cn_slow_hash_with_multiplier(const void *data, std::size_t length, hash &hash, double memory_multiplier) {",
" cn_slow_hash_with_multiplier(data, length, reinterpret_cast<char *>(&hash), memory_multiplier);",
"}",
""
]
}
}
]
},
{
"path": "/src/cryptonote_basic/cryptonote_basic_impl.h",
"changes": [
{
"action": "add_below",
"marker": "bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint8_t version);",
"parameters": {
"text": [
" bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint8_t version, size_t height);"
]
}
}
]
},
{
"path": "/src/cryptonote_basic/cryptonote_basic_impl.cpp",
"changes": [
{
"action": "replace",
"marker": "const int emission_speed_factor = EMISSION_SPEED_FACTOR_PER_MINUTE - (target_minutes-1);",
"parameters": {
"text": [
"int emission_speed_factor = EMISSION_SPEED_FACTOR_PER_MINUTE - (target_minutes-1);",
"emission_speed_factor = height < MAINNET_HARDFORK_V1HF ? EMISSION_SPEED_FACTOR_PER_MINUTE - (target_minutes-1) : EMISSION_SPEED_FACTOR_PER_MINUTE_V1HF - (target_minutes-1);"
]
}
},
{
"action": "replace",
"marker": "bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint8_t version) {",
"parameters": {
"text": [
"bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint8_t version) {",
" get_block_reward(median_size, current_block_size, already_generated_coins, reward, version, 0);",
"}",
"",
"bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint8_t version, size_t height) {"
]
}
}
]
},
{
"path": "/src/cryptonote_core/blockchain.cpp",
"changes": [
{
"action": "replace",
"marker": "if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward, version))",
"parameters": {
"text": [
" if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward, version, m_db->height()))"
]
}
},
{
"action": "replace",
"marker": "if (!get_block_reward(median, 1, already_generated_coins, base_reward, version))",
"parameters": {
"text": [
" if (!get_block_reward(median, 1, already_generated_coins, base_reward, version, m_db->height()))"
]
}
},
{
"action": "replace",
"marker": "return next_difficulty(timestamps, difficulties, target);",
"parameters": {
"text": [
"return next_difficulty(timestamps, difficulties, target, m_db->height());"
]
}
},
{
"action": "replace",
"marker": "if (!m_tx_pool.fill_block_template(b, median_size, already_generated_coins, txs_size, fee, expected_reward, m_hardfork->get_current_version()))",
"parameters": {
"text": [
" if (!m_tx_pool.fill_block_template(b, median_size, already_generated_coins, txs_size, fee, expected_reward, m_hardfork->get_current_version(), height))"
]
}
},
{
"action": "replace",
"marker": "return get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;",
"parameters": {
"text": [
" uint64_t difficulty_target = DIFFICULTY_TARGET_V1;",
" if (m_db->height() >= MAINNET_HARDFORK_V1HF)",
" difficulty_target = DIFFICULTY_TARGET_V1HF;",
" if (get_current_hard_fork_version() >= 2)",
" difficulty_target = DIFFICULTY_TARGET_V2;",
"",
"return difficulty_target;"
]
}
}
]
},
{
"path": "/src/cryptonote_basic/cryptonote_format_utils.cpp",
"changes": [
{
"action": "replace",
"marker": "crypto::cn_slow_hash(bd.data(), bd.size(), res);",
"parameters": {
"text": [
" size_t memory_multiplier = 1;",
" if (height >= MAINNET_HARDFORK_V1HF)",
" memory_multiplier = MEMORY_MULTIPLIER_V1HF;",
" crypto::cn_slow_hash_with_multiplier(bd.data(), bd.size(), res, memory_multiplier);"
]
}
}
]
},
{
"path": "/src/cryptonote_core/cryptonote_tx_utils.cpp",
"changes": [
{
"action": "replace",
"marker": "if(!get_block_reward(median_size, current_block_size, already_generated_coins, block_reward, hard_fork_version))",
"parameters": {
"text": [
" if(!get_block_reward(median_size, current_block_size, already_generated_coins, block_reward, hard_fork_version, height))"
]
}
}
]
},
{
"path": "/src/cryptonote_core/tx_pool.h",
"changes": [
{
"action": "add_below",
"marker": "bool fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t &expected_reward, uint8_t version);",
"parameters": {
"text": [
" bool fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t &expected_reward, uint8_t version, size_t height);"
]
}
}
]
},
{
"path": "/src/cryptonote_core/tx_pool.cpp",
"changes": [
{
"action": "replace",
"marker": "bool tx_memory_pool::fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t &expected_reward, uint8_t version)",
"parameters": {
"text": [
" bool tx_memory_pool::fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t &expected_reward, uint8_t version)",
" {",
" fill_block_template(bl, median_size, already_generated_coins, total_size, fee, expected_reward, version, 0);",
" }",
" bool tx_memory_pool::fill_block_template(block &bl, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t &expected_reward, uint8_t version, size_t height)"
]
}
},
{
"action": "replace",
"marker": "get_block_reward(median_size, total_size, already_generated_coins, best_coinbase, version);",
"parameters": {
"text": [
" get_block_reward(median_size, total_size, already_generated_coins, best_coinbase, version, height);"
]
}
},
{
"action": "replace",
"marker": "if(!get_block_reward(median_size, total_size + meta.blob_size, already_generated_coins, block_reward, version))",
"parameters": {
"text": [
" if(!get_block_reward(median_size, total_size + meta.blob_size, already_generated_coins, block_reward, version, height))"
]
}
}
]
},
{
"path": "/src/cryptonote_basic/difficulty.h",
"changes": [
{
"action": "add_below",
"marker": "difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds);",
"parameters": {
"text": [
" difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds, uint64_t height);"
]
}
}
]
},
{
"path": "/src/cryptonote_basic/difficulty.cpp",
"changes": [
{
"action": "replace",
"marker": "difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds) {",
"parameters": {
"text": [
"",
" difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds) {",
" next_difficulty(timestamps, cumulative_difficulties, target_seconds, 0);",
" }",
"",
" difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds, uint64_t height) {"
]
}
},
{
"action": "replace",
"marker": "return (low + time_span - 1) / time_span;",
"parameters": {
"text": [
"",
" difficulty_type new_diff = (low + time_span - 1) / time_span;",
"",
" if (height >= MAINNET_HARDFORK_V1HF && height < MAINNET_HARDFORK_V1HF+DIFFICULTY_WINDOW_V1HF) {",
" new_diff += new_diff*(MAINNET_HARDFORK_V1HF+DIFFICULTY_WINDOW_V1HF-height)*(POW_SPEED_MULTIPLIER_V1HF-1)/DIFFICULTY_WINDOW_V1HF;",
" }",
"",
" return new_diff;"
]
}
}
]
},
{
"path": "/src/blocks/blocks.dat",
"action": "add",
"source": "/aeon/files/blocks.dat"
}
]
}
Binary file not shown.
+10 -10
View File
@@ -9,7 +9,7 @@
"path": "/src/blockchain_db/blockchain_db.h",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "virtual uint64_t get_block_already_generated_coins(const uint64_t& height) const = 0;",
"parameters": {
"text": [
@@ -23,7 +23,7 @@
"path": "/src/blockchain_db/lmdb/db_lmdb.h",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "virtual uint64_t get_block_already_generated_coins(const uint64_t& height) const;",
"parameters": {
"text": [
@@ -37,7 +37,7 @@
"path": "/src/blockchain_db/lmdb/db_lmdb.cpp",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "uint64_t bi_coins;",
"parameters": {
"text": [
@@ -46,7 +46,7 @@
}
},
{
"action": "add_bellow",
"action": "add_below",
"marker": "bi.bi_coins = coins_generated;",
"parameters": {
"text": [
@@ -91,7 +91,7 @@
"path": "/src/cryptonote_core/blockchain.h",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "Blockchain(tx_memory_pool& tx_pool);",
"parameters": {
"text": [
@@ -106,7 +106,7 @@
"path": "/src/cryptonote_core/blockchain.cpp",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "static const uint64_t testnet_hard_fork_version_1_till = 624633;",
"parameters": {
"text": [
@@ -147,7 +147,7 @@
"path": "/src/rpc/core_rpc_server.h",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "MAP_JON_RPC_WE(\"get_version\", on_get_version, COMMAND_RPC_GET_VERSION)",
"parameters": {
"text": [
@@ -730,7 +730,7 @@
"path": "/tests/unit_tests/blockchain_db.cpp",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "ASSERT_EQ(t_coins[0], this->m_db->get_block_already_generated_coins(0));",
"parameters": {
"text": [
@@ -744,7 +744,7 @@
"path": "/tests/unit_tests/hardfork.cpp",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "virtual uint64_t get_block_already_generated_coins(const uint64_t& height) const { return 10000000000; }",
"parameters": {
"text": [
@@ -755,4 +755,4 @@
]
}
]
}
}
+533
View File
@@ -3,5 +3,538 @@
"description": "Makes essensial parameters editable.",
"required": [],
"files": [
{
"path": "/src/cryptonote_config.h",
"changes": [
{
"action": "replace",
"marker": "#define CRYPTONOTE_NAME",
"parameters": {
"text": [
"#define CRYPTONOTE_NAME \"%s\""
],
"var": "CRYPTONOTE_NAME"
}
},
{
"action": "replace",
"marker": "uint16_t const P2P_DEFAULT_PORT = 18080;",
"parameters": {
"text": [
"uint16_t const P2P_DEFAULT_PORT = %s;"
],
"var": "MAINNET_P2P_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint16_t const RPC_DEFAULT_PORT = 18081;",
"parameters": {
"text": [
"uint16_t const RPC_DEFAULT_PORT = %s;"
],
"var": "MAINNET_RPC_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint16_t const ZMQ_RPC_DEFAULT_PORT = 18082;",
"parameters": {
"text": [
"uint16_t const ZMQ_RPC_DEFAULT_PORT = %s;"
],
"var": "MAINNET_ZMQ_RPC_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint16_t const P2P_DEFAULT_PORT = 28080;",
"parameters": {
"mandatory": false,
"text": [
"uint16_t const P2P_DEFAULT_PORT = %s;"
],
"var": "TESTNET_P2P_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint16_t const RPC_DEFAULT_PORT = 28081;",
"parameters": {
"mandatory": false,
"text": [
"uint16_t const RPC_DEFAULT_PORT = %s;"
],
"var": "TESTNET_RPC_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint16_t const ZMQ_RPC_DEFAULT_PORT = 28082;",
"parameters": {
"mandatory": false,
"text": [
"uint16_t const ZMQ_RPC_DEFAULT_PORT = %s;"
],
"var": "TESTNET_ZMQ_RPC_DEFAULT_PORT"
}
},
{
"action": "replace",
"marker": "uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18;",
"parameters": {
"text": [
"uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = %s;"
],
"var": "CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX"
}
},
{
"action": "replace",
"marker": "uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 19;",
"parameters": {
"text": [
"uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = %s;"
],
"var": "CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX"
}
},
{
"action": "replace",
"marker": "uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 42;",
"parameters": {
"text": [
"uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = %s;"
],
"var": "CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX"
}
},
{
"action": "replace",
"marker": "0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10",
"parameters": {
"text": [
"%s"
],
"var": "MAINNET_NETWORK_ID"
}
},
{
"action": "replace",
"marker": "0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x11",
"parameters": {
"mandatory": false,
"text": [
"%s"
],
"var": "TESTNET_NETWORK_ID"
}
},
{
"action": "replace",
"marker": "std::string const GENESIS_TX = \"013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1\";",
"parameters": {
"text": [
"std::string const GENESIS_TX = \"%s\";"
],
"var": "MAINNET_GENESIS_TX"
}
},
{
"action": "replace",
"marker": "std::string const GENESIS_TX = \"013c01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd0880712101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b\";",
"parameters": {
"mandatory": false,
"text": [
"std::string const GENESIS_TX = \"%s\";"
],
"var": "TESTNET_GENESIS_TX"
}
},
{
"action": "replace",
"marker": "#define MONEY_SUPPLY",
"parameters": {
"mandatory": false,
"text": [
"#define MONEY_SUPPLY ((uint64_t)%s)"
],
"var": "MONEY_SUPPLY"
}
},
{
"action": "replace",
"marker": "#define EMISSION_SPEED_FACTOR_PER_MINUTE",
"parameters": {
"mandatory": false,
"text": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE (%s)"
],
"var": "EMISSION_SPEED_FACTOR"
}
},
{
"action": "replace",
"marker": "#define FINAL_SUBSIDY_PER_MINUTE",
"parameters": {
"mandatory": false,
"text": [
"#define FINAL_SUBSIDY_PER_MINUTE ((uint64_t)%s)"
],
"var": "FINAL_SUBSIDY_PER_MINUTE"
}
},
{
"action": "replace",
"marker": "#define DIFFICULTY_TARGET_V2",
"parameters": {
"mandatory": false,
"text": [
"#define DIFFICULTY_TARGET_V2 %s"
],
"var": "DIFFICULTY_TARGET_V2"
}
},
{
"action": "replace",
"marker": "#define DIFFICULTY_TARGET_V1",
"parameters": {
"mandatory": false,
"text": [
"#define DIFFICULTY_TARGET_V1 %s"
],
"var": "DIFFICULTY_TARGET_V1"
}
},
{
"action": "replace",
"marker": "#define DIFFICULTY_WINDOW",
"parameters": {
"mandatory": false,
"text": [
"#define DIFFICULTY_WINDOW %s"
],
"var": "DIFFICULTY_WINDOW"
}
},
{
"action": "replace",
"marker": "#define DIFFICULTY_CUT",
"parameters": {
"mandatory": false,
"text": [
"#define %s"
],
"var": "DIFFICULTY_CUT"
}
},
{
"action": "replace",
"marker": "#define DIFFICULTY_LAG",
"parameters": {
"mandatory": false,
"text": [
"#define DIFFICULTY_LAG %s"
],
"var": "DIFFICULTY_LAG"
}
},
{
"action": "replace",
"marker": "#define CRYPTONOTE_DISPLAY_DECIMAL_POINT",
"parameters": {
"mandatory": false,
"text": [
"#define CRYPTONOTE_DISPLAY_DECIMAL_POINT %s"
],
"var": "CRYPTONOTE_DISPLAY_DECIMAL_POINT"
}
},
{
"action": "replace",
"marker": "#define COIN",
"parameters": {
"mandatory": false,
"text": [
"#define COIN ((uint64_t)%s)"
],
"var": "COIN"
}
},
{
"action": "replace",
"marker": "uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)2000000000);",
"parameters": {
"mandatory": false,
"text": [
"uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)%s);"
],
"var": "DEFAULT_DUST_THRESHOLD"
}
}
]
},
{
"path": "/src/p2p/net_node.inl",
"multiline": true,
"changes": [
{
"action": "replace",
"marker": "(std::set<std::string> full_addrs;)[^@]+(return full_addrs;)",
"parameters": {
"text": [
"\\1\\n if (testnet) {\\n } else {\\n%MAINNET_SEED_NODES%\\n }\\n \\2"
]
}
}
]
},
{
"path": "/src/p2p/net_node.inl",
"changes": [
{
"action": "replace",
"marker": "%MAINNET_SEED_NODES%",
"parameters": {
"text": [
"%s"
],
"var": "MAINNET_SEED_NODES"
}
}
]
},
{
"path": "/src/checkpoints/checkpoints.cpp",
"multiline": true,
"changes": [
{
"action": "replace",
"marker": "(static const std::vector<std::string> dns_urls = {)[^}]+(};)",
"parameters": {
"text": [
"\\1\\n\\2"
]
}
},
{
"action": "replace",
"marker": "(static const std::vector<std::string> testnet_dns_urls = {)[^}]+(};)",
"parameters": {
"text": [
"\\1\\n\\2"
]
}
},
{
"action": "replace",
"marker": "(bool checkpoints::init_default_checkpoints\\(bool testnet\\))[^@]+(bool checkpoints::load_checkpoints_from_json\\(const std::string &json_hashfile_fullpath\\))",
"parameters": {
"text": [
"\\1\\n{\\n if (testnet) {\\n return true; \\n} \\n%MAINNET_CHECKPOINTS%\\n return true;\\n}\\n\\n\\2"
]
}
}
]
},
{
"path": "/src/checkpoints/checkpoints.cpp",
"changes": [
{
"action": "replace",
"marker": "%MAINNET_CHECKPOINTS%",
"parameters": {
"text": [
"%s"
],
"replace_text_alt": [
""
],
"var": "MAINNET_CHECKPOINTS"
}
}
]
},
{
"path": "/src/common/updates.cpp",
"multiline": true,
"changes": [
{
"action": "replace",
"marker": "(static const std::vector<std::string> dns_urls = {)[^@]+(};)",
"parameters": {
"text": [
"\\1\\n\\2"
]
}
}
]
},
{
"path": "/src/cryptonote_core/blockchain.cpp",
"multiline": true,
"changes": [
{
"action": "replace",
"marker": "(} mainnet_hard_forks\\[\\] = {)[^;]+(};)",
"parameters": {
"text": [
"\\1\\n%MAINNET_HARDFORKS%\\n\\2"
]
}
},
{
"action": "replace",
"marker": "(} testnet_hard_forks\\[\\] = {)[^;]+(};)",
"parameters": {
"text": [
"\\1\\n%TESTNET_HARDFORKS%\\n\\2"
]
}
}
]
},
{
"path": "/src/cryptonote_core/blockchain.cpp",
"changes": [
{
"action": "add_above",
"marker": "bool valid = hash == m_blocks_hash_of_hashes[n];",
"parameters": {
"text": [
"MWARNING(\"block: \" << height << \" - \" << epee::string_tools::pod_to_hex(hashes.front()));",
"MWARNING(\"block: \" << height + hashes.size() << \" - \" << epee::string_tools::pod_to_hex(hashes.back()));",
"MWARNING(\"first_index: \" << first_index << \" - \" << last_index);"
]
}
},
{
"action": "replace",
"marker": "%MAINNET_HARDFORKS%",
"parameters": {
"text": [
"%s"
],
"var": "MAINNET_HARDFORKS"
}
},
{
"action": "replace",
"marker": "%TESTNET_HARDFORKS%",
"parameters": {
"text": [
"%s"
],
"replace_text_alt": [
""
],
"var": "TESTNET_HARDFORKS"
}
},
{
"action": "replace",
"marker": "static const uint64_t mainnet_hard_fork_version_1_till = 1009826;",
"parameters": {
"text": [
"static const uint64_t mainnet_hard_fork_version_1_till = %s;"
],
"var": "MAINNET_HARDFORK_V1_LAST_BLOCK"
}
},
{
"action": "replace",
"marker": "static const uint64_t testnet_hard_fork_version_1_till = 624633;",
"parameters": {
"text": [
"static const uint64_t testnet_hard_fork_version_1_till = %s;"
],
"replace_text_alt": [
"static const uint64_t testnet_hard_fork_version_1_till = 1;"
],
"var": "TESTNET_HARDFORK_V1_LAST_BLOCK"
}
},
{
"action": "replace",
"marker": "LOG_ERROR(\"WARNING: local blockchain failed to pass a MoneroPulse checkpoint, and you could be on a fork. You should either sync up from scratch, OR download a fresh blockchain bootstrap, OR enable checkpoint enforcing with the --enforce-dns-checkpointing command-line option\");",
"parameters": {
"text": [
" LOG_ERROR(\"WARNING: local blockchain failed to pass a %sPulse checkpoint, and you could be on a fork. You should either sync up from scratch, OR download a fresh blockchain bootstrap, OR enable checkpoint enforcing with the --enforce-dns-checkpointing command-line option\");"
],
"var": "COIN_NAME"
}
}
]
},
{
"path": "/src/common/dns_utils.cpp",
"changes": [
{
"action": "replace",
"marker": "LOG_PRINT_L0(\"WARNING: no two valid MoneroPulse DNS checkpoint records were received\");",
"parameters": {
"text": [
" LOG_PRINT_L0(\"WARNING: no two valid %sPulse DNS checkpoint records were received\");"
],
"var": "COIN_NAME"
}
},
{
"action": "replace",
"marker": "LOG_PRINT_L0(\"WARNING: no two MoneroPulse DNS checkpoint records matched\");",
"parameters": {
"text": [
" LOG_PRINT_L0(\"WARNING: no two %sPulse DNS checkpoint records matched\");"
],
"var": "COIN_NAME"
}
}
]
},
{
"path": "/src/blocks/blocks.dat",
"action": "remove"
},
{
"path": "/src/blocks/checkpoints.dat",
"action": "remove"
},
{
"path": "/src/blocks/testnet_blocks.dat",
"action": "remove"
},
{
"path": "/src/blocks/blocks.dat",
"action": "add",
"source": "/monero/files/blocks.dat"
},
{
"path": "/src/blocks/checkpoints.dat",
"action": "add",
"source": "/monero/files/checkpoints.dat"
},
{
"path": "/src/blocks/testnet_blocks.dat",
"action": "add",
"source": "/monero/files/testnet_blocks.dat"
}
]
}
+77
View File
@@ -0,0 +1,77 @@
{
"file": "donations.json",
"description": "Donation address for a dev team",
"required": [
],
"files": [
{
"path": "/src/cryptonote_config.h",
"changes": [
{
"action": "add_below",
"marker": "#define PER_KB_FEE_QUANTIZATION_DECIMALS",
"parameters": {
"text": [
"#define CONFIG_DONATION_ADDRESS \"%s\""
],
"replace_text_alt": [
"#define CONFIG_DONATION_ADDRESS \"\""
],
"var": "CONFIG_DONATION_ADDRESS"
}
}
]
},
{
"path": "/src/cryptonote_basic/miner.cpp",
"changes": [
{
"action": "add_below",
"marker": "const command_line::arg_descriptor<bool> arg_bg_mining_enable = {\"bg-mining-enable\", \"enable/disable background mining\", true, true};",
"parameters": {
"text": [
"// the 3rd and 4rd parameter are just copy paste. I don't know what they do",
" const command_line::arg_descriptor<bool> arg_donate = {\"donate\", \"Enable background donation mining\", true, true};"
]
}
},
{
"action": "replace",
"marker": "if(command_line::has_arg(vm, arg_start_mining))",
"parameters": {
"text": [
" if(command_line::has_arg(vm, arg_start_mining) || command_line::has_arg(vm, arg_donate))"
]
}
},
{
"action": "replace",
"marker": "if(!cryptonote::get_account_address_from_str(info, testnet, command_line::get_arg(vm, arg_start_mining)) || info.is_subaddress)",
"parameters": {
"text": [
" if(command_line::has_arg(vm, arg_donate))",
" {",
" if (!cryptonote::get_account_address_from_str(info, testnet, std::string(CONFIG_DONATION_ADDRESS)))",
" {",
" LOG_ERROR(\"Internal error: malformed donation address\");",
" return false;",
" }",
" }",
" else if(!cryptonote::get_account_address_from_str(info, testnet, command_line::get_arg(vm, arg_start_mining)) || info.is_subaddress)"
]
}
},
{
"action": "add_below",
"marker": "command_line::add_arg(desc, arg_bg_mining_enable);",
"parameters": {
"text": [
" command_line::add_arg(desc, arg_donate);"
]
}
}
]
}
]
}
+2 -2
View File
@@ -9,7 +9,7 @@
"path": "/contrib/epee/include/net/http_server_handlers_map2.h",
"changes": [
{
"action": "add_bellow",
"action": "add_below",
"marker": "response.m_response_comment = \"Ok\"; \\",
"parameters": {
"text": [
@@ -20,4 +20,4 @@
]
}
]
}
}
+83
View File
@@ -0,0 +1,83 @@
{
"file": "versionized-parameters.json",
"description": "Change parameters when hardfork.",
"required": [],
"files": [
{
"path": "/src/cryptonote_config.h",
"changes": [
{
"action": "add_below",
"marker": "#define DIFFICULTY_WINDOW 720",
"parameters": {
"text": [
"#define DIFFICULTY_WINDOW_V2 %s"
],
"replace_text_alt": [
"#define DIFFICULTY_WINDOW_V2 DIFFICULTY_WINDOW"
],
"var": "DIFFICULTY_WINDOW_V2"
}
},
{
"action": "add_below",
"marker": "#define EMISSION_SPEED_FACTOR_PER_MINUTE (20)",
"parameters": {
"text": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V2 (%s)"
],
"replace_text_alt": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V2 EMISSION_SPEED_FACTOR_PER_MINUTE"
],
"var": "EMISSION_SPEED_FACTOR_PER_MINUTE_V2"
}
}
]
},
{
"path": "/src/cryptonote_config.h",
"changes": [
{
"action": "add_below",
"marker": "#define DIFFICULTY_WINDOW 720",
"parameters": {
"text": [
"#define DIFFICULTY_WINDOW_V1 %s"
],
"replace_text_alt": [
"#define DIFFICULTY_WINDOW_V1 DIFFICULTY_WINDOW"
],
"var": "DIFFICULTY_WINDOW_V1"
}
},
{
"action": "add_below",
"marker": "#define EMISSION_SPEED_FACTOR_PER_MINUTE (20)",
"parameters": {
"text": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V1 (%s)"
],
"replace_text_alt": [
"#define EMISSION_SPEED_FACTOR_PER_MINUTE_V1 EMISSION_SPEED_FACTOR_PER_MINUTE"
],
"var": "EMISSION_SPEED_FACTOR_PER_MINUTE_V1"
}
}
]
},
{
"path": "/src/cryptonote_basic/cryptonote_basic_impl.cpp",
"changes": [
{
"action": "replace",
"marker": "const int emission_speed_factor = EMISSION_SPEED_FACTOR_PER_MINUTE - (target_minutes-1);",
"parameters": {
"text": [
"const int emission_speed_factor = version < 2 ? EMISSION_SPEED_FACTOR_PER_MINUTE_V1 - (target_minutes-1) : EMISSION_SPEED_FACTOR_PER_MINUTE_V2 - (target_minutes-1);"
]
}
}
]
}
]
}
+4 -3
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# Template: OpenBazaar
# Template: OpenBazaar
#
# install_dependencies.sh - Setup your Cryptonote development environment in one step.
#
@@ -63,7 +63,8 @@ function installMac {
fi
# install gpg/sqlite3/python/wget/openssl/zmq if they aren't installed
for dep in cmake boost python
brew tap jmuncaster/homebrew-header-only
for dep in cmake boost python libevent pkgconfig jmuncaster/header-only/cppzmq
do
if ! command_exists $dep ; then
brew install $dep
@@ -111,4 +112,4 @@ elif [[ $OSTYPE == linux-gnu || $OSTYPE == linux-gnueabihf ]]; then
installUbuntu
else
unsupportedOS
fi
fi
+43 -4
View File
@@ -1,8 +1,10 @@
import argparse
import fileinput
import fnmatch
import itertools
import json
import os
from stat import *
import re
import shutil
import sys
@@ -18,6 +20,8 @@ class bcolors:
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
reload(sys)
sys.setdefaultencoding('utf8')
def reverse_enumerate(iterable):
"""
@@ -25,6 +29,19 @@ def reverse_enumerate(iterable):
"""
return itertools.izip(reversed(xrange(len(iterable))), reversed(iterable))
def findReplace(directory, find, replace, filePattern):
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, filePattern):
filepath = os.path.join(path, filename)
stats = os.stat(filepath)
if ".git" in filepath:
continue
with open(filepath) as f:
s = f.read()
s = s.decode('utf-8', errors='ignore').encode('utf-8').replace(find, replace)
with open(filepath, "w") as f:
f.write(s)
os.chmod(filepath, int(str(oct(stats.st_mode))[3:], 8))
def text_creator(change):
replace_text = ''
@@ -51,7 +68,7 @@ def text_creator(change):
sys.__stdout__.write(bcolors.FAIL + "ERROR: variable is not in the config file - " + change['parameters']['var']+ bcolors.ENDC + "\n")
sys.exit(2)
else:
replace_text = '\n'.join(change['parameters']['text']) + "\n"
replace_text = '\n'.join(change['parameters']['text']) + "\n"
# sys.__stdout__.write("Replace text: " + replace_text + "\n")
return replace_text
@@ -107,6 +124,16 @@ if not (set(required_extensions) <= set(loaded_extensions)):
for file in extension['files']:
# Bulk replace text
if 'action' in file.keys() and file['action'] == 'bulk_replace':
if 'find' in file.keys() and 'replace' in file.keys() and 'file_pattern' in file.keys():
sys.__stdout__.write("- Bulk replacing " + file['find'] + " with " + file['replace'] + "\n")
findReplace(args.source, file['find'], file['replace'], file['file_pattern'])
else:
sys.__stdout__.write(bcolors.FAIL + "ERROR: find, replace and file_pattern are mandatory with bulk_replace" + bcolors.ENDC + "\n")
exit(4)
continue
# Add new file to output source
if 'action' in file.keys() and 'source' in file.keys() and file['action'] == 'add':
source_path = os.path.dirname(os.path.realpath(args.extension_file)) + file['source']
@@ -118,6 +145,18 @@ for file in extension['files']:
exit(4)
continue
# Remove file from base repository
if 'action' in file.keys() and 'path' in file.keys() and file['action'] == 'remove':
path = args.source + file['path']
if (os.path.isfile(path)):
sys.__stdout__.write("- Removing file " + path + "\n")
os.remove(path)
else:
sys.__stdout__.write(bcolors.FAIL + "ERROR: file does not exists - " + path + bcolors.ENDC + "\n")
exit(4)
continue
# If multiline, get the whole file
if 'multiline' in file.keys() and file['multiline'] == True:
work_file = open(args.source + file['path'], 'r')
@@ -202,14 +241,14 @@ for file in extension['files']:
if change['marker'] in line:
sys.__stdout__.write(" + Delete line at marker: " + change['marker'] + "\n")
delete_line = True
if change['action'] == "add_bellow":
if change['action'] == "add_below":
if change['marker'] in line:
sys.__stdout__.write(" + Added text after marker: " + change['marker'] + "\n")
replace_text = text_creator(change)
if replace_text is not None:
add_after_line = replace_text
add_after_line = replace_text
if delete_line != True:
sys.stdout.write(line)
sys.stdout.write(line)
if add_after_line != "":
sys.stdout.write(add_after_line)