This is an automated email from the ASF dual-hosted git repository. the-other-tim-brown pushed a commit to branch release-0.5.0-incubating-rc2 in repository https://gitbox.apache.org/repos/asf/incubator-xtable.git
commit 48b349561f5df1b71d0e851dbbe930f043b6a794 Author: Tim Brown <[email protected]> AuthorDate: Wed Nov 11 20:46:18 2026 -0500 [MINOR] Build the source release with git archive from the RC tag (#1008) * [MINOR] Keep macOS AppleDouble entries out of the source tarball * [MINOR] Build the source release with git archive from the RC tag The source release is now a git archive of the pushed RC tag instead of a clone, rsync and the release manager's tar. Only committed files go in, minus the export-ignore paths in .gitattributes; entries are owned by 0/0 with the commit's mtime, so no macOS AppleDouble entries or xattr headers can appear. - Name the archive apache-xtable-<v>-src.tar.gz, the common ASF pattern. - Refuse to build unless the GitHub tag matches the local tag and pom version. - Tighten the entry check: owners, top-level directory and pax headers. - validate_staged_release.sh takes --local_dir to validate before staging. - validate_source_binary_files.sh uses file --mime; file -I is macOS-only and the check silently passed on Linux. - Release guide: tag first, then build, validate and stage. * [MINOR] Check source release entries only when validating the staged release git archive cannot write AppleDouble entries, xattr headers or non-root owners, so the check after building is redundant. validate_staged_release.sh still runs it on the files staged for the vote. * [MINOR] Inline the source release entry check into validate_staged_release.sh It has a single caller now, so a separate script adds nothing. * [MINOR] Trim the source release change down to what the fix needs Keep main's script and guide structure: only the clone, rsync and tar steps become git fetch of the tag plus git archive, and the guide gets the new name. Drops --local_dir, the KEY_ID option, the guide reorder and the .gitignore entry. * [MINOR] Keep the apache-xtable-<v>.src.tgz source release name The name is not part of the fix; keep the one 0.2.0 to 0.4.0 used. * [MINOR] Create the tag before generating the source release in the guide The source release is built from the pushed tag, so the steps now run in that order. --- ...lidate_source_binary_files.sh => .gitattributes | 23 +++++----- release/release_guide.md | 52 +++++++++++----------- release/scripts/create_source_release.sh | 23 ++++------ release/scripts/validate_source_binary_files.sh | 4 +- release/scripts/validate_staged_release.sh | 24 ++++++++++ 5 files changed, 71 insertions(+), 55 deletions(-) diff --git a/release/scripts/validate_source_binary_files.sh b/.gitattributes old mode 100755 new mode 100644 similarity index 50% copy from release/scripts/validate_source_binary_files.sh copy to .gitattributes index c51c0bf4..d78d9502 --- a/release/scripts/validate_source_binary_files.sh +++ b/.gitattributes @@ -1,4 +1,3 @@ -#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -15,15 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # -set -o errexit -set -o nounset -echo "Checking for binary files in the source files" -numBinaryFiles=`find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' | grep -va 'application/json' | wc -l | sed -e s'/ //g'` - -if [ "$numBinaryFiles" -gt "0" ]; then - echo -e "There were non-text files in source release. [ERROR]\n Please check below\n" - find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/release_guide" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' - exit 1 -fi -echo -e "\t\tNo Binary Files in the source files? - [OK]\n" +# Left out of the source release built by release/scripts/create_source_release.sh +/.asf.yaml export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.github export-ignore +/assets export-ignore +/demo export-ignore +/rfc export-ignore +/style/IDE.png export-ignore +/website export-ignore +/xtable-service/examples export-ignore diff --git a/release/release_guide.md b/release/release_guide.md index 43ebadc5..0ef80e8f 100644 --- a/release/release_guide.md +++ b/release/release_guide.md @@ -168,32 +168,7 @@ The core of the release process is the build-vote-fix cycle. Each cycle produces Set up a few environment variables to simplify Maven commands that follow. This identifies the release candidate being built. Start with RC_NUM equal to 1 and increment it for each candidate. -1. Generate Source Release: This will create the tarball under incubator-xtable/src_release directory - 1. git checkout ${RELEASE_BRANCH} - 2. cd release && ./scripts/create_source_release.sh - > If you have multiple gpg keys(gpg --list-keys), then the signing command will take in the first key most likely. - > You will release this when it asks for a passphrase in a pop up. - > When asked for passphrase, ensure the intended key is the one asked for. - > - > Command used in script: - > - > gpg --armor --detach-sig ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz - > - > To use a specific key: update as follows: // replace FINGERPRINT - > - > gpg --local-user [FINGERPRINT] --armor --detach-sig ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz - 3. Verify Source release is signed and buildable - 1. cd ../src_release - 2. gpg --verify apache-xtable-${RELEASE_VERSION}.src.tgz.asc apache-xtable-${RELEASE_VERSION}.src.tgz - 3. git clone [email protected]:apache/incubator-xtable.git incubator-xtable-tmp-clone && cd incubator-xtable-tmp-clone && git checkout ${RELEASE_BRANCH} && cd .. - 4. tar -zxvf apache-xtable-${RELEASE_VERSION}.src.tgz - 5. diff -qr apache-xtable-${RELEASE_VERSION} incubator-xtable-tmp-clone - 6. Ensure the diff contains only .git, .github, .gitignore, assets, demo, website, rfc, style/IDE.png and xtable-service/examples, all of them only in incubator-xtable-tmp-clone. - 7. cd apache-xtable-${RELEASE_VERSION} && ./mvnw clean package -DskipTests - 8. If they pass, delete the repository we got from the tar-ball - - cd ../ && rm -rf apache-xtable-${RELEASE_VERSION} && rm -rf incubator-xtable-tmp-clone - -2. Create tag +1. Create tag 1. git tag -s release-${RELEASE_VERSION}-rc${RC_NUM} -m "${RELEASE_VERSION}". > If you run into some issues, and if want to re-run the same candidate again from start, ensure you delete existing tags before retrying again. > @@ -217,6 +192,31 @@ Set up a few environment variables to simplify Maven commands that follow. This > > git push origin refs/tags/release-${RELEASE_VERSION}-rc${RC_NUM} +2. Generate Source Release: This will create the tarball under incubator-xtable/src_release directory + 1. git checkout ${RELEASE_BRANCH} + 2. cd release && ./scripts/create_source_release.sh + > If you have multiple gpg keys(gpg --list-keys), then the signing command will take in the first key most likely. + > You will release this when it asks for a passphrase in a pop up. + > When asked for passphrase, ensure the intended key is the one asked for. + > + > Command used in script: + > + > gpg --armor --detach-sig ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz + > + > To use a specific key: update as follows: // replace FINGERPRINT + > + > gpg --local-user [FINGERPRINT] --armor --detach-sig ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz + 3. Verify Source release is signed and buildable + 1. cd ../src_release + 2. gpg --verify apache-xtable-${RELEASE_VERSION}.src.tgz.asc apache-xtable-${RELEASE_VERSION}.src.tgz + 3. git clone [email protected]:apache/incubator-xtable.git incubator-xtable-tmp-clone && cd incubator-xtable-tmp-clone && git checkout ${RELEASE_BRANCH} && cd .. + 4. tar -zxvf apache-xtable-${RELEASE_VERSION}.src.tgz + 5. diff -qr apache-xtable-${RELEASE_VERSION} incubator-xtable-tmp-clone + 6. Ensure the diff contains only .git and the export-ignore paths in .gitattributes, all of them only in incubator-xtable-tmp-clone. + 7. cd apache-xtable-${RELEASE_VERSION} && ./mvnw clean package -DskipTests + 8. If they pass, delete the repository we got from the tar-ball + - cd ../ && rm -rf apache-xtable-${RELEASE_VERSION} && rm -rf incubator-xtable-tmp-clone + 3. [Stage source releases](https://www.apache.org/legal/release-policy.html#stage) on [dist.apache.org](http://dist.apache.org/) 1. If you have not already, check out the xtable section of the dev repository on [dist.apache.org](http://dist.apache.org/) via Subversion. In a fresh directory 2. if you would not checkout, please try svn checkout [https://dist.apache.org/repos/dist/dev/incubator/xtable](https://dist.apache.org/repos/dist/dev/incubator/xtable) again. diff --git a/release/scripts/create_source_release.sh b/release/scripts/create_source_release.sh index 69ddff88..5b08681d 100755 --- a/release/scripts/create_source_release.sh +++ b/release/scripts/create_source_release.sh @@ -46,30 +46,23 @@ cd .. XTABLE_DIR=`pwd` RELEASE_DIR=${XTABLE_DIR}/src_release -CLONE_DIR=${RELEASE_DIR}/incubator-xtable-tmp-clone [email protected]:apache/incubator-xtable.git +GITHUB_REPO_URL=https://github.com/apache/incubator-xtable.git +RELEASE_TAG=release-${RELEASE_VERSION}-rc${RC_NUM} echo "Creating source package" rm -rf ${RELEASE_DIR} mkdir -p ${RELEASE_DIR} -# create a temporary git clone to ensure that we have a pristine source release -git clone ${GITHUB_REPO_URL} ${CLONE_DIR} -cd ${CLONE_DIR} -git checkout release-${RELEASE_VERSION}-rc${RC_NUM} +# Fails if the local tag differs from the pushed one, which voters check against +git fetch ${GITHUB_REPO_URL} tag ${RELEASE_TAG} -rsync -a \ - --exclude ".git" --exclude ".gitignore" --exclude ".gitattributes" --exclude ".travis.yml" \ - --exclude ".github" --exclude "target" --exclude ".idea" --exclude "*.iml" --exclude ".DS_Store" \ - --exclude "build-target" --exclude ".rubydeps" --exclude "rfc" --exclude "docker/images" \ - --exclude "assets" --exclude "demo" --exclude "website" --exclude "style/IDE.png" \ - --exclude "xtable-service/examples" . apache-xtable-$RELEASE_VERSION - -tar czf ${RELEASE_DIR}/apache-xtable-${RELEASE_VERSION}.src.tgz apache-xtable-$RELEASE_VERSION +# Only committed files minus export-ignore paths in .gitattributes, owned by 0/0 with +# the commit's mtime, so the archive does not depend on the machine that builds it +git -c tar.umask=0022 archive --format=tar --prefix=apache-xtable-${RELEASE_VERSION}/ ${RELEASE_TAG} \ + | gzip -9 --no-name > ${RELEASE_DIR}/apache-xtable-${RELEASE_VERSION}.src.tgz gpg --armor --detach-sig ${RELEASE_DIR}/apache-xtable-${RELEASE_VERSION}.src.tgz cd ${RELEASE_DIR} shasum -a 512 apache-xtable-${RELEASE_VERSION}.src.tgz > apache-xtable-${RELEASE_VERSION}.src.tgz.sha512 cd ${CURR_DIR} -rm -rf ${CLONE_DIR} diff --git a/release/scripts/validate_source_binary_files.sh b/release/scripts/validate_source_binary_files.sh index c51c0bf4..3abd3686 100755 --- a/release/scripts/validate_source_binary_files.sh +++ b/release/scripts/validate_source_binary_files.sh @@ -19,11 +19,11 @@ set -o errexit set -o nounset echo "Checking for binary files in the source files" -numBinaryFiles=`find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' | grep -va 'application/json' | wc -l | sed -e s'/ //g'` +numBinaryFiles=`find . -iname '*' | xargs -I {} file --mime {} | grep -va directory | grep -v "release/" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' | grep -va 'application/json' | wc -l | sed -e s'/ //g'` if [ "$numBinaryFiles" -gt "0" ]; then echo -e "There were non-text files in source release. [ERROR]\n Please check below\n" - find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/release_guide" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' + find . -iname '*' | xargs -I {} file --mime {} | grep -va directory | grep -v "release/release_guide" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' exit 1 fi echo -e "\t\tNo Binary Files in the source files? - [OK]\n" diff --git a/release/scripts/validate_staged_release.sh b/release/scripts/validate_staged_release.sh index 389428a9..ff41650a 100755 --- a/release/scripts/validate_staged_release.sh +++ b/release/scripts/validate_staged_release.sh @@ -115,6 +115,30 @@ curl https://dist.apache.org/repos/dist/dev/incubator/xtable/KEYS > ../KEYS echo "Checking Signature" (bash -c "gpg --import ../KEYS $REDIRECT" && bash -c "gpg --verify apache-xtable-${RELEASE_VERSION}.src.tgz.asc apache-xtable-${RELEASE_VERSION}.src.tgz $REDIRECT" && echo -e "\t\tSignature Check - [OK]\n") || (echo -e "\t\tSignature Check - [ERROR]\n\t\t Run with --verbose to get details\n" && exit 1) +# Reads the archive directly: macOS tar hides ._* entries when listing or extracting +echo "Checking the entries of apache-xtable-${RELEASE_VERSION}.src.tgz" +python3 -I - apache-xtable-${RELEASE_VERSION}.src.tgz apache-xtable-${RELEASE_VERSION} <<'PY' +import sys, tarfile +archive, top = sys.argv[1], sys.argv[2] +# git archive writes the commit id as a global "comment" header; tars that copy +# extended attributes add SCHILY.xattr.* or LIBARCHIVE.xattr.* keys +allowed_pax = {"comment", "path", "linkpath", "size", "mtime", "uid", "gid", "uname", "gname"} +problems = [] +for m in tarfile.open(archive).getmembers(): + base = m.name.rstrip("/").rsplit("/", 1)[-1] + if base.startswith("._") or base in (".DS_Store", "__MACOSX"): + problems.append(f"{m.name}: macOS metadata") + if m.name != top and not m.name.startswith(top + "/") or ".." in m.name.split("/"): + problems.append(f"{m.name}: outside {top}/") + if (m.uid, m.gid) != (0, 0): + problems.append(f"{m.name}: owner {m.uid}/{m.gid}") + if set(m.pax_headers) - allowed_pax: + problems.append(f"{m.name}: pax headers {sorted(set(m.pax_headers) - allowed_pax)}") +if problems: + sys.exit(f"\t\t{len(problems)} bad entries, e.g. {problems[:3]} [ERROR]") +PY +echo -e "\t\tArchive entries clean? - [OK]\n" + # Untar (bash -c "tar -zxf apache-xtable-${RELEASE_VERSION}.src.tgz $REDIRECT") || (echo -e "\t\t Unable to untar apache-xtable-${RELEASE_VERSION}.src.tgz - [ERROR]\n\t\t Please run with --verbose to get details\n" && exit 1) cd apache-xtable-${RELEASE_VERSION}
