Add find-recipe.sh, move changelog.sh to scripts

This commit is contained in:
Jeremy Soller 2023-02-25 09:32:19 -07:00
parent bbeb98c7e9
commit 1156bf27e6
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
2 changed files with 91 additions and 0 deletions

49
scripts/changelog.sh Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -e
LAST_RELEASE_TAG="$(git describe --tags --abbrev=0)"
LAST_RELEASE_TIMESTAMP="$(git log --format="%ct" -1 "${LAST_RELEASE_TAG}")"
echo "Last release: ${LAST_RELEASE_TAG} at ${LAST_RELEASE_TIMESTAMP}"
REPOS=(
redox=.
cookbook=cookbook
rust=rust
)
for package in $(installer/target/release/redox_installer --list-packages -c config/x86_64/desktop.toml)
do
REPOS+=("${package}=cookbook/recipes/${package}/source")
done
# TODO: resolve dependencies instead of manually adding these initfs packages
for package in init logd nulld ramfs randd zerod
do
REPOS+=("${package}=cookbook/recipes/${package}/source")
done
for name_repo in "${REPOS[@]}"
do
name="$(echo "${name_repo}" | cut -d "=" -f 1)"
repo="$(echo "${name_repo}" | cut -d "=" -f 2-)"
echo -en "\x1B[1m${name}:\x1B[0m "
if [ -e "${repo}/.git" ]
then
remote="$(git -C "${repo}" remote get-url origin)"
website="${remote%.*}"
before="$(git -C "${repo}" log --until="${LAST_RELEASE_TIMESTAMP}" --format="%h" -1)"
after="$(git -C "${repo}" log --since="${LAST_RELEASE_TIMESTAMP}" --format="%h" -1)"
if [ -z "${before}" ]
then
echo "New repository at ${website}"
elif [ -z "${after}" ]
then
echo "No changes"
else
echo "${website}/-/compare/${before}...${after}"
fi
else
echo "Not a git repository"
fi
done

42
scripts/find-recipe.sh Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Ensure arch and config are set as desired, we use these to find the build dir
export ARCH=x86_64
export CONFIG_NAME=desktop
# Make sure to unmount the image first
make unmount &>/dev/null || true
# Mount the image
make mount >/dev/null
# Find all files
find "build/${ARCH}/${CONFIG_NAME}/" -type f | cut -d / -f5- |\
sort |\
uniq |\
while read path
do
# Skip empty paths
if [ -z "${path}" ]
then
continue
fi
# Find all packages providing this file
pkgs="$(
find cookbook/recipes/*"/target/${ARCH}-unknown-redox/stage/${path}" -type f 2>/dev/null |
cut -d/ -f3 |
tr '\n' ' ' |
sort |
uniq
)"
if [ -n "${pkgs}" ]
then
echo "$path: ${pkgs}"
else
echo "$path: no packages, see config/${ARCH}/${CONFIG_NAME}.toml"
fi
done
# Make sure to unmount the image
make unmount &>/dev/null || true