- my $pkg = $feed{$feed->[1]}->{$name} or return 1;
- $pkg->{name} or do {
- $installed{$name} and return 0;
- # TODO: check if this is an alias package, maybe it's known by another name
- warn "WARNING: Package '$name' is not available in feed $feed->[1].\n";
- return 0;
- };
- my $src = $pkg->{src};
- my $type = $feed->[0];
- $src or $src = $name;
-
- # previously installed packages set the runtime package
- # newly installed packages set the source package to 1
- $installed{$src} and $installed{$src} == 1 and return 0;
-
- # we'll trigger the override only with the 3 conditions below:
- # - override is allowed by command line (-f)
- # - a package with the same src exists in the core packages list
- # - the package previously installed is not from a feed
- my $override = 1 if ($force and is_core_package($src) and !$installed{$src}->{feed});
-
- # check previously installed packages
- $installed{$name} and !$override and return 0;
- $installed{$src} = 1;
-
- $override == 1
- and warn "Overriding package '$src'\n"
- or warn "Installing package '$src'\n";
-
- $install_method{$type} or do {
- warn "Unknown installation method: '$type'\n";
- return 1;
- };
+ # enable force flag if feed src line was declared with --force
+ if (exists($feed->[3]{force})) {
+ $force = 1;
+ }
+
+ # If it's a core package and we don't want to override, just return
+ my $override = 0;
+ if (is_core_src($name)) {
+ return 0 unless $force;
+ $override = 1;
+ }
+
+ if ($installed{$name}) {
+ # newly installed packages set the source package to 1
+ return 0 if ($installed{$name} == 1);
+ return 0 unless ($override);
+ }