Skip to content

Instantly share code, notes, and snippets.

@ArsenShnurkov
Last active December 1, 2016 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArsenShnurkov/be3f5ee32a2c69c9628bc3440ee369c1 to your computer and use it in GitHub Desktop.
Save ArsenShnurkov/be3f5ee32a2c69c9628bc3440ee369c1 to your computer and use it in GitHub Desktop.
#!/pseudocode/about/the/idea
###############################################
# code which will be autogenerated
src_install
src_preinst
D=/tmp
die() {
exit
}
###############################################
# code which will go to .ebuild
# inherit gac
src_install() {
# default
gac_src_install()
einstall_pc_file "aa" "0.4" "./data/aa4.dat"
einstall_pc_file "aa" "0.5" "./data/ab5.dat"
einstall_pc_file "bb" "0.0.1" "./enc/bb.dat"
}
pkg_preinst() {
# default
gac_pkg_preinst()
}
###############################################
# code which will go to .eclass
PC_FILE_LIST=${D}/pc_file_list.txt
separator=$'\t'
gac_src_install() {
: > "${PC_FILE_LIST}" || die
}
register() {
printf '%s\0' "$*" >> "${PC_FILE_LIST}" || die
}
gac_pkg_preinst() {
local IFS=${separator}
local args
while IFS=${separator} read -rd '' -a args; do
local name version relative_path
name=${args[0]} version=${args[1]} relative_path=${args[2]} # ...
# echo emulates call to command line tool
echo "${name}" "${version}" "${relative_path}" # or echo "${args[@]}" || die
rm "${relative_path}" || die
done < "${PC_FILE_LIST}"
rm "${PC_FILE_LIST}" || die
}
# EXPORT_FUNCTIONS src_install pkg_preinst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment