diff options
Diffstat (limited to 'main/abuild')
-rw-r--r-- | main/abuild/0001-abuild-fix-fetch-lock-file-on-nfs.patch | 69 | ||||
-rw-r--r-- | main/abuild/APKBUILD | 8 |
2 files changed, 52 insertions, 25 deletions
diff --git a/main/abuild/0001-abuild-fix-fetch-lock-file-on-nfs.patch b/main/abuild/0001-abuild-fix-fetch-lock-file-on-nfs.patch index b749f30769..336a44092c 100644 --- a/main/abuild/0001-abuild-fix-fetch-lock-file-on-nfs.patch +++ b/main/abuild/0001-abuild-fix-fetch-lock-file-on-nfs.patch @@ -1,4 +1,4 @@ -From 7479ed1efcd4ac1f5cc93aa65352f6a25bcbf218 Mon Sep 17 00:00:00 2001 +From 92186b70ca9c520fc726e0885aac633aadace655 Mon Sep 17 00:00:00 2001 From: Natanael Copa <ncopa@alpinelinux.org> Date: Wed, 26 Aug 2015 08:14:36 +0200 Subject: [PATCH] abuild: fix fetch lock file on nfs @@ -12,9 +12,9 @@ We fix this by creating a small abuild-fetch application that will create a POSIX lock which works with NFS. --- Makefile | 6 +- - abuild-fetch.c | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - abuild.in | 47 +-------------- - 3 files changed, 190 insertions(+), 47 deletions(-) + abuild-fetch.c | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + abuild.in | 69 +------------------- + 3 files changed, 200 insertions(+), 69 deletions(-) create mode 100644 abuild-fetch.c diff --git a/Makefile b/Makefile @@ -50,10 +50,10 @@ index 81c2851..b7332b2 100644 diff --git a/abuild-fetch.c b/abuild-fetch.c new file mode 100644 -index 0000000..89d914f +index 0000000..51b41eb --- /dev/null +++ b/abuild-fetch.c -@@ -0,0 +1,184 @@ +@@ -0,0 +1,194 @@ +/* MIT license + +Copyright (C) 2015 Natanael Copa <ncopa@alpinelinux.org> @@ -114,7 +114,7 @@ index 0000000..89d914f + int lockfd, status=0; + pid_t childpid; + char outfile[PATH_MAX], partfile[PATH_MAX]; -+ char *name; ++ char *name, *p; + struct flock fl = { + .l_type = F_WRLCK, + .l_whence = SEEK_SET, @@ -129,11 +129,23 @@ index 0000000..89d914f + .argc = 3, + .argv = { "wget", "-O", partfile, NULL } + }; ++ + name = strrchr(url, '/'); + if (name == NULL) + errx(1, "%s: no '/' in url"); ++ p = strstr(url, "::"); ++ if (p != NULL) { ++ name = url; ++ *p = '\0'; ++ url = p + 2; ++ } else if (strstr(url, "saveas-") == url) { ++ *name++ = '\0'; ++ url += 7; /* strlen("saveas-") */ ++ } else { ++ name++; ++ } + -+ snprintf(outfile, sizeof(outfile), "%s%s", destdir, name); ++ snprintf(outfile, sizeof(outfile), "%s/%s", destdir, name); + snprintf(lockfile, sizeof(lockfile), "%s.lock", outfile); + snprintf(partfile, sizeof(partfile), "%s.part", outfile); + @@ -147,10 +159,8 @@ index 0000000..89d914f + err(1, "fcntl(F_SETLKW)"); + } + -+ if (access(outfile, F_OK) == 0) { -+ printf("%s already exist. skipping\n", outfile); ++ if (access(outfile, F_OK) == 0) + goto fetch_done; -+ } + + if (access(partfile, F_OK) == 0) { + printf("Partial download found. Trying to resume.\n"); @@ -239,10 +249,10 @@ index 0000000..89d914f + return r; +} diff --git a/abuild.in b/abuild.in -index b8d8851..6e96187 100644 +index b8d8851..952048b 100644 --- a/abuild.in +++ b/abuild.in -@@ -298,23 +298,6 @@ sourcecheck() { +@@ -298,79 +298,12 @@ sourcecheck() { return 0 } @@ -265,18 +275,31 @@ index b8d8851..6e96187 100644 - uri_fetch() { local uri="$1" - local d="${uri##*/}" # $(basename $uri) -@@ -335,38 +318,10 @@ uri_fetch() { - ;; - esac +- local d="${uri##*/}" # $(basename $uri) +- local opts + [ -n "$quiet" ] && opts="-s" +- local lockfile="$SRCDEST/$d".lock +- +- # fix saveas-*://* URIs +- case "$uri" in +- # remove 'saveas-' from beginning and +- # '/filename' from end of URI +- saveas-*://*) uri="${uri:7:$(expr ${#uri} - 7 - ${#d} - 1)}";; +- +- *::*) +- d=${uri%%::*} +- uri=${uri#$d::} +- ;; +- esac +- - case "$uri" in - https://*) opts="-k";; - esac - mkdir -p "$SRCDEST" - - CLEANUP_FILES="$CLEANUP_FILES $lockfile" +- +- CLEANUP_FILES="$CLEANUP_FILES $lockfile" - ( - flock -n -x 9 || msg "Waiting for ${lockfile##*/}..." - flock -x 9 @@ -302,10 +325,14 @@ index b8d8851..6e96187 100644 - && mv "$SRCDEST/$d.part" "$SRCDEST/$d" - - ) 9>$lockfile +- +- local rc=$? +- rm -f "$lockfile" +- return $rc + abuild-fetch -d "$SRCDEST" "$uri" + } - local rc=$? - rm -f "$lockfile" + is_remote() { -- 2.5.0 diff --git a/main/abuild/APKBUILD b/main/abuild/APKBUILD index 10fd0e1eb3..2a57fedb97 100644 --- a/main/abuild/APKBUILD +++ b/main/abuild/APKBUILD @@ -2,7 +2,7 @@ pkgname=abuild pkgver=2.24.0 _ver=${pkgver%_git*} -pkgrel=2 +pkgrel=3 pkgdesc="Script to build Alpine Packages" url="http://git.alpinelinux.org/cgit/abuild/" arch="all" @@ -66,8 +66,8 @@ gems() { } md5sums="7821eea872e86a768d881fecce95e934 abuild-2.24.0.tar.xz -1de97f36c186c85c6381e731af9359f9 0001-abuild-fix-fetch-lock-file-on-nfs.patch" +3acc92254dbab1799f724394e1d49264 0001-abuild-fix-fetch-lock-file-on-nfs.patch" sha256sums="0e0c0c7579c3b8d6668fad9d93a42f3ea18da88679e1a12a178f2676c79e94d6 abuild-2.24.0.tar.xz -9a2dfb3adffd5ae7b2b824ed1e099f0c69eb1d9e34550245f4465d87210b414c 0001-abuild-fix-fetch-lock-file-on-nfs.patch" +3f6d6f315c0531f900d7465abaf5f4bd0bbd59d884b2af363bc0105b0f2b3a95 0001-abuild-fix-fetch-lock-file-on-nfs.patch" sha512sums="360d0164afed9c61576618d113d738327151c60f1bc1e6246fcf74f97db087ca2effb11a4ae045f1f288063d5311c6dddbe7721b3cbe65d11472b3d2b0f03ef6 abuild-2.24.0.tar.xz -c371afe46fba92586550f7554972f58b3e7f734e42dc138d7cb8fa781b50ced2a3b7cf1795b51ed2846ea6702377f3a436d055a12908faf70eb92f253f3ce3cb 0001-abuild-fix-fetch-lock-file-on-nfs.patch" +620fbf17f48f2732b7e7fd10f4c02bedae6d0c5c7988cefc8e1f2f233efd49514d08b72a367203c977b11272397e713e7551029f85b0dfc79c55587551600ced 0001-abuild-fix-fetch-lock-file-on-nfs.patch" |