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

Sed usage in README build #958

Closed
spirillen opened this issue Dec 22, 2024 · 3 comments
Closed

Sed usage in README build #958

spirillen opened this issue Dec 22, 2024 · 3 comments

Comments

@spirillen
Copy link
Contributor

spirillen commented Dec 22, 2024

I come to wonder of the way you are building the README by using sed and executing 12 process for something I would expect could be one process,

Current script

cat "${CI_README_TEMPLATE}" | sed "s|%%version%%|${BUILD_NUMBER}|g" | \
sed "s|%%testTime%%|${testTime}|g" | \
sed "s|%%testDay%%|${testDay}|g" | \
sed "s|%%testDate%%|${testDate}|g" | \
sed "s|%%activeNowCount%%|${activeNowCount}|g" | \
sed "s|%%activeTodayCount%%|${activeTodayCount}|g" | \
sed "s|%%discoveredTodayCount%%|${discoveredTodayCount}|g" | \
sed "s|%%domainsCount%%|${domainsCount}|g" | \
sed "s|%%linksCount%%|${linksCount}|g" | \
sed "s|%%domainsTGZSize%%|${domainsTGZSize}|g" | \
sed "s|%%linksTGZSize%%|${linksTGZSize}|g" > "${README_FILE}"
}

Expect to work as equal with only one process and run over the readme.template with sed

sed "s|%%version%%|${BUILD_NUMBER}|g;s|%%testTime%%|${testTime}|g;s|%%testDay%%|${testDay}|g;s|%%testDate%%|${testDate}|g;s|%%activeNowCount%%|${activeNowCount}|g;s|%%activeTodayCount%%|${activeTodayCount}|gs|%%discoveredTodayCount%%|${discoveredTodayCount}|g;s|%%domainsCount%%|${domainsCount}|g;s|%%linksCount%%|${linksCount}|g;s|%%domainsTGZSize%%|${domainsTGZSize}|g;s|%%linksTGZSize%%|${linksTGZSize}|g" "${CI_README_TEMPLATE}" > "${README_FILE}"
@spirillen
Copy link
Contributor Author

Same here

function cleanupFiles() {
# We now remove the original files.
rm -f "${PHISHING_ALL_PHISHING_DOMAINS_FILE}"
rm -f "${PHISHING_ALL_PHISHING_LINKS_FILE}"
rm -f "${PHISHING_ALL_DOMAINS_FILE}"
rm -f "${PHISHING_ALL_LINKS_FILE}"
}

make this 1 process, there are no reason to start 4 process for what can be done in 1

rm -f "${PHISHING_ALL_PHISHING_DOMAINS_FILE}" "${PHISHING_ALL_PHISHING_LINKS_FILE}" "${PHISHING_ALL_DOMAINS_FILE}" "${PHISHING_ALL_LINKS_FILE}"

@spirillen
Copy link
Contributor Author

as i comment 2, collect the same command to 1 process

# Cleanup the previous versions.
rm -f "${PHISHING_ALL_PHISHING_DOMAINS_ZIP}"
rm -f "${PHISHING_ALL_PHISHING_LINKS_ZIP}"
rm -f "${PHISHING_ALL_DOMAINS_TGZ}"
rm -f "${PHISHING_ALL_LINKS_TGZ}"

@spirillen
Copy link
Contributor Author

abusive usage of rm again in

rm -f "${whitelistMeDestination}"
rm -f "${whitelistMeRegexDestionation}"
rm -f "${whitelistMeRZDDestination}"
rm -f "${additionalDomainDestination}"
rm -f "${additionalLinkDestination}"

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

1 participant