[pacman-dev] [PATCH] Autoversion deps upon package creation in makepkg
Hi all, Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'. I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue. -- Darwin M. Bautista BS Electronics and Communications Engineering University of the Philippines Diliman http://www.darwin.uk.to University of the Philippines Linux Users' Group http://www.uplug.org
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
On Dec 21, 2007 5:21 AM, Xavier <shiningxc@gmail.com> wrote:
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Good call. It's much easier for us to keep track of things in flyspray. I'm conflicted on this idea too. I keep flip-flopping on whether it's good or not. Maybe Dan can weigh in and convince me one way or the other
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Well, I will be unpopular again: 1. First of all, I think that our maintainers should set dependencies by hand, because this autoversion stuff just guarantees that the generated dependency is a satisfier, but it may be too strict (for example currently it generates 'a52dec>=0.7.4-3' from a52dec and maybe simple 'a52dec' or 'a52dec>=0.7' would be enough) 2. Provision dependencies? Bye
On Dec 21, 2007 5:25 PM, Nagy Gabor <ngaba@bibl.u-szeged.hu> wrote:
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Well, I will be unpopular again:
1. First of all, I think that our maintainers should set dependencies by hand, because this autoversion stuff just guarantees that the generated dependency is a satisfier, but it may be too strict (for example currently it generates 'a52dec>=0.7.4-3' from a52dec and maybe simple 'a52dec' or 'a52dec>=0.7' would be enough)
I think it would be a more feasible idea if versioned dependencies were NOT the default. What would others think of something like this?
2. Provision dependencies?
Great point, Nagy. pacman -Q would fail on those (sh, cron, etc). -Dan
On Fri, 2007-12-21 at 18:39 -0600, Dan McGee wrote:
On Dec 21, 2007 5:25 PM, Nagy Gabor <ngaba@bibl.u-szeged.hu> wrote:
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Well, I will be unpopular again:
1. First of all, I think that our maintainers should set dependencies by hand, because this autoversion stuff just guarantees that the generated dependency is a satisfier, but it may be too strict (for example currently it generates 'a52dec>=0.7.4-3' from a52dec and maybe simple 'a52dec' or 'a52dec>=0.7' would be enough)
I agree. Previous versions may still be OK for the package being build.
I think it would be a more feasible idea if versioned dependencies were NOT the default. What would others think of something like this?
I think I would always forget that the feature was there so I don't think it's worth it.
2. Provision dependencies?
Great point, Nagy. pacman -Q would fail on those (sh, cron, etc).
-Dan
k
On Dec 21, 2007 5:25 PM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Well, I will be unpopular again:
1. First of all, I think that our maintainers should set dependencies by hand, because this autoversion stuff just guarantees that the generated dependency is a satisfier, but it may be too strict (for example currently it generates 'a52dec>=0.7.4-3' from a52dec and maybe simple 'a52dec' or 'a52dec>=0.7' would be enough)
I had the thought of including the pkgrel because of qt4's (in [community]) move from /opt/qt4 (4.3.2-1) to /usr (4.3.2-2). But now, come to think of it, it might have been a bad idea after all because those kind of changes doesn't really happen in every package release. Anyway, the pkgrel can be dropped so that it isn't too strict and autoversioning can be off by default. Also, the packager can override the autoversion behavior by explicitly specifying the required versions. I just thought that it would be simpler (KIS) and better if the "real" versions of dependencies are included in a package. For instance, a52dec>=0.7.4 instead of just a52dec>=0.7 (what if there's a soname change? Just a whatif/caveat even though .4 is just a minor/maintenance release). -- Darwin M. Bautista BS Electronics and Communications Engineering University of the Philippines Diliman http://www.darwin.uk.to University of the Philippines Linux Users' Group http://www.uplug.org
On Dec 26, 2007 3:33 AM, Darwin Bautista <djclue917@gmail.com> wrote:
On Dec 21, 2007 5:25 PM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
On Sun, Dec 02, 2007 at 11:53:00AM +0800, Darwin Bautista wrote:
Hi all,
Attached is a patch to add "autoversion of dependencies" in makepkg. I think the usage of the term "autoversion" is a little vague but I can't of any other term. Anyway, autoversioning will save package maintainers a lot of time in adding and bumping the minimum required versions of a certain package's dependencies directly in the PKGBUILD. Of course, this autoversioning can be overridden by directly specifying the minimum/maximum (if ever)/exact version of a dep. Autoversioning can be disabled by using these opts: '-v' or '--nodepsver'.
I've seen quite a lot of packages (extra, community) which have "out-dated" or wrong minimum versions of the deps. For instance, I've seen a package (which I can't remember) of a KDE app built against KDE 3.5.8 yet the specified minimum version is 3.5.7 (or older?). This can help prevent bugs resulting from this seemingly subtle issue.
Hm I hoped someone would reply to this. I thought it might be interesting, but I don't really know. Could you please file this as a feature request on flyspray? A mail on the ML is likely to be forgotten rapidly, while a feature request would stay there.
Well, I will be unpopular again:
1. First of all, I think that our maintainers should set dependencies by hand, because this autoversion stuff just guarantees that the generated dependency is a satisfier, but it may be too strict (for example currently it generates 'a52dec>=0.7.4-3' from a52dec and maybe simple 'a52dec' or 'a52dec>=0.7' would be enough)
I had the thought of including the pkgrel because of qt4's (in [community]) move from /opt/qt4 (4.3.2-1) to /usr (4.3.2-2). But now, come to think of it, it might have been a bad idea after all because those kind of changes doesn't really happen in every package release. Anyway, the pkgrel can be dropped so that it isn't too strict and autoversioning can be off by default.
Also, the packager can override the autoversion behavior by explicitly specifying the required versions. I just thought that it would be simpler (KIS) and better if the "real" versions of dependencies are included in a package. For instance, a52dec>=0.7.4 instead of just a52dec>=0.7 (what if there's a soname change? Just a whatif/caveat even though .4 is just a minor/maintenance release).
Although Arch doesn't recommend it/support it, there would be people out there (me being one of them) that don't upgrade all their packages on a regular basis. Thus, installing one new package would be dragging in a lot more dependencies and such that people may not want upgraded. On that note, I also try and separate makepkg and its functionality from the ideals of Arch Linux, which may clash a bit at times (see the man page moving, removal of docs, etc). I'm a bit weary of defaulting to something that all users of makepkg may not want or use. -Dan
On Dec 26, 2007 8:01 AM, Dan McGee <dpmcgee@gmail.com> wrote:
Although Arch doesn't recommend it/support it, there would be people out there (me being one of them) that don't upgrade all their packages on a regular basis. Thus, installing one new package would be dragging in a lot more dependencies and such that people may not want upgraded.
On that note, I also try and separate makepkg and its functionality from the ideals of Arch Linux, which may clash a bit at times (see the man page moving, removal of docs, etc). I'm a bit weary of defaulting to something that all users of makepkg may not want or use.
I have to agree with Dan here. Maybe if this patch were implemented as an option=() or something I could agree with it, but as a default, it seems a bit overboard.
From 8aa0a4560e7eb5970b35a509a4519455735ccb92 Mon Sep 17 00:00:00 2001 From: Darwin Bautista <djclue917_at_gmail.com> Date: Thu, 10 Jan 2008 20:26:16 +0800 Subject: [PATCH] Automatically include a '>=' version requirement for the dependencies.
This option would only affect dependencies which have no explicitly-defined version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3'). Signed-off-by: Darwin Bautista <djclue917_at_gmail.com> --- doc/makepkg.8.txt | 6 ++++ scripts/makepkg.sh.in | 69 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 689556d..f3c1505 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -94,6 +94,12 @@ Options Read the package script `buildscript` instead of the `PKGBUILD` default; see linkman:PKGBUILD[5]. +*-v, \--versiondeps*:: + Automatically include a '>=' version requirement for the dependencies. + This option would only affect dependencies which have no explicitly-defined + version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') + would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3') + *-r, \--rmdeps*:: Upon successful build, remove any dependencies installed by makepkg during dependency auto-resolution (using `-b` or `-s`). diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5dbfb88..32fb051 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -53,6 +53,7 @@ NOBUILD=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 +VERSIONDEPS=0 REPKG=0 LOGGING=0 SOURCEONLY=0 @@ -439,6 +440,29 @@ remove_deps() { fi } +version_dep() { + local dep="$*" + local depver ret + + if [ -z "$(echo $dep | grep -E '<|=|>')" ]; then + depver="$(pacman -Q $dep | cut -d' ' -f2 | cut -d'-' -f1)" + ret=$? + + if [ $ret -ne 0 ]; then + error "$(gettext "Pacman returned a fatal error (%i): %s")" "$ret" "$depver" + exit 1 + fi + + if [ -n "$depver" ]; then + echo "$dep>=$depver" + else + echo "$dep" + fi + else + echo "$dep" + fi +} + download_sources() { msg "$(gettext "Retrieving Sources...")" @@ -815,6 +839,7 @@ create_package() { echo "group = $it" >>.PKGINFO done for it in "${depends[@]}"; do + [ "$VERSIONDEPS" = "1" ] && it=$(version_dep $it) echo "depend = $it" >>.PKGINFO done for it in "${optdepends[@]}"; do @@ -1051,26 +1076,27 @@ usage() { printf "$(gettext "Usage: %s [options]")\n" "$0" echo echo "$(gettext "Options:")" - printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" - echo "$(gettext " -b, --builddeps Build missing dependencies from source")" - echo "$(gettext " -c, --clean Clean up work files after build")" - echo "$(gettext " -C, --cleancache Clean up source files from the cache")" - echo "$(gettext " -d, --nodeps Skip all dependency checks")" - echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" - echo "$(gettext " -f, --force Overwrite existing package")" - echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" - echo "$(gettext " -h, --help This help")" - echo "$(gettext " -i, --install Install package after successful build")" - echo "$(gettext " -L, --log Log package build process")" - echo "$(gettext " -m, --nocolor Disable colorized output messages")" - echo "$(gettext " -o, --nobuild Download and extract files only")" - printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" - echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" + printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" + echo "$(gettext " -b, --builddeps Build missing dependencies from source")" + echo "$(gettext " -c, --clean Clean up work files after build")" + echo "$(gettext " -C, --cleancache Clean up source files from the cache")" + echo "$(gettext " -d, --nodeps Skip all dependency checks")" + echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" + echo "$(gettext " -f, --force Overwrite existing package")" + echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" + echo "$(gettext " -h, --help This help")" + echo "$(gettext " -i, --install Install package after successful build")" + echo "$(gettext " -L, --log Log package build process")" + echo "$(gettext " -m, --nocolor Disable colorized output messages")" + echo "$(gettext " -o, --nobuild Download and extract files only")" + printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" + echo "$(gettext " -v, --versiondeps Automatically include a '>=' version requirement for the dependencies")" + echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" # fix flyspray feature request #2978 - echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" - echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" - echo "$(gettext " --asroot Allow makepkg to run as root user")" - echo "$(gettext " --source Do not build package; generate a source-only tarball")" + echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" + echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" + echo "$(gettext " --asroot Allow makepkg to run as root user")" + echo "$(gettext " --source Do not build package; generate a source-only tarball")" echo echo "$(gettext "These options can be passed to pacman:")" echo @@ -1116,9 +1142,9 @@ SRCDEST=${_SRCDEST:-$SRCDEST} SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined # Parse Command Line Options. -OPT_SHORT="AbcCdefFghiLmop:rRsSV" +OPT_SHORT="AbcCdefFghiLmop:vrRsSV" OPT_LONG="ignorearch,asroot,builddeps,clean,cleancache,nodeps,noextract,force,geninteg,help,install,log" -OPT_LONG="$OPT_LONG,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" +OPT_LONG="$OPT_LONG,nocolor,nobuild,versiondeps,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')" @@ -1151,6 +1177,7 @@ while true; do -m|--nocolor) USE_COLOR='n' ;; -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDSCRIPT=$1 ;; + -v|--versiondeps) VERSIONDEPS=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --source) SOURCEONLY=1 ;; -- 1.5.3.7 On Dec 29, 2007 9:35 PM, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On Dec 26, 2007 8:01 AM, Dan McGee <dpmcgee@gmail.com> wrote:
Although Arch doesn't recommend it/support it, there would be people out there (me being one of them) that don't upgrade all their packages on a regular basis. Thus, installing one new package would be dragging in a lot more dependencies and such that people may not want upgraded.
On that note, I also try and separate makepkg and its functionality from the ideals of Arch Linux, which may clash a bit at times (see the man page moving, removal of docs, etc). I'm a bit weary of defaulting to something that all users of makepkg may not want or use.
I have to agree with Dan here. Maybe if this patch were implemented as an option=() or something I could agree with it, but as a default, it seems a bit overboard.
-- Darwin M. Bautista BS Electronics and Communications Engineering University of the Philippines Diliman http://www.darwin.uk.to University of the Philippines Linux Users' Group http://www.uplug.org
The text formatting apparently got messed up. Sorry about that. Attached patch instead. On Jan 10, 2008 8:39 PM, Darwin Bautista <djclue917@gmail.com> wrote:
From 8aa0a4560e7eb5970b35a509a4519455735ccb92 Mon Sep 17 00:00:00 2001 From: Darwin Bautista <djclue917_at_gmail.com> Date: Thu, 10 Jan 2008 20:26:16 +0800 Subject: [PATCH] Automatically include a '>=' version requirement for the dependencies.
This option would only affect dependencies which have no explicitly-defined version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3').
Signed-off-by: Darwin Bautista <djclue917_at_gmail.com> --- doc/makepkg.8.txt | 6 ++++ scripts/makepkg.sh.in | 69 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 689556d..f3c1505 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -94,6 +94,12 @@ Options Read the package script `buildscript` instead of the `PKGBUILD` default; see linkman:PKGBUILD[5].
+*-v, \--versiondeps*:: + Automatically include a '>=' version requirement for the dependencies. + This option would only affect dependencies which have no explicitly-defined + version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') + would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3') + *-r, \--rmdeps*:: Upon successful build, remove any dependencies installed by makepkg during dependency auto-resolution (using `-b` or `-s`). diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5dbfb88..32fb051 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -53,6 +53,7 @@ NOBUILD=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 +VERSIONDEPS=0 REPKG=0 LOGGING=0 SOURCEONLY=0 @@ -439,6 +440,29 @@ remove_deps() { fi }
+version_dep() { + local dep="$*" + local depver ret + + if [ -z "$(echo $dep | grep -E '<|=|>')" ]; then + depver="$(pacman -Q $dep | cut -d' ' -f2 | cut -d'-' -f1)" + ret=$? + + if [ $ret -ne 0 ]; then + error "$(gettext "Pacman returned a fatal error (%i): %s")" "$ret" "$depver" + exit 1 + fi + + if [ -n "$depver" ]; then + echo "$dep>=$depver" + else + echo "$dep" + fi + else + echo "$dep" + fi +} + download_sources() { msg "$(gettext "Retrieving Sources...")"
@@ -815,6 +839,7 @@ create_package() { echo "group = $it" >>.PKGINFO done for it in "${depends[@]}"; do + [ "$VERSIONDEPS" = "1" ] && it=$(version_dep $it) echo "depend = $it" >>.PKGINFO done for it in "${optdepends[@]}"; do @@ -1051,26 +1076,27 @@ usage() { printf "$(gettext "Usage: %s [options]")\n" "$0" echo echo "$(gettext "Options:")" - printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" - echo "$(gettext " -b, --builddeps Build missing dependencies from source")" - echo "$(gettext " -c, --clean Clean up work files after build")" - echo "$(gettext " -C, --cleancache Clean up source files from the cache")" - echo "$(gettext " -d, --nodeps Skip all dependency checks")" - echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" - echo "$(gettext " -f, --force Overwrite existing package")" - echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" - echo "$(gettext " -h, --help This help")" - echo "$(gettext " -i, --install Install package after successful build")" - echo "$(gettext " -L, --log Log package build process")" - echo "$(gettext " -m, --nocolor Disable colorized output messages")" - echo "$(gettext " -o, --nobuild Download and extract files only")" - printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" - echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" + printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" + echo "$(gettext " -b, --builddeps Build missing dependencies from source")" + echo "$(gettext " -c, --clean Clean up work files after build")" + echo "$(gettext " -C, --cleancache Clean up source files from the cache")" + echo "$(gettext " -d, --nodeps Skip all dependency checks")" + echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" + echo "$(gettext " -f, --force Overwrite existing package")" + echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" + echo "$(gettext " -h, --help This help")" + echo "$(gettext " -i, --install Install package after successful build")" + echo "$(gettext " -L, --log Log package build process")" + echo "$(gettext " -m, --nocolor Disable colorized output messages")" + echo "$(gettext " -o, --nobuild Download and extract files only")" + printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" + echo "$(gettext " -v, --versiondeps Automatically include a '>=' version requirement for the dependencies")" + echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" # fix flyspray feature request #2978 - echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" - echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" - echo "$(gettext " --asroot Allow makepkg to run as root user")" - echo "$(gettext " --source Do not build package; generate a source-only tarball")" + echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" + echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" + echo "$(gettext " --asroot Allow makepkg to run as root user")" + echo "$(gettext " --source Do not build package; generate a source-only tarball")" echo echo "$(gettext "These options can be passed to pacman:")" echo @@ -1116,9 +1142,9 @@ SRCDEST=${_SRCDEST:-$SRCDEST} SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
# Parse Command Line Options. -OPT_SHORT="AbcCdefFghiLmop:rRsSV" +OPT_SHORT="AbcCdefFghiLmop:vrRsSV" OPT_LONG="ignorearch,asroot,builddeps,clean,cleancache,nodeps,noextract,force,geninteg,help,install,log" -OPT_LONG="$OPT_LONG,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" +OPT_LONG="$OPT_LONG,nocolor,nobuild,versiondeps,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')" @@ -1151,6 +1177,7 @@ while true; do -m|--nocolor) USE_COLOR='n' ;; -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDSCRIPT=$1 ;; + -v|--versiondeps) VERSIONDEPS=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --source) SOURCEONLY=1 ;; -- 1.5.3.7
On Dec 29, 2007 9:35 PM, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On Dec 26, 2007 8:01 AM, Dan McGee <dpmcgee@gmail.com> wrote:
Although Arch doesn't recommend it/support it, there would be people out there (me being one of them) that don't upgrade all their packages on a regular basis. Thus, installing one new package would be dragging in a lot more dependencies and such that people may not want upgraded.
On that note, I also try and separate makepkg and its functionality from the ideals of Arch Linux, which may clash a bit at times (see the man page moving, removal of docs, etc). I'm a bit weary of defaulting to something that all users of makepkg may not want or use.
I have to agree with Dan here. Maybe if this patch were implemented as an option=() or something I could agree with it, but as a default, it seems a bit overboard.
-- Darwin M. Bautista BS Electronics and Communications Engineering University of the Philippines Diliman http://www.darwin.uk.to University of the Philippines Linux Users' Group http://www.uplug.org
Man, this one has languished for a long time, I'm sorry. On Thu, Jan 10, 2008 at 7:39 AM, Darwin Bautista <djclue917@gmail.com> wrote:
From 8aa0a4560e7eb5970b35a509a4519455735ccb92 Mon Sep 17 00:00:00 2001 From: Darwin Bautista <djclue917_at_gmail.com> Date: Thu, 10 Jan 2008 20:26:16 +0800 Subject: [PATCH] Automatically include a '>=' version requirement for the dependencies.
This option would only affect dependencies which have no explicitly-defined version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3').
Signed-off-by: Darwin Bautista <djclue917_at_gmail.com> --- doc/makepkg.8.txt | 6 ++++ scripts/makepkg.sh.in | 69 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 689556d..f3c1505 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -94,6 +94,12 @@ Options Read the package script `buildscript` instead of the `PKGBUILD` default; see linkman:PKGBUILD[5].
+*-v, \--versiondeps*:: + Automatically include a '>=' version requirement for the dependencies. + This option would only affect dependencies which have no explicitly-defined + version requirement. For instance, depends=('pacman<3.0.0' 'gtk2') + would "become" depends=('pacman<3.0.0' 'gtk2>=2.12.3') + *-r, \--rmdeps*:: Upon successful build, remove any dependencies installed by makepkg during dependency auto-resolution (using `-b` or `-s`). diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5dbfb88..32fb051 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -53,6 +53,7 @@ NOBUILD=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 +VERSIONDEPS=0 REPKG=0 LOGGING=0 SOURCEONLY=0 @@ -439,6 +440,29 @@ remove_deps() { fi }
+version_dep() { + local dep="$*" + local depver ret + + if [ -z "$(echo $dep | grep -E '<|=|>')" ]; then + depver="$(pacman -Q $dep | cut -d' ' -f2 | cut -d'-' -f1)" + ret=$? + + if [ $ret -ne 0 ]; then + error "$(gettext "Pacman returned a fatal error (%i): %s")" "$ret" "$depver" + exit 1 + fi + + if [ -n "$depver" ]; then + echo "$dep>=$depver" + else + echo "$dep" + fi + else + echo "$dep" + fi +} +
Looks pretty good, although I'm not sure I would ever use this.
download_sources() { msg "$(gettext "Retrieving Sources...")"
@@ -815,6 +839,7 @@ create_package() { echo "group = $it" >>.PKGINFO done for it in "${depends[@]}"; do + [ "$VERSIONDEPS" = "1" ] && it=$(version_dep $it) echo "depend = $it" >>.PKGINFO So let me make sure I am correct here- the PKGBUILD itself will never reflect the versioned deps, but the built package will? A short blurb on this in the manpage would be awesome
done for it in "${optdepends[@]}"; do @@ -1051,26 +1076,27 @@ usage() { printf "$(gettext "Usage: %s [options]")\n" "$0" echo echo "$(gettext "Options:")" - printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" - echo "$(gettext " -b, --builddeps Build missing dependencies from source")" - echo "$(gettext " -c, --clean Clean up work files after build")" - echo "$(gettext " -C, --cleancache Clean up source files from the cache")" - echo "$(gettext " -d, --nodeps Skip all dependency checks")" - echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" - echo "$(gettext " -f, --force Overwrite existing package")" - echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" - echo "$(gettext " -h, --help This help")" - echo "$(gettext " -i, --install Install package after successful build")" - echo "$(gettext " -L, --log Log package build process")" - echo "$(gettext " -m, --nocolor Disable colorized output messages")" - echo "$(gettext " -o, --nobuild Download and extract files only")" - printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" - echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" + printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" + echo "$(gettext " -b, --builddeps Build missing dependencies from source")" + echo "$(gettext " -c, --clean Clean up work files after build")" + echo "$(gettext " -C, --cleancache Clean up source files from the cache")" + echo "$(gettext " -d, --nodeps Skip all dependency checks")" + echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" + echo "$(gettext " -f, --force Overwrite existing package")" + echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" + echo "$(gettext " -h, --help This help")" + echo "$(gettext " -i, --install Install package after successful build")" + echo "$(gettext " -L, --log Log package build process")" + echo "$(gettext " -m, --nocolor Disable colorized output messages")" + echo "$(gettext " -o, --nobuild Download and extract files only")" + printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" + echo "$(gettext " -v, --versiondeps Automatically include a '>=' version requirement for the dependencies")" + echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" # fix flyspray feature request #2978 - echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" - echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" - echo "$(gettext " --asroot Allow makepkg to run as root user")" - echo "$(gettext " --source Do not build package; generate a source-only tarball")" + echo "$(gettext " -R, --repackage Repackage contents of pkg/ without building")" + echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" + echo "$(gettext " --asroot Allow makepkg to run as root user")" + echo "$(gettext " --source Do not build package; generate a source-only tarball")"
Gotta get rid of all these changes here, not sure what happened. Can't tell what your change was. I'm also more apt to include this if it doesn't use -v for a shortopt, I'd rather it only use --versiondeps with no short version. -v is universal for verbose, so that would get confusing.
echo echo "$(gettext "These options can be passed to pacman:")" echo @@ -1116,9 +1142,9 @@ SRCDEST=${_SRCDEST:-$SRCDEST} SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
# Parse Command Line Options. -OPT_SHORT="AbcCdefFghiLmop:rRsSV" +OPT_SHORT="AbcCdefFghiLmop:vrRsSV" OPT_LONG="ignorearch,asroot,builddeps,clean,cleancache,nodeps,noextract,force,geninteg,help,install,log" -OPT_LONG="$OPT_LONG,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" +OPT_LONG="$OPT_LONG,nocolor,nobuild,versiondeps,rmdeps,repackage,source,syncdeps,usesudo,version,forcever:" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')" @@ -1151,6 +1177,7 @@ while true; do -m|--nocolor) USE_COLOR='n' ;; -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDSCRIPT=$1 ;; + -v|--versiondeps) VERSIONDEPS=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --source) SOURCEONLY=1 ;; -- 1.5.3.7
On Dec 29, 2007 9:35 PM, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On Dec 26, 2007 8:01 AM, Dan McGee <dpmcgee@gmail.com> wrote:
Although Arch doesn't recommend it/support it, there would be people out there (me being one of them) that don't upgrade all their packages on a regular basis. Thus, installing one new package would be dragging in a lot more dependencies and such that people may not want upgraded.
On that note, I also try and separate makepkg and its functionality from the ideals of Arch Linux, which may clash a bit at times (see the man page moving, removal of docs, etc). I'm a bit weary of defaulting to something that all users of makepkg may not want or use.
I have to agree with Dan here. Maybe if this patch were implemented as an option=() or something I could agree with it, but as a default, it seems a bit overboard.
-- Darwin M. Bautista BS Electronics and Communications Engineering University of the Philippines Diliman http://www.darwin.uk.to
University of the Philippines Linux Users' Group http://www.uplug.org
_______________________________________________
pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev
participants (6)
-
Aaron Griffin
-
Dan McGee
-
Darwin Bautista
-
K. Piche
-
Nagy Gabor
-
Xavier