[pacman-dev] [PATCH] With VCS sources, only update sources in $srcdir.
Previously, the sources in $srcdir were always removed prior building. After this change the sources are only updated. This makes incremental builds possible. Also this goes in line with the current behaviour for other types of sources, where the sources are just being overwritten without being removed first. --- scripts/makepkg.sh.in | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 67ec240..90df60c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -516,9 +516,11 @@ extract_bzr() { msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + bzr update + elif ! { bzr checkout "$dir" "${revision[@]}" --lightweight && ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" @@ -580,9 +582,12 @@ extract_git() { msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - if ! git clone "$dir"; then + if [[ -d "${dir##*/}" ]]; then + pushd `pwd` &>/dev/null + cd_safe "${dir##*/}" + git pull + popd &>/dev/null + elif ! git clone "$dir"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -607,7 +612,7 @@ extract_git() { fi if [[ -n $ref ]]; then - if ! git checkout -b makepkg $ref; then + if ! git checkout -B makepkg $ref; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -662,7 +667,6 @@ extract_hg() { msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" local ref if [[ -n $fragment ]]; then @@ -677,7 +681,10 @@ extract_hg() { esac fi - if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + hg pull -u + elif ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" plain "$(gettext "Aborting...")" exit 1 @@ -739,7 +746,6 @@ extract_svn() { msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" local ref if [[ -n $fragment ]]; then @@ -754,16 +760,20 @@ extract_svn() { esac fi - cp -a "$dir" . - if [[ -n ${ref} ]]; then - cd_safe "$(get_filename "$netfile")" + cd_safe "$dir" if ! svn update -r ${ref}; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn" plain "$(gettext "Aborting...")" fi fi + if [[ -d "${dir##*/}" ]]; then + cp -au "$dir" "$srcdir" + else + cp -a "$dir" . + fi + popd &>/dev/null } -- 1.8.4
This changes the default behaviour for building with VCS sources as Allan suggested in the previous RFC thread [1]. Please check especially the changes to bzr, because I have never used bazaar before. [1] https://mailman.archlinux.org/pipermail/pacman-dev/2013-September/017889.htm...
On 02/10/13 03:23, Lukáš Jirkovský wrote:
Previously, the sources in $srcdir were always removed prior building.
After this change the sources are only updated. This makes incremental builds possible. Also this goes in line with the current behaviour for other types of sources, where the sources are just being overwritten without being removed first. ---
Patch seems to be broken: makepkg: line 586: unexpected EOF while looking for matching ``' makepkg: line 3188: syntax error: unexpected end of file
scripts/makepkg.sh.in | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 67ec240..90df60c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -516,9 +516,11 @@ extract_bzr() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
- if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + bzr update + elif ! { bzr checkout "$dir" "${revision[@]}" --lightweight && ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" @@ -580,9 +582,12 @@ extract_git() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - if ! git clone "$dir"; then + if [[ -d "${dir##*/}" ]]; then + pushd `pwd` &>/dev/null
Why is the pushd/popd needed here? And backticks are bad.
+ cd_safe "${dir##*/}" + git pull + popd &>/dev/null + elif ! git clone "$dir"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -607,7 +612,7 @@ extract_git() { fi
if [[ -n $ref ]]; then - if ! git checkout -b makepkg $ref; then + if ! git checkout -B makepkg $ref; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -662,7 +667,6 @@ extract_hg() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
local ref if [[ -n $fragment ]]; then @@ -677,7 +681,10 @@ extract_hg() { esac fi
- if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + hg pull -u + elif ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" plain "$(gettext "Aborting...")" exit 1 @@ -739,7 +746,6 @@ extract_svn() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
local ref if [[ -n $fragment ]]; then @@ -754,16 +760,20 @@ extract_svn() { esac fi
- cp -a "$dir" . - if [[ -n ${ref} ]]; then - cd_safe "$(get_filename "$netfile")" + cd_safe "$dir" if ! svn update -r ${ref}; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn" plain "$(gettext "Aborting...")" fi fi
+ if [[ -d "${dir##*/}" ]]; then + cp -au "$dir" "$srcdir" + else + cp -a "$dir" . + fi + popd &>/dev/null }
On 09/10/13 12:54, Allan McRae wrote:
On 02/10/13 03:23, Lukáš Jirkovský wrote:
Previously, the sources in $srcdir were always removed prior building.
After this change the sources are only updated. This makes incremental builds possible. Also this goes in line with the current behaviour for other types of sources, where the sources are just being overwritten without being removed first. ---
Patch seems to be broken:
makepkg: line 586: unexpected EOF while looking for matching ``' makepkg: line 3188: syntax error: unexpected end of file
This is all due to the use of backticks noted below and how they get mangled when using m4.
scripts/makepkg.sh.in | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 67ec240..90df60c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -516,9 +516,11 @@ extract_bzr() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
- if ! { bzr checkout "$dir" "${revision[@]}" --lightweight && + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + bzr update + elif ! { bzr checkout "$dir" "${revision[@]}" --lightweight && ( cd "$repo" && bzr pull "$dir" -q --overwrite "${revision[@]}" ); }; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr" plain "$(gettext "Aborting...")" @@ -580,9 +582,12 @@ extract_git() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - if ! git clone "$dir"; then + if [[ -d "${dir##*/}" ]]; then + pushd `pwd` &>/dev/null
Why is the pushd/popd needed here? And backticks are bad.
+ cd_safe "${dir##*/}" + git pull + popd &>/dev/null + elif ! git clone "$dir"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -607,7 +612,7 @@ extract_git() { fi
if [[ -n $ref ]]; then - if ! git checkout -b makepkg $ref; then + if ! git checkout -B makepkg $ref; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 @@ -662,7 +667,6 @@ extract_hg() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
local ref if [[ -n $fragment ]]; then @@ -677,7 +681,10 @@ extract_hg() { esac fi
- if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then + if [[ -d "${dir##*/}" ]]; then + cd_safe "${dir##*/}" + hg pull -u + elif ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" plain "$(gettext "Aborting...")" exit 1 @@ -739,7 +746,6 @@ extract_svn() {
msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}"
local ref if [[ -n $fragment ]]; then @@ -754,16 +760,20 @@ extract_svn() { esac fi
- cp -a "$dir" . - if [[ -n ${ref} ]]; then - cd_safe "$(get_filename "$netfile")" + cd_safe "$dir" if ! svn update -r ${ref}; then error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn" plain "$(gettext "Aborting...")" fi fi
+ if [[ -d "${dir##*/}" ]]; then + cp -au "$dir" "$srcdir" + else + cp -a "$dir" . + fi + popd &>/dev/null }
On Wed, Oct 9, 2013 at 5:05 AM, Allan McRae <allan@archlinux.org> wrote:
On 09/10/13 12:54, Allan McRae wrote:
On 02/10/13 03:23, Lukáš Jirkovský wrote:
Previously, the sources in $srcdir were always removed prior building.
After this change the sources are only updated. This makes incremental builds possible. Also this goes in line with the current behaviour for other types of sources, where the sources are just being overwritten without being removed first. ---
Patch seems to be broken:
makepkg: line 586: unexpected EOF while looking for matching ``' makepkg: line 3188: syntax error: unexpected end of file
This is all due to the use of backticks noted below and how they get mangled when using m4.
Oh, right. I tested this on the makepkg that I already had installed on my system, so I didn't catch this one. I'll take a look at it, maybe the pushd is not even necessary. BTW: should I resubmit this patch immediately after fixing the issue or should I wait for the "Moved dependencies of download functions into a library"? Lukas
On 09/10/13 21:36, Lukas Jirkovsky wrote:
On Wed, Oct 9, 2013 at 5:05 AM, Allan McRae <allan@archlinux.org> wrote:
On 09/10/13 12:54, Allan McRae wrote:
On 02/10/13 03:23, Lukáš Jirkovský wrote:
Previously, the sources in $srcdir were always removed prior building.
After this change the sources are only updated. This makes incremental builds possible. Also this goes in line with the current behaviour for other types of sources, where the sources are just being overwritten without being removed first. ---
Patch seems to be broken:
makepkg: line 586: unexpected EOF while looking for matching ``' makepkg: line 3188: syntax error: unexpected end of file
This is all due to the use of backticks noted below and how they get mangled when using m4.
Oh, right. I tested this on the makepkg that I already had installed on my system, so I didn't catch this one. I'll take a look at it, maybe the pushd is not even necessary.
BTW: should I resubmit this patch immediately after fixing the issue or should I wait for the "Moved dependencies of download functions into a library"?
Good question... Your patch would be easier to merge after the fact. Just submit, I can merge. Allan
On Wed, Oct 9, 2013 at 1:48 PM, Allan McRae <allan@archlinux.org> wrote:
Good question... Your patch would be easier to merge after the fact. Just submit, I can merge.
Allan
OK, submitted. I've also changed the commit message to "Update existing sources instead of removing them first for VCS sources." to make it (hopefully) more clean. Lukas
participants (3)
-
Allan McRae
-
Lukas Jirkovsky
-
Lukáš Jirkovský