Closed NicoHood closed 7 years ago
Ultimately, this seems like some to fix in SVN, no?
We have lots of outdated PKGBUILDs in svn, yes. They should be deleted if possible. pacman -Sl shows all packages, maybe this can be used as master reference which packages exist and which not?
asp isn't interested in what pacman thinks. It mirrors the SVN repo. Why does this matter to you?
I want to parse all PKGBUILDs of all packages in the official repos.
I cannot just git clone the two svn2git repos, as they contain (as shown above) outdated data sometimes and duplicates (some PKGBUILDs exist in packages and community when they move from [community] to [extra]). Also svn2git always shows the latest commit, used for testing, but not the the normal repos. Asp clones the last tagged release.
So I found your asp tool. What I try to do now is write a script which:
pacman -Sl
preferred over asp list-all
)any
is treated different for asp)asp export
Afterwards I want to parse all packages with my LSD.
For better understanding, this is what I got so far:
#!/bin/bash
#set -x
set -e
export ASPROOT=asp
ARCH="$(uname -m)"
# TODO use pacman -Sl instead of asp for available packages?
#PACKAGES="$(asp list-all 2>/dev/null)"
PACKAGES="$(pacman -Sl)"
PKGBUILD_PATH=PKGBUILDs
asp update
#rm -rf "${PKGBUILD_PATH}"
mkdir -p "${PKGBUILD_PATH}"
cd "${PKGBUILD_PATH}"
while read -r line; do
# Get package data from input line
# Sample: packages/bash
#GIT_REPO="${line%/*}"
#PACKAGE="${line#*/}"
#echo $line
PACKAGE="$(awk '{print $2}' <<< "${line}")"
REPO="$(awk '{print $1}' <<< "${line}")"
# Check package architecture
ARCHES="$(asp list-arches ${PACKAGE} 2>/dev/null)"
PKG_ARCH=""
if [[ "${ARCHES}" == *"any"* ]]; then
PKG_ARCH=any
elif [[ "${ARCHES}" == *"${ARCH}"* ]]; then
PKG_ARCH="${ARCH}"
fi
# Skip packages with invalid arch
if [[ -z "${PKG_ARCH}" ]]; then
echo "Warning: Package ${PACKAGE} not available for arch ${ARCH} or any!"
continue
fi
# Skip packages with invalid repository
#REPO="$(asp list-repos ${PACKAGE} 2>/dev/null)"
if [[ -z "${REPO}" || "$(wc -l <<< "${REPO}")" -ne 1 ]]; then
echo "Warning: Invalid repository for package ${PACKAGE}"
exit
fi
echo "${PACKAGE}, ${REPO}, ${PKG_ARCH}"
asp -a "${PKG_ARCH}" export "${REPO}/${PACKAGE}" || echo "Package already exists"
done <<< "${PACKAGES}"
Well, svn2git is what asp is based on, so it seems odd to suggest that it doesn't have the repo-released packages.
What you're doing seems fine, with pacman -Sl as a starting to.