Add support to set automatic install flag for srcpkgs.

--HG--
extra : convert_revision : fa0e103ce44a4758858124ecd63aea0dec400720
This commit is contained in:
Juan RP 2009-02-18 00:28:35 +01:00
parent a2e9f7de29
commit 028cacdd2a
5 changed files with 31 additions and 13 deletions

View file

@ -65,6 +65,9 @@ usage(void)
" Options shared by all actions:\n"
" -r\t\t\t<rootdir>\n"
"\n"
" Options used by the register action:\n"
" -a\t\t\tSet automatic installation flag.\n"
"\n"
" Examples:\n"
" $ xbps-pkgdb getpkgname foo-2.0\n"
" $ xbps-pkgdb getpkgversion foo-2.0\n"
@ -82,11 +85,15 @@ main(int argc, char **argv)
prop_dictionary_t dict;
const char *version;
char *plist, *pkgname, *in_chroot_env, *root = NULL;
bool in_chroot = false;
bool automatic = false, in_chroot = false;
int c, rv = 0;
while ((c = getopt(argc, argv, "r:")) != -1) {
while ((c = getopt(argc, argv, "ar:")) != -1) {
switch (c) {
case 'a':
/* Set automatic install flag */
automatic = true;
break;
case 'r':
/* To specify the root directory */
root = strdup(optarg);
@ -123,7 +130,7 @@ main(int argc, char **argv)
usage();
rv = xbps_register_pkg(NULL, argv[1], argv[2],
argv[3], false);
argv[3], automatic);
if (rv == EEXIST) {
printf("%s=> %s-%s already registered.\n",
in_chroot ? "[chroot] " : "", argv[1], argv[2]);

View file

@ -5,7 +5,6 @@ xbps-src:
* Add support to run the prepost-* scripts, so that the same actions are
performed in source/bin packages. Use current postinstall_helpers to
automatically add triggers, shared by src/bin pkgs. [IN PROGRESS]
* Fix the "automatic-install" object in regpkgdb.plist.
Packages:
* fix mpfr hardcoded rpath for gmp.

View file

@ -90,11 +90,11 @@ install_pkg_deps()
else
echo "=> Installing $curpkgname dependency: $j"
jname=$(xbps-pkgdb getpkgname ${j})
install_pkg $jname
install_pkg $jname auto
fi
done
install_pkg $curpkgname
install_pkg $curpkgname auto
}
#
@ -142,7 +142,7 @@ install_dependencies_pkg()
check_build_depends_pkg $i
if [ $? -eq 1 ]; then
msg_normal "Installing $lpkgname dependency: $ipkgname"
install_pkg $ipkgname
install_pkg $ipkgname auto
else
install_pkg_deps $i $pkg
fi
@ -165,7 +165,7 @@ install_builddeps_required_pkg()
if [ $? -ne 0 ]; then
msg_normal "Installing $pkgname dependency: $dep."
depname=$(xbps-pkgdb getpkgname ${dep})
install_pkg $depname
install_pkg $depname auto
fi
done
}

View file

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008 Juan Romero Pardines.
# Copyright (c) 2008-2009 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -30,6 +30,7 @@ install_pkg()
{
local pkg=
local curpkgn="$1"
local automatic="$2"
local cdestdir=
local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn/template"
@ -117,7 +118,7 @@ install_pkg()
#
if [ -z "$install_destdir_target" ]; then
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg $pkg
stow_pkg $pkg $automatic
fi
}

View file

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008 Juan Romero Pardines.
# Copyright (c) 2008-2009 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -30,6 +30,7 @@
stow_pkg()
{
local pkg="$1"
local automatic="$2"
local i=
local destdir=$XBPS_DESTDIR/$pkgname-$version
@ -59,8 +60,16 @@ stow_pkg()
cp -ar ${i} $XBPS_MASTERDIR
done
$XBPS_REGPKGDB_CMD register $pkgname $version "$short_desc"
[ $? -ne 0 ] && exit 1
#
# Register pkg in plist file and add automatic installation
# object if requested.
#
local regpkgdb_flags=
if [ -n "$automatic" ]; then
regpkgdb_flags="-a"
fi
$XBPS_REGPKGDB_CMD $regpkgdb_flags register \
$pkgname $version "$short_desc" || exit 1
#
# Run template postinstall helpers if requested.
@ -129,6 +138,8 @@ unstow_pkg()
# Remove metadata dir.
rm -rf $XBPS_PKGMETADIR/$pkgname
# Unregister pkg from plist file.
$XBPS_REGPKGDB_CMD unregister $pkgname $ver
return $?