[pacman-dev] [PATCH] Autoversion deps upon package creation in makepkg

Dan McGee dpmcgee at gmail.com
Mon Mar 10 20:55:07 EDT 2008


Man, this one has languished for a long time, I'm sorry.

On Thu, Jan 10, 2008 at 7:39 AM, Darwin Bautista <djclue917 at 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 at gmail.com> wrote:
>  > On Dec 26, 2007 8:01 AM, Dan McGee <dpmcgee at 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 at archlinux.org
>  http://archlinux.org/mailman/listinfo/pacman-dev
>




More information about the pacman-dev mailing list