Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore missing packages #2195

Open
vermaden opened this issue Oct 29, 2023 · 4 comments
Open

Ignore missing packages #2195

vermaden opened this issue Oct 29, 2023 · 4 comments
Labels

Comments

@vermaden
Copy link

vermaden commented Oct 29, 2023

How to make pkg(8) ignore not available packages when installing multiple package?

Example:

# pkg install CATEGORY0/PORT0 CATEGORY1/PORT1 CATEGORY2/PORT2
(...)
pkg: No packages available to install matching 'CATEGORY1/PORT1' have been found in the repositories
(...)

As CATEGORY1/PORT1 is not a dependency for either CATEGORY0/PORT0 or CATEGORY2/PORT2 - how to make pkg(8) install both CATEGORY0/PORT0 and CATEGORY2/PORT2 and also ignore that CATEGORY1/PORT1 is not available?

Thanks,
vermaden

@vermaden
Copy link
Author

vermaden commented Oct 29, 2023

I currently overcome that with sed(1) removing the packages that are missing - but that requires 2 pkg(8) runs instead of just 1. One 'dry' run to get missing packages. One 'real' run with only packages that are available.

Solution below.

CHROOT=/var/tmp/14.0-RC2
PACKAGES="
sysutils/automount                                                      
sysutils/beadm
www/asdasdasd
www/bsdbsdbsd"

while read EXCLUDE
do
  [ "${EXCLUDE}" = "" ] && break
  PACKAGES=$( echo ${PACKAGES} | sed s.${EXCLUDE}..g )
done << EOF
$(
  chroot "${CHROOT}" \
    /usr/bin/env ASSUME_ALWAYS_YES=yes pkg install -y --ignore-missing ${PACKAGES} 2>&1 \
      | grep "No packages available to install matching" \
      | awk -F\' '{print $2}'
)
EOF

chroot "${CHROOT}" \
  /usr/bin/env ASSUME_ALWAYS_YES=yes pkg install -y --ignore-missing ${PACKAGES}

Regards,
vermaden

EDIT: Added [ "${EXCLUDE}" = "" ] && break if there are not EXCLUDES (all packages available).

@bapt bapt added the feature label Oct 31, 2023
@bapt
Copy link
Member

bapt commented Oct 31, 2023

I agree having a flag for this will be interesting...

@emaste
Copy link
Member

emaste commented Oct 31, 2023

Or what about something like:

pkg: No packages available to install matching 'CATEGORY1/PORT1' have been found in the repositories
Install other requested packages [Y/n]?

The flag could support yes/no/ask, with default to ask?

@vermaden
Copy link
Author

vermaden commented Nov 1, 2023

@emaste

Default can be ask like with Your proposal above.

I would just suggest if user added -y flag - then yes is assumed and no questions asked.

Regards,
vermaden

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants