summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-03 11:49:02 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-03 11:49:02 -0400
commite5ef7187c180026ac9f53ffadf5d652eaa54b0dd (patch)
tree8241f758307e65001f4f088355f4338ad9135b3e
parent29c900f5cb4958499463fd4dbf7da8581dfe19a7 (diff)
teach pbs-absrepo-convert how to remember package lists
-rwxr-xr-xpbs-absrepo-convert47
-rwxr-xr-xpbs-absrepo-convert--filterarch2
2 files changed, 42 insertions, 7 deletions
diff --git a/pbs-absrepo-convert b/pbs-absrepo-convert
index 358492d..e69e5ec 100755
--- a/pbs-absrepo-convert
+++ b/pbs-absrepo-convert
@@ -22,7 +22,8 @@ abort() {
# Assumptions:
# - currently in a working copy of the repo
# - git branch "master" exists and is untouched
-# - TMPDIR is set and exists
+# - TMPDIR is set
+# - file(s) exist in "${TMPDIR}/missing-packages.in/"
# Effects:
# - creates file "${TMPDIR}/commits"
# - creates file "${TMPDIR}/find"
@@ -54,6 +55,9 @@ collect-data() {
# extract some things ##################################################
# packages
{
+ if [[ $mode = fast ]]; then
+ cat "${TMPDIR}"/{packages,missing-packages}.in
+ fi
< "${TMPDIR}/find" sed -e 's|^\.||' -e 's|/.*||'
} | sort -u > "${TMPDIR}/packages"
# architectures
@@ -127,7 +131,7 @@ convert-packages() {
# Effects:
# - creates git branch "${ARCH}"
# - TMPDIR is set
-# - creates file "${TMPDIR}/missing-packages.${ARCH}"
+# - creates file "${TMPDIR}/missing-packages/${ARCH}"
# Side effects:
# - changes git working tree
# - prints output of git commands
@@ -136,7 +140,8 @@ convert-arch() {
[[ $# = 1 ]] || { usage; return 1; }
local arch=$1
- touch "${PKGDIR}/missing-packages.${arch}.tmp"
+ mkdir -p "${PKGDIR}/missing-packages"
+ touch "${PKGDIR}/missing-packages/${arch}.tmp"
git checkout orig
git checkout -b "$arch"
@@ -144,9 +149,9 @@ convert-arch() {
"pbs-absrepo-convert--filterarch $arch" "$arch"
sort -u \
- < "${PKGDIR}/missing-packages.${arch}.tmp" \
- > "${PKGDIR}/missing-packages.${arch}"
- rm -f "${PKGDIR}/missing-packages.${arch}.tmp"
+ < "${PKGDIR}/missing-packages/${arch}.tmp" \
+ > "${PKGDIR}/missing-packages/${arch}"
+ rm -f "${PKGDIR}/missing-packages/${arch}.tmp"
}
##
@@ -170,6 +175,26 @@ convert-arches() {
done
}
+##
+# Usage: copy-metatada SOURCEDIR SOURCE FILE
+# Assumptions:
+# - TMPDIR is set
+# Effects:
+# - creates "${TMPDIR}/${FILE}.in"
+##
+copy-metadata() {
+ [[ $# = 3 ]] || { usage; return 1; }
+ local sourcedir=$1
+ local source=$2
+ local file=$3
+
+ if [[ -f "${sourcedir}/${source}.${file}" ]]; then
+ cp "${sourcedir}/${source}.${file}" "${TMPDIR}/${file}.in"
+ else
+ touch "${TMPDIR}/${file}.in"
+ fi
+}
+
main() {
trap abort EXIT
[[ $# = 1 ]] || { usage; return 1; }
@@ -179,6 +204,9 @@ main() {
local sourcedir="$(pbs-plumb-config get core.sourcedir)"
# init #################################################################
+ copy-metadata "$sourcedir" "$source" missing-packages
+ copy-metadata "$sourcedir" "$source" packages
+
msg "$(gettext "Creating working copy...")"
git clone "${cachedir}/${source}.git" "${TMPDIR}/repo"
cd "${TMPDIR}/repo"
@@ -194,6 +222,8 @@ main() {
# save results #########################################################
msg "$(gettext "Copying into source directory...")"
[[ -d "$sourcedir" ]] || mkdir -p "$sourcedir"
+
+ # copy git repo
git clone --mirror "${TMPDIR}/repo" "${sourcedir}/${source}.new.git"
if [[ -d "${sourcedir}/${source}.git" ]]; then
mv "${sourcedir}/${source}"{,.old}.git
@@ -202,6 +232,11 @@ main() {
if [[ ! -d "${sourcedir}/${source}.old.git" ]]; then
rm -rf "${sourcedir}/${source}".old.git
fi
+
+ # copy other data
+ cp -f "${TMPDIR}/packages" "${sourceir}/${source}.packages"
+ cat "${TMPDIR}"/missing-packages/* > "${sourceir}/${source}.missing-packages"
+
trap cleanup EXIT
}
diff --git a/pbs-absrepo-convert--filterarch b/pbs-absrepo-convert--filterarch
index 3118909..4288014 100755
--- a/pbs-absrepo-convert--filterarch
+++ b/pbs-absrepo-convert--filterarch
@@ -29,7 +29,7 @@ cat "$tree" | while read mode type treehash path; do
git checkout "${commithash}"
)
else
- printf '%s\n' "$package" >> "${TMPDIR}/missing-packages.${arch}.tmp"
+ printf '%s\n' "$package" >> "${TMPDIR}/missing-packages/${arch}.tmp"
fi
done