[pacman-dev] [PATCH] makepkg: reword purge message
Clarfiy that it is unwanted files are being removed rather than "other" files (whatever they are...). Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 0639fbd..01206d1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -856,7 +856,7 @@ tidy_install() { fi if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then - msg2 "$(gettext "Purging other files...")" + msg2 "$(gettext "Purging unwanted files...")" local pt for pt in "${PURGE_TARGETS[@]}"; do if [[ ${pt} = ${pt//\/} ]]; then -- 1.7.5.4
Fix failure at man page generation when building outside the source tree. There may still be issues with other documenation types... Signed-off-by: Allan McRae <allan@archlinux.org> --- doc/Makefile.am | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index bc0244c..4fb5780 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -101,7 +101,7 @@ website: html pkgdatadir = ${datadir}/${PACKAGE} ASCIIDOC_OPTS = \ - -f asciidoc.conf \ + -f $(srcdir)/asciidoc.conf \ -a pacman_version="$(REAL_PACKAGE_VERSION)" \ -a pacman_date="`date +%Y-%m-%d`" \ -a pkgdatadir=$(pkgdatadir) \ @@ -112,11 +112,12 @@ A2X_OPTS = \ --no-xmllint \ -d manpage \ -f manpage \ - --xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0' + --xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0' \ + --destination-dir='./' # These rules are due to the includes and files of the asciidoc text $(ASCIIDOC_MANS): asciidoc.conf footer.txt - a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt + a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt %.html: %.txt asciidoc $(ASCIIDOC_OPTS) $*.txt -- 1.7.5.4
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae <allan@archlinux.org> wrote:
Fix failure at man page generation when building outside the source tree. There may still be issues with other documenation types...
Other then spellcheck, this looks great- I applied it to maint too.
Provide consistent error messages for unknown long and short options. Also get full string translation for the messages. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/library/parse_options.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/library/parse_options.sh b/scripts/library/parse_options.sh index 32aa0be..8057c28 100644 --- a/scripts/library/parse_options.sh +++ b/scripts/library/parse_options.sh @@ -25,7 +25,7 @@ parse_options() { shift printf " '%s'" "$1" else - echo "@SCRIPTNAME@: option '$1' $(gettext "requires an argument")" >&2 + printf "@SCRIPTNAME@: $(gettext "option %s requires an argument")" "'$1'" >&2 ret=1 fi fi @@ -50,7 +50,7 @@ parse_options() { shift printf " '%s'" "${1}" else - echo "@SCRIPTNAME@: option $(gettext "requires an argument") -- '${1:i:1}'" >&2 + printf "@SCRIPTNAME@: $(gettext "option %s requires an argument")" "'-${1:i:1}'" >&2 ret=1 fi fi @@ -59,7 +59,7 @@ parse_options() { printf ' -%s' "${1:i:1}" fi else - echo "@SCRIPTNAME@: $(gettext "invalid option") -- '${1:i:1}'" >&2 + echo "@SCRIPTNAME@: $(gettext "unrecognized option") '-${1:i:1}'" >&2 ret=1 fi done -- 1.7.5.4
We no longer have any python scripts in our scripts/ directory so we can simplify the makefile a bit. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/Makefile.am | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 1abf9c4..1a9840d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -29,7 +29,7 @@ LIBRARY = \ library/parse_options.sh # Files that should be removed, but which Automake does not know. -MOSTLYCLEANFILES = $(bin_SCRIPTS) *.tmp +MOSTLYCLEANFILES = $(bin_SCRIPTS) if USE_GIT_VERSION GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//') @@ -62,13 +62,10 @@ edit = sed \ # third 'test' line- make sure one of the two checks succeeded $(OURSCRIPTS): Makefile @echo ' ' GEN $@; - @rm -f $@ $@.tmp - @test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@.tmp || true - @test -f $(srcdir)/$@.py.in && m4 -P -I $(srcdir) $(srcdir)/$@.py.in | $(edit) >$@.tmp || true - @test -f $@.tmp || false - @chmod +x $@.tmp - @chmod a-w $@.tmp - @mv $@.tmp $@ + @rm -f $@ + @test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@ + @chmod +x $@ + @chmod a-w $@ makepkg: \ $(srcdir)/makepkg.sh.in \ -- 1.7.5.4
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs). Signed-off-by: Allan McRae <allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5]. +**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5]. Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`. +**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting + the build location to another folder. + **GPGKEY=**"":: Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's `--key` option. diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 42ae940..d3b7d3d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -54,6 +54,9 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, #-- specify a space-delimited list of hosts running in the DistCC cluster. #DISTCC_HOSTS="" +# +#-- Specify a directory for package building. +#BUILDDIR=/tmp/makepkg ######################################################################### # GLOBAL PACKAGE OPTIONS diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 18df00f..ce8f008 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -41,8 +41,6 @@ myver='@PACKAGE_VERSION@' confdir='@sysconfdir@' BUILDSCRIPT='@BUILDSCRIPT@' startdir="$PWD" -srcdir="$startdir/src" -pkgdir="$startdir/pkg" packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') @@ -1653,6 +1651,7 @@ done [[ -n ${PKGDEST} ]] && _PKGDEST=$(canonicalize_path ${PKGDEST}) [[ -n ${SRCDEST} ]] && _SRCDEST=$(canonicalize_path ${SRCDEST}) [[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST}) +[[ -n ${BUILDDIR} ]] && _BUILDDIR=$(canonicalize_path ${BUILDDIR}) [[ -n ${PKGEXT} ]] && _PKGEXT=${PKGEXT} [[ -n ${SRCEXT} ]] && _SRCEXT=${SRCEXT} [[ -n ${GPGKEY} ]] && _GPGKEY=${GPGKEY} @@ -1700,6 +1699,21 @@ fi readonly ALL_OFF BOLD BLUE GREEN RED YELLOW # override settings with an environment variable for batch processing +BUILDDIR=${_BUILDDIR:-$BUILDDIR} +BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined +if [[ ! -d $BUILDDIR ]]; then + mkdir -p "$BUILDDIR" || + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" + chmod a-s "$BUILDDIR" +fi +if [[ ! -w $BUILDDIR ]]; then + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" + plain "$(gettext "Aborting...")" + exit 1 +fi +srcdir="$BUILDDIR/src" +pkgdir="$BUILDDIR/pkg" + PKGDEST=${_PKGDEST:-$PKGDEST} PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined if [[ ! -w $PKGDEST ]]; then -- 1.7.5.4
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs).
Signed-off-by: Allan McRae <allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5].
+**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5].
Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`.
+**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting "current directory" seems half right (looks like we use "build
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae <allan@archlinux.org> wrote: directory" below?), but it appears we only get this whole bit halfway right anyway: dmcgee@galway ~/projects/arch-repos/libfetch $ makepkg -f -p trunk/PKGBUILD ==> Making package: libfetch 2.33-3 (Wed Jun 15 09:26:08 CDT 2011) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving Sources... ==> ERROR: Makefile was not found in the build directory and is not a URL. Also wondering if it is worth a word of warning here in the manpage stating something like if the package builds without this option but not with this option, the package build script is broken and makes invalid assumptions?
+ the build location to another folder. + **GPGKEY=**"":: Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's `--key` option. diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 42ae940..d3b7d3d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -54,6 +54,9 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, #-- specify a space-delimited list of hosts running in the DistCC cluster. #DISTCC_HOSTS="" +# +#-- Specify a directory for package building. +#BUILDDIR=/tmp/makepkg
######################################################################### # GLOBAL PACKAGE OPTIONS diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 18df00f..ce8f008 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -41,8 +41,6 @@ myver='@PACKAGE_VERSION@' confdir='@sysconfdir@' BUILDSCRIPT='@BUILDSCRIPT@' startdir="$PWD" -srcdir="$startdir/src" -pkgdir="$startdir/pkg"
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') @@ -1653,6 +1651,7 @@ done [[ -n ${PKGDEST} ]] && _PKGDEST=$(canonicalize_path ${PKGDEST}) [[ -n ${SRCDEST} ]] && _SRCDEST=$(canonicalize_path ${SRCDEST}) [[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST}) +[[ -n ${BUILDDIR} ]] && _BUILDDIR=$(canonicalize_path ${BUILDDIR}) [[ -n ${PKGEXT} ]] && _PKGEXT=${PKGEXT} [[ -n ${SRCEXT} ]] && _SRCEXT=${SRCEXT} [[ -n ${GPGKEY} ]] && _GPGKEY=${GPGKEY} @@ -1700,6 +1699,21 @@ fi readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
# override settings with an environment variable for batch processing +BUILDDIR=${_BUILDDIR:-$BUILDDIR} +BUILDDIR=${BUILDDIR:-$startdir} #default to $startdir if undefined +if [[ ! -d $BUILDDIR ]]; then + mkdir -p "$BUILDDIR" || + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" I suppose the bright side here is the message reuse, but could this ever be misleading? Can mkdir fail otherwise?
+ chmod a-s "$BUILDDIR" +fi +if [[ ! -w $BUILDDIR ]]; then + error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" + plain "$(gettext "Aborting...")" + exit 1 +fi +srcdir="$BUILDDIR/src" +pkgdir="$BUILDDIR/pkg" + PKGDEST=${_PKGDEST:-$PKGDEST} PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined if [[ ! -w $PKGDEST ]]; then -- 1.7.5.4
On 16/06/11 00:31, Dan McGee wrote:
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs).
Signed-off-by: Allan McRae<allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5].
+**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5].
Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`.
+**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting "current directory" seems half right (looks like we use "build
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae<allan@archlinux.org> wrote: directory" below?), but it appears we only get this whole bit halfway right anyway:
dmcgee@galway ~/projects/arch-repos/libfetch $ makepkg -f -p trunk/PKGBUILD ==> Making package: libfetch 2.33-3 (Wed Jun 15 09:26:08 CDT 2011) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving Sources... ==> ERROR: Makefile was not found in the build directory and is not a URL.
That is a different issue. The -p options has always been a bit weird with alternative builscripts outside the current path and local source files... I have previously considered restricting this to files in the current directory but have never been sure.
Also wondering if it is worth a word of warning here in the manpage stating something like if the package builds without this option but not with this option, the package build script is broken and makes invalid assumptions?
Yes... This is the first real breakage of $startdir/pkg != $pkgdir (and similar for $srcdir), although only in the case where this option is used. I'm not sure how much that needs documented given we have not equated those values in the man pages for a couple of releases now so something like this could happen. Although...
for i in core extra community; do \ grep -R "\$startdir" /var/abs/$i | cut -f1 -d":" | sort | uniq | wc -l \ done 2 48 221
So not everyone listens...
On 16/06/11 00:31, Dan McGee wrote:
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae<allan@archlinux.org> wrote:
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs).
Signed-off-by: Allan McRae<allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5].
+**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5].
Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`.
+**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting
"current directory" seems half right (looks like we use "build directory" below?), but it appears we only get this whole bit halfway right anyway:
dmcgee@galway ~/projects/arch-repos/libfetch $ makepkg -f -p trunk/PKGBUILD ==> Making package: libfetch 2.33-3 (Wed Jun 15 09:26:08 CDT 2011) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving Sources... ==> ERROR: Makefile was not found in the build directory and is not a URL.
That is a different issue. The -p options has always been a bit weird with alternative builscripts outside the current path and local source files... I have previously considered restricting this to files in the current directory but have never been sure. Yeah, sorry- I didn't mean to imply it was the same issue, only
On Thu, Jun 16, 2011 at 5:12 AM, Allan McRae <allan@archlinux.org> wrote: pointing out the ambiguity of current vs. build directory.
Also wondering if it is worth a word of warning here in the manpage stating something like if the package builds without this option but not with this option, the package build script is broken and makes invalid assumptions?
Yes... This is the first real breakage of $startdir/pkg != $pkgdir (and similar for $srcdir), although only in the case where this option is used. I'm not sure how much that needs documented given we have not equated those values in the man pages for a couple of releases now so something like this could happen.
Although...
for i in core extra community; do \ grep -R "\$startdir" /var/abs/$i | cut -f1 -d":" | sort | uniq | wc -l \ done 2 48 221
So not everyone listens... Exactly what I was worried about, wow.
-Dan
On 20/06/11 15:38, Dan McGee wrote:
On 16/06/11 00:31, Dan McGee wrote:
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae<allan@archlinux.org> wrote:
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs).
Signed-off-by: Allan McRae<allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5].
+**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5].
Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`.
+**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting
"current directory" seems half right (looks like we use "build directory" below?), but it appears we only get this whole bit halfway right anyway:
dmcgee@galway ~/projects/arch-repos/libfetch $ makepkg -f -p trunk/PKGBUILD ==> Making package: libfetch 2.33-3 (Wed Jun 15 09:26:08 CDT 2011) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving Sources... ==> ERROR: Makefile was not found in the build directory and is not a URL.
That is a different issue. The -p options has always been a bit weird with alternative builscripts outside the current path and local source files... I have previously considered restricting this to files in the current directory but have never been sure. Yeah, sorry- I didn't mean to imply it was the same issue, only
On Thu, Jun 16, 2011 at 5:12 AM, Allan McRae<allan@archlinux.org> wrote: pointing out the ambiguity of current vs. build directory.
Also wondering if it is worth a word of warning here in the manpage stating something like if the package builds without this option but not with this option, the package build script is broken and makes invalid assumptions?
Yes... This is the first real breakage of $startdir/pkg != $pkgdir (and similar for $srcdir), although only in the case where this option is used. I'm not sure how much that needs documented given we have not equated those values in the man pages for a couple of releases now so something like this could happen.
Although...
for i in core extra community; do \ grep -R "\$startdir" /var/abs/$i | cut -f1 -d":" | sort | uniq | wc -l \ done 2 48 221
So not everyone listens... Exactly what I was worried about, wow.
Improved wording: **BUILDDIR=**"/path/to/folder":: If this value is not set, packages will by default be built in subdirectories of the directory that makepkg is called from. This option allows setting the build location to another folder. Incorrect use of `$startdir` in a PKGBUILD may cause building with this option to fail. Allan
On Tue, Jun 21, 2011 at 3:31 AM, Allan McRae <allan@archlinux.org> wrote:
On 20/06/11 15:38, Dan McGee wrote:
On Thu, Jun 16, 2011 at 5:12 AM, Allan McRae<allan@archlinux.org> wrote:
On 16/06/11 00:31, Dan McGee wrote:
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae<allan@archlinux.org> wrote:
Add a BUILDDIR variable (which can be overridden in the environment) to specify an alternative location for building the package. This is useful for people who want to build on a different filesystem for improved performance (e.g. tmpfs).
Signed-off-by: Allan McRae<allan@archlinux.org> --- doc/makepkg.8.txt | 3 +++ doc/makepkg.conf.5.txt | 5 +++++ etc/makepkg.conf.in | 3 +++ scripts/makepkg.sh.in | 18 ++++++++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index e61f7ab..f15226a 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -206,6 +206,9 @@ Environment Variables Folder where the downloaded sources will be stored. Overrides the corresponding value defined in linkman:makepkg.conf[5].
+**BUILDDIR=**"/path/to/folder":: + Folder where the package will be built. Overrides the corresponding + value defined in linkman:makepkg.conf[5].
Configuration ------------- diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index fcd2f2a..4db8b92 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -110,6 +110,11 @@ Options running in the DistCC cluster. In addition, you will want to modify your `MAKEFLAGS`.
+**BUILDDIR=**"/path/to/folder":: + If this value is not set, packages will by default be built in the + subdirectories of the current directory. This option allows setting
"current directory" seems half right (looks like we use "build directory" below?), but it appears we only get this whole bit halfway right anyway:
dmcgee@galway ~/projects/arch-repos/libfetch $ makepkg -f -p trunk/PKGBUILD ==> Making package: libfetch 2.33-3 (Wed Jun 15 09:26:08 CDT 2011) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving Sources... ==> ERROR: Makefile was not found in the build directory and is not a URL.
That is a different issue. The -p options has always been a bit weird with alternative builscripts outside the current path and local source files... I have previously considered restricting this to files in the current directory but have never been sure.
Yeah, sorry- I didn't mean to imply it was the same issue, only pointing out the ambiguity of current vs. build directory.
Also wondering if it is worth a word of warning here in the manpage stating something like if the package builds without this option but not with this option, the package build script is broken and makes invalid assumptions?
Yes... This is the first real breakage of $startdir/pkg != $pkgdir (and similar for $srcdir), although only in the case where this option is used. I'm not sure how much that needs documented given we have not equated those values in the man pages for a couple of releases now so something like this could happen.
Although...
for i in core extra community; do
\ grep -R "\$startdir" /var/abs/$i | cut -f1 -d":" | sort | uniq | wc -l \ done 2 48 221
So not everyone listens...
Exactly what I was worried about, wow.
Improved wording:
**BUILDDIR=**"/path/to/folder":: If this value is not set, packages will by default be built in subdirectories of the directory that makepkg is called from. This option allows setting the build location to another folder. Incorrect use of `$startdir` in a PKGBUILD may cause building with this option to fail.
+1 from me. -Dan
Create source package files inside the fakeroot environment to ensure reasonable ownership of files within the archive. Fixes FS#24330. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 65 ++++++++++++++++++++++++++++++------------------- 1 files changed, 40 insertions(+), 25 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ce8f008..60be765 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -186,6 +186,16 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR # 1) "filename::http://path/to/file" # 2) "http://path/to/file" +enter_fakeroot() { + msg "$(gettext "Entering fakeroot environment...")" + + if [[ -n $newpkgver ]]; then + fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $? + else + fakeroot -- $0 -F "${ARGLIST[@]}" || exit $? + fi +} + # Return the absolute filename of a source entry # # This function accepts a source entry or the already extracted filename of a @@ -1143,23 +1153,6 @@ create_signature() { } create_srcpackage() { - cd "$startdir" - - # Get back to our src directory so we can begin with sources. - mkdir -p "$srcdir" - chmod a-s "$srcdir" - cd "$srcdir" - if (( ! SKIPINTEG || SOURCEONLY == 2 )); then - download_sources - fi - if (( ! SKIPINTEG )); then - # We can only check checksums if we have all files. - check_checksums - else - warning "$(gettext "Skipping integrity checks.")" - fi - cd "$startdir" - msg "$(gettext "Creating source package...")" local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)" mkdir "${srclinks}"/${pkgbase} @@ -1951,6 +1944,12 @@ fi # Run the bare minimum in fakeroot if (( INFAKEROOT )); then + if (( SOURCEONLY )); then + create_srcpackage + msg "$(gettext "Leaving fakeroot environment.")" + exit 0 # $E_OK + fi + if (( ! SPLITPKG )); then if (( ! PKGFUNC )); then if (( ! REPKG )); then @@ -1986,7 +1985,29 @@ if (( SOURCEONLY )); then error "$(gettext "A source package has already been built. (use -f to overwrite)")" exit 1 fi - create_srcpackage + + # Get back to our src directory so we can begin with sources. + mkdir -p "$srcdir" + chmod a-s "$srcdir" + cd "$srcdir" + if (( ! SKIPINTEG || SOURCEONLY == 2 )); then + download_sources + fi + if (( ! SKIPINTEG )); then + # We can only check checksums if we have all files. + check_checksums + else + warning "$(gettext "Skipping integrity checks.")" + fi + cd "$startdir" + + # if we are root or if fakeroot is not enabled, then we don't use it + if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then + create_srcpackage + else + enter_fakeroot + fi + msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))" exit 0 fi @@ -2103,13 +2124,7 @@ else cd "$startdir" fi - msg "$(gettext "Entering fakeroot environment...")" - - if [[ -n $newpkgver ]]; then - fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $? - else - fakeroot -- $0 -F "${ARGLIST[@]}" || exit $? - fi + enter_fakeroot fi fi -- 1.7.5.4
On Wed, Jun 15, 2011 at 4:13 AM, Allan McRae <allan@archlinux.org> wrote:
Create source package files inside the fakeroot environment to ensure reasonable ownership of files within the archive.
Fixes FS#24330.
Looks good to me. -Dan
participants (2)
-
Allan McRae
-
Dan McGee