summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-08-22 14:04:08 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-08-22 15:40:18 +0200
commit996c0b124b4fdcdf4ded71fb1c4a5bb8e8784f8f (patch)
tree1fc90018372dd501f155e4b48609a8e613087d8a
parent801f7742004139229866b911634679143f2c9404 (diff)
downloaddbscripts-gitpackages.tar.gz
dbscripts-gitpackages.tar.xz
WIP: switch from svn to gitgitpackages
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--db-functions30
-rwxr-xr-xdb-move84
-rwxr-xr-xdb-remove22
-rwxr-xr-xdb-update21
4 files changed, 39 insertions, 118 deletions
diff --git a/db-functions b/db-functions
index ab5d93a..bbbafad 100644
--- a/db-functions
+++ b/db-functions
@@ -331,36 +331,6 @@ check_pkgfile() {
fi
}
-check_pkgsvn() {
- local pkgfile="${1}"
- local _pkgbase="$(getpkgbase ${pkgfile})"
- [ $? -ge 1 ] && return 1
- local _pkgname="$(getpkgname ${pkgfile})"
- [ $? -ge 1 ] && return 1
- local _pkgver="$(getpkgver ${pkgfile})"
- [ $? -ge 1 ] && return 1
- local _pkgarch="$(getpkgarch ${pkgfile})"
- [ $? -ge 1 ] && return 1
- local repo="${2}"
-
- in_array "${repo}" ${PKGREPOS[@]} || return 1
-
- if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then
- mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}"
- svn export -q "${SVNREPO}/${_pkgbase}/repos/${repo}-${_pkgarch}/PKGBUILD" \
- "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null
- [ $? -ge 1 ] && return 1
- fi
-
- local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) )"
- [ "${svnver}" == "${_pkgver}" ] || return 1
-
- local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
- in_array "${_pkgname}" ${svnnames[@]} || return 1
-
- return 0
-}
-
check_splitpkgs() {
local repo="${1}"
shift
diff --git a/db-move b/db-move
index 1a89ded..a1b2693 100755
--- a/db-move
+++ b/db-move
@@ -24,40 +24,6 @@ for pkgarch in ${ARCHES[@]}; do
repo_lock ${repo_from} ${pkgarch} || exit 1
done
-# check if packages to be moved exist in svn and ftp dir
-/usr/bin/svn checkout -q -N "${SVNREPO}" "${WORKDIR}/svn" >/dev/null
-for pkgbase in ${args[@]:2}; do
- /usr/bin/svn up -q "${WORKDIR}/svn/${pkgbase}" >/dev/null
- for pkgarch in ${ARCHES[@]} 'any'; do
- svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}"
- if [ -r "${svnrepo_from}/PKGBUILD" ]; then
- pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
- if [ ${#pkgnames[@]} -lt 1 ]; then
- die "Could not read pkgname"
- fi
-
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
- if [ -z "${pkgver}" ]; then
- die "Could not read pkgver"
- fi
-
- if [ "${pkgarch}" == 'any' ]; then
- tarches=(${ARCHES[@]})
- else
- tarches=("${pkgarch}")
- fi
-
- for pkgname in ${pkgnames[@]}; do
- for tarch in ${tarches[@]}; do
- getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null
- done
- done
- continue 2
- fi
- done
- die "${pkgbase} not found in ${repo_from}"
-done
-
msg "Moving packages from [${repo_from}] to [${repo_to}]..."
declare -A add_pkgs
@@ -65,51 +31,23 @@ declare -A remove_pkgs
for pkgbase in ${args[@]:2}; do
tag_list=""
for pkgarch in ${ARCHES[@]} 'any'; do
- svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}"
- svnrepo_to="${WORKDIR}/svn/${pkgbase}/repos/${repo_to}-${pkgarch}"
+ pkgfile_from="${GITREPO}/${pkgarch}/${repo_from}/${pkgbase}"
+ pkgfile_to="${GITREPO}/${pkgarch}/${repo_to}/${pkgbase}"
- if [ -f "${svnrepo_from}/PKGBUILD" ]; then
- if [ "${pkgarch}" == 'any' ]; then
- tarches=(${ARCHES[@]})
- else
- tarches=("${pkgarch}")
- fi
- msg2 "${pkgbase} ($(echo ${tarches[@]}))"
- pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
-
- if [ -d "${svnrepo_to}" ]; then
- for file in $(/usr/bin/svn ls "${svnrepo_to}"); do
- /usr/bin/svn rm -q "${svnrepo_to}/$file@"
- done
- else
- mkdir "${svnrepo_to}"
- /usr/bin/svn add -q "${svnrepo_to}"
- fi
+ if ! [[ -e "${pkgfile_from}" ]]; then
+ continue
+ fi
- for file in $(svn ls "${svnrepo_from}"); do
- /usr/bin/svn mv -q -r HEAD "${svnrepo_from}/$file@" "${svnrepo_to}/"
- done
- /usr/bin/svn rm --force -q "${svnrepo_from}"
- tag_list="$tag_list, $pkgarch"
+ version="$(cat "${pkgfile_from}")"
- for pkgname in ${pkgnames[@]}; do
- for tarch in ${tarches[@]}; do
- pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT})
- pkgfile="${pkgpath##*/}"
+ cd "${GITREPO}"
+ mkdir -p "${pkgfile_to%/*}"
+ git mv -f "${pkgfile_from}" "${pkgfile_to}"
- ln -s "../../../${PKGPOOL}/${pkgfile}" ${ftppath_to}/${tarch}/
- if [ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]; then
- ln -s "../../../${PKGPOOL}/${pkgfile}.sig" ${ftppath_to}/${tarch}/
- fi
- add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} "
- remove_pkgs[${tarch}]+="${pkgname} "
- done
- done
- fi
+ tag_list="$tag_list, $pkgarch"
done
tag_list="${tag_list#, }"
- /usr/bin/svn commit -q "${WORKDIR}/svn/${pkgbase}" -m "${0##*/}: moved ${pkgbase} from [${repo_from}] to [${repo_to}] (${tag_list})"
+ git commit -m "db-move: ${repo_from} -> ${repo_to} (${tag_list}): ${pkgbase} "
done
for tarch in ${ARCHES[@]}; do
diff --git a/db-remove b/db-remove
index da32c78..37dba35 100755
--- a/db-remove
+++ b/db-remove
@@ -32,18 +32,16 @@ done
remove_pkgs=()
for pkgbase in ${pkgbases[@]}; do
msg "Removing $pkgbase from [$repo]..."
- /usr/bin/svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null
-
- if [ -d "${WORKDIR}/svn/$pkgbase/repos/$svnrepo" ]; then
- remove_pkgs=(${remove_pkgs[@]} $(. "${WORKDIR}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
- /usr/bin/svn rm --force -q "${WORKDIR}/svn/$pkgbase/repos/$svnrepo"
- /usr/bin/svn commit -q "${WORKDIR}/svn/$pkgbase" -m "${0##*/}: $pkgbase removed by $(id -un)"
- else
- warning "$pkgbase not found in $svnrepo"
- warning "Removing only $pkgbase from the repo"
- warning "If it was a split package you have to remove the others yourself!"
- remove_pkgs[${#remove_pkgs[*]}]=$pkgbase
- fi
+
+ pkgfile="${GITREPO}/${arch}/${repo}/${pkgbase}"
+
+ # FIXME: TODO: get pkgnames from package's git repo
+ #remove_pkgs=(${remove_pkgs[@]} $(. "${}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
+ remove_pkgs=$pkgbase
+
+ cd "${GITREPO}"
+ git rm "${pkgfile}"
+ git commit -m "db-remove: ${repo}/${pkgbase} by $(id -un)"
done
for tarch in ${tarches[@]}; do
diff --git a/db-update b/db-update
index 8be0d54..34a01b7 100755
--- a/db-update
+++ b/db-update
@@ -38,9 +38,6 @@ for repo in ${repos[@]}; do
if ${REQUIRE_SIGNATURE} && ! check_pkgsig "${pkg}.sig"; then
die "Package ${repo}/${pkg##*/} does not have a valid signature"
fi
- if ! check_pkgsvn "${pkg}" "${repo}"; then
- die "Package ${repo}/${pkg##*/} is not consistent with svn repository"
- fi
if ! check_pkgrepos "${pkg}"; then
die "Package ${repo}/${pkg##*/} already exists in another repository"
fi
@@ -53,6 +50,9 @@ for repo in ${repos[@]}; do
fi
done
+# TODO: FIXME: check if package has switched between i686/x86_64 and any
+# and remove the older one if it did (commitpkg did this)
+
for repo in ${repos[@]}; do
msg "Updating [${repo}]..."
any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null))
@@ -61,6 +61,10 @@ for repo in ${repos[@]}; do
arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null))
for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do
pkgfile="${pkg##*/}"
+ pkgver="$(getpkgver "$pkg")"
+ pkgbase="$(getpkgbase "$pkg")"
+ pkgname="$(getpkgname "$pkg")"
+
msg2 "${pkgfile} (${pkgarch})"
# any packages might have been moved by the previous run
if [ -f "${pkg}" ]; then
@@ -75,6 +79,17 @@ for repo in ${repos[@]}; do
ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}"
fi
add_pkgs[${#add_pkgs[*]}]=${pkgfile}
+
+ cd "${GITREPO}"
+ versionfile="${GITREPO}/${pkgarch}/${repo}/${pkgbase}"
+ mkdir -p "${versionfile%/*}"
+ echo "${pkgver}" > "${versionfile}"
+ git add "${versionfile}"
+ if [[ "${pkgbase}" == "${pkgname}" ]]; then
+ git commit -m "$repo/$pkgbase $pkgver $pkgarch"
+ else
+ git commit -m "$repo/$pkgbase/$pkgname $pkgver $pkgarch"
+ fi
done
if [ ${#add_pkgs[@]} -ge 1 ]; then
arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]}