-
Notifications
You must be signed in to change notification settings - Fork 163
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
Thin repositories #798
base: master
Are you sure you want to change the base?
Thin repositories #798
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,10 @@ Options: | |
-j name -- Run only on the given jail | ||
-k -- When doing testing with -t, don't consider failures as | ||
fatal; don't skip dependent ports on findings. | ||
-m -- minimal repository, only create a repository with the listed | ||
packages, incompatible with -a. | ||
-M -- medium repository, only create a repository with the listed | ||
packages and their runtime dependencies, incompatible with -a. | ||
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My default reaction to new flags in PRs is to suggest or ask if this could be a hook instead. For this particular feature it seems like it could be entirely a hook in |
||
-N -- Do not build package repository when build completed | ||
-n -- Dry-run. Show what will be done, but do not build | ||
any packages. | ||
|
@@ -88,14 +92,16 @@ CLEAN=0 | |
CLEAN_LISTED=0 | ||
DRY_RUN=0 | ||
ALL=0 | ||
THIN_REPO=0 | ||
SMALL_REPO=0 | ||
BUILD_REPO=1 | ||
INTERACTIVE_MODE=0 | ||
OVERLAYS="" | ||
. ${SCRIPTPREFIX}/common.sh | ||
|
||
[ $# -eq 0 ] && usage | ||
|
||
while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do | ||
while getopts "ab:B:CcFf:iIj:J:kmnMNO:p:RrSTtvwz:" FLAG; do | ||
case "${FLAG}" in | ||
a) | ||
ALL=1 | ||
|
@@ -140,6 +146,13 @@ while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do | |
k) | ||
PORTTESTING_FATAL=no | ||
;; | ||
M) | ||
SMALL_REPO=1 | ||
THIN_REPO=1 | ||
;; | ||
m) | ||
THIN_REPO=1 | ||
;; | ||
N) | ||
BUILD_REPO=0 | ||
;; | ||
|
@@ -193,6 +206,12 @@ while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do | |
esac | ||
done | ||
|
||
if [ ${ALL} -eq 1 -a ${SMALL_REPO} -eq 1 ]; then | ||
err 1 "incompatible options: both -a and -M are provided" | ||
fi | ||
if [ ${ALL} -eq 1 -a ${THIN_REPO} -eq 1 ]; then | ||
err 1 "incompatible options: both -a and -m are provided" | ||
fi | ||
if [ ${ALL} -eq 1 -a ${CLEAN_LISTED} -eq 1 ]; then | ||
CLEAN=1 | ||
CLEAN_LISTED=0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2647,6 +2647,12 @@ jail_start() { | |
# do_portbuild_mounts depends on PACKAGES being set. | ||
# May already be set for pkgclean | ||
: ${PACKAGES:=${POUDRIERE_DATA:?}/packages/${MASTERNAME}} | ||
if [ ${SMALL_REPO} -eq 1 ]; then | ||
THIN_EXT=-small | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's confusing that the options are minimal and medium, but the extensions are -thin and -small. At a minimum the documentation should mention this. Ideally things should lineup throughout. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes but minimal and medium are bad names, think and small are nice, but we can't use proper switches for them, I am open to any suggestion for renaming that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should spell out what these are rather than "thin" or "small". Too bad -f/-F is taken as
listed/recursive/runtime don't make me(user) think about what "small" means. p.s. I cringe every time we add any new flag as it complicates the interface and makes it harder to clean up the interface later. |
||
else | ||
THIN_EXT=-thin | ||
fi | ||
: ${THIN_PACKAGES:=${POUDRIERE_DATA:?}/packages/${MASTERNAME}${THIN_EXT}} | ||
mkdir -p "${PACKAGES:?}/" | ||
was_a_bulk_run && stash_packages | ||
do_portbuild_mounts ${tomnt} ${name} ${ptname} ${setname} | ||
|
@@ -7809,15 +7815,69 @@ sign_pkg() { | |
fi | ||
} | ||
|
||
add_pkg_to_repo() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs quotes around pathed vars |
||
local pkgname=$1 | ||
local target=$2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
[ -f ${target}/${pkgname}.${PKG_EXT} ] && return | ||
if [ ${SMALL_REPO} -eq 1 ]; then | ||
for dep in $(injail ${PKG_BIN} info -qd -F /packages/All/${pkgname}.${PKG_EXT}); do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have this information in some metadata files that could avoid the need to use |
||
add_pkg_to_repo ${dep} ${target} | ||
done | ||
fi | ||
cp ${PACKAGES}/All/${pkgname}.${PKG_EXT} ${target}/ | ||
} | ||
|
||
build_thin_repo() { | ||
# Try to be as atomic as possible in recreating the new thin repo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've aggregated some comments for future lines here. I don't think it's important to be atomic here as there is already a mechanism for it on by default.
There's not much reason to disable that feature. We disabled on the cluster systems because pkgsync expects a certain hardlink count. That could be reworked. The way it works is, for example, Lots of ways to go about this but say for this feature we keep the
|
||
mkdir -p ${THIN_PACKAGES}/All.new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if this directory is leftover from a previous build? Should |
||
while mapfile_read_loop "all_pkgs" \ | ||
_pkgname _originspec _rdep _ignore; do | ||
if [ "${_rdep}" = "listed" ] ; then | ||
add_pkg_to_repo ${_pkgname} \ | ||
${THIN_PACKAGES}/All.new | ||
fi | ||
done | ||
Comment on lines
+7833
to
+7839
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if [ ${SMALL_REPO} -eq 1 ]; then | ||
cp ${PACKAGES}/All/pkg-*.txz ${THIN_PACKAGES}/All.new | ||
fi | ||
if [ -d "${THIN_PACKAGES}/Latest" ]; then | ||
rm -rf "${THIN_PACKAGES}/Latest" | ||
if [ ${SMALL_REPO} -eq 1 ]; then | ||
mkdir ${THIN_PACKAGES}/Latest | ||
cp -RP ${PACKAGES}/Latest/pkg.${PKG_EXT} ${THIN_PACKAGES}/Latest | ||
fi | ||
fi | ||
if [ -d "${THIN_PACKAGES}/All" ]; then | ||
mv ${THIN_PACKAGES}/All ${THIN_PACKAGES}/All.old | ||
fi | ||
mv ${THIN_PACKAGES}/All.new ${THIN_PACKAGES}/All | ||
if [ -d "${THIN_PACKAGES}/All" ]; then | ||
rm -rf ${THIN_PACKAGES}/All.old | ||
fi | ||
Comment on lines
+7850
to
+7856
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted earlier I don't think this careful swap is needed, or if it is we should use a symlink anyway. |
||
} | ||
|
||
build_repo() { | ||
local origin | ||
local origin packages | ||
|
||
msg "Creating pkg repository" | ||
if [ ${THIN_REPO} -eq 1 ]; then | ||
msg "Creating thin pkg repository" | ||
packages=${THIN_PACKAGES} | ||
else | ||
msg "Creating pkg repository" | ||
packages=${PACKAGES} | ||
fi | ||
Comment on lines
+7862
to
+7868
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This confuses me as a user. If I do a |
||
[ ${DRY_RUN} -eq 1 ] && return 0 | ||
bset status "pkgrepo:" | ||
ensure_pkg_installed force_extract || \ | ||
err 1 "Unable to extract pkg." | ||
run_hook pkgrepo sign "${PACKAGES}" "${PKG_REPO_SIGNING_KEY}" \ | ||
if [ ${THIN_REPO} -eq 1 ]; then | ||
build_thin_repo | ||
# only overwrite the packages repo with the thin one | ||
# after having extracted pkg because pkg might not | ||
# be on the thin repo | ||
PACKAGES=${THIN_PACKAGES} mount_packages -o ro | ||
fi | ||
run_hook pkgrepo sign "${packages}" "${PKG_REPO_SIGNING_KEY}" \ | ||
"${PKG_REPO_FROM_HOST:-no}" "${PKG_REPO_META_FILE}" | ||
if [ -r "${PKG_REPO_META_FILE:-/nonexistent}" ]; then | ||
PKG_META="-m /tmp/pkgmeta" | ||
|
@@ -7846,14 +7906,14 @@ build_repo() { | |
-o /tmp/packages ${PKG_META} /packages \ | ||
${SIGNING_COMMAND:+signing_command: ${SIGNING_COMMAND}} | ||
fi | ||
cp ${MASTERMNT}/tmp/packages/* ${PACKAGES}/ | ||
cp ${MASTERMNT}/tmp/packages/* ${packages}/ | ||
|
||
# Sign the ports-mgmt/pkg package for bootstrap | ||
if [ -e "${PACKAGES}/Latest/pkg.${PKG_EXT}" ]; then | ||
if [ -e "${packages}/Latest/pkg.${PKG_EXT}" ]; then | ||
if [ -n "${SIGNING_COMMAND}" ]; then | ||
sign_pkg fingerprint "${PACKAGES}/Latest/pkg.${PKG_EXT}" | ||
sign_pkg fingerprint "${packages}/Latest/pkg.${PKG_EXT}" | ||
elif [ -n "${PKG_REPO_SIGNING_KEY}" ]; then | ||
sign_pkg pubkey "${PACKAGES}/Latest/pkg.${PKG_EXT}" | ||
sign_pkg pubkey "${packages}/Latest/pkg.${PKG_EXT}" | ||
fi | ||
fi | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/has/have/
s/built, note/built.\nNote/