diff options
author | sanbikappa | 2023-08-05 23:07:03 +0800 |
---|---|---|
committer | sanbikappa | 2023-08-05 23:07:03 +0800 |
commit | 2fc38a19617d7be19ef0f6ede6d27f1b9af71d18 (patch) | |
tree | da8c52825cea64fab7d13eefe60f403248243a16 | |
parent | decdc4280c317e7718d6af21d2a552f29dedd46d (diff) | |
download | aur-2fc38a19617d7be19ef0f6ede6d27f1b9af71d18.tar.gz |
fix permission problem when create temp script file
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 35 |
2 files changed, 26 insertions, 11 deletions
@@ -1,7 +1,7 @@ pkgbase = krita-plugin-pythonplugindevelopertools-git pkgdesc = Python plugin for Krita that assists with making python plugins for Krita pkgver = r37.46a671a - pkgrel = 2 + pkgrel = 3 url = https://github.com/KnowZero/Krita-PythonPluginDeveloperTools install = .install arch = any @@ -3,7 +3,7 @@ pkgname=krita-plugin-pythonplugindevelopertools-git pkgver=r37.46a671a -pkgrel=2 +pkgrel=3 epoch= pkgdesc="Python plugin for Krita that assists with making python plugins for Krita" arch=('any') @@ -21,24 +21,39 @@ pkgver() { printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" } -prepare() { - # General users can not download API files to /usr/share/krita/pykrita/ if they do not have sudo permission - # set the save path of PluginDevTools.KritaAPI.*.zip files to ~/.cache/krita/ - - rm -f "$srcdir"/*.patch - # create patchs - cd "$srcdir/$pkgname-$pkgver/plugindevtools/PluginDevTools" - search=$(grep -n os.path.dirname *.py | grep os.path.realpath | grep .KritaAPI. | grep .zip) +append_patch() { + search="$1" + old="$2" + new="$3" + sedCommand="s|$2|$3|" + echo old="$2" + echo new="$3" echo "$search" | while read -r line;do file="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $1}')" line_number="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $2}')" line_content="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $3}')" - line_replace="$(echo "$line_content" | sed 's|os.path.dirname(os.path.realpath(__file__))|os.path.join(os.path.expanduser("~"),".cache","krita","PluginDevTools")|')" + line_replace="$(echo "$line_content" | sed "$sedCommand")" echo "${line_number}c${line_number}" >> ${file}.patch echo "< $line_content" >> ${file}.patch echo "---" >> ${file}.patch echo "> $line_replace" >> ${file}.patch done +} + +prepare() { + # General users can not download API files to /usr/share/krita/pykrita/ if they do not have sudo permission + # set the save path of PluginDevTools.KritaAPI.*.zip files to ~/.cache/krita/ + + rm -f "$srcdir"/*.patch + + # create patches + cd "$srcdir/$pkgname-$pkgver/plugindevtools/PluginDevTools" + search=$(grep -n os.path.dirname *.py | grep os.path.realpath | grep .KritaAPI. | grep .zip) + append_patch "$search" 'os.path.dirname(os.path.realpath(__file__))' 'os.path.join(os.path.expanduser("~"),".cache","krita","PluginDevTools")' + + search=$(grep -n self.tempFilePath *.py | grep os.path.dirname | grep os.path.realpath | grep .console.temp.py) + append_patch "$search" 'os.path.dirname(os.path.realpath(__file__))' 'os.path.join(os.path.expanduser("~"),".cache","krita","PluginDevTools")' + # patch files cd "$srcdir/$pkgname-$pkgver/plugindevtools/PluginDevTools" |