theslinux-buildsystem branch _utils updated 5e1b6f8 - obsolete function :convert

  • From: git@xxxxxxxxxxxxxxxxxxxx
  • To: theslinux-phantom@xxxxxxxxxxxxx
  • Date: Fri, 09 Aug 2013 01:28:59 -0700

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "theslinux-buildsystem".

The branch, _utils has been updated
       via  5e1b6f8783aad6154970415e7d76ee83b7663c40 (commit)
       via  81035606eb19b66f4ca177b3080da4ebdfc61998 (commit)
       via  693204ef8a5d7a42d08e02d27cc576ac121a8485 (commit)
      from  f918f49305886bf59148d8f68a9f1b818622ccb5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5e1b6f8783aad6154970415e7d76ee83b7663c40
Author: Ky-Anh Huynh <kyanh@xxxxxxxxxxxxx>
Date:   Fri Aug 9 15:27:33 2013 +0700

    - obsolete function :convert
    
    This function is used to convert our old repository
    (theslinux-buildsystem.broken.git) to the new one.
    The new one is now working fine, and we do not need
    this converting script anymore

commit 81035606eb19b66f4ca177b3080da4ebdfc61998
Author: Ky-Anh Huynh <kyanh@xxxxxxxxxxxxx>
Date:   Fri Aug 9 15:24:57 2013 +0700

    Rename :s-makepkg -> :_makepkg

commit 693204ef8a5d7a42d08e02d27cc576ac121a8485
Author: Ky-Anh Huynh <kyanh@xxxxxxxxxxxxx>
Date:   Fri Aug 9 15:23:05 2013 +0700

    Rename :import -> :_import_packages
    
    This is to hide the function, because we would export it via
    scripting aliases (/usr/bin/foobar -> internal function)

-----------------------------------------------------------------------

Summary of changes:
 _utils/run.sh | 185 +++-------------------------------------------------------
 1 file changed, 8 insertions(+), 177 deletions(-)

diff --git a/_utils/run.sh b/_utils/run.sh
index 317de82..fa3b286 100755
--- a/_utils/run.sh
+++ b/_utils/run.sh
@@ -59,7 +59,7 @@ _linecount() {
 #
 # The script to find the package from a list of ABS directories,
 # import ABS if there is no local branch for the package, create the
-# very first tag for `s-makepkg` if possible. New package will start
+# very first tag for `_makepkg` if possible. New package will start
 # from `TheSmallBang` branch.
 #
 # Directories:
@@ -193,182 +193,13 @@ _import_package() {
 }
 
 # Import all packages provided in the arguments
-import() {
+_import_packages() {
   while (( $# )); do
     _import_package $1
     shift
   done
 }
 
-# Date   : 2013 April 6th
-# Purpose: Migration the old repository to the new one
-# Usage  : $0 /path/to/the/original/source/tree [package]
-# Story  : During the migration I suddenly delete the directory `.git`
-#          of the old repository that have some branches that are not
-#          pushed to remoted. Fortunately their patch files are stil
-#          there ;)
-#
-# This script is used to convert the old repository to the new one
-#
-# The old one: Every package has its own branch; the branches are merged
-# and reabased on the master. This is very messy, confused. In this repo,
-# most commits for packages (the branch `_utils` is not a package) are in
-# two forms:
-#
-#   a. the importing commit (import package from abs source)
-#   b. the patch commit (slight modification of the first commit)
-#
-# Except for the two branches `m17n-db` and `m17n-db-vi`, most commits
-# should fit in a single package (path).
-#
-# The new one: The master has the very basic information. New package has
-# its own branch **that starts** from the very first commit of the master.
-# To convert from the old commits, we
-#
-#   1. first we rebase all packages/branches on the master
-#   2. check every commit if it is of type a. or b. (above)
-#   3. of type a.: create new import commit
-#   4. of type b.: generate patch file and apply it to the branch.
-#
-# We need to treat the following branches specially
-#
-#   1. linux-g1: the first branch, has the first commit
-#   2. m17n-db:
-#   3. m17n-db-vi: start from some commit in `m17n-db`
-#   4. p_*: used to generate patch files
-#
-# Notes:
-#   1. We need directory `/tmp/` in the current working directory
-#   2. During the migration the package `_utils` (not actually a package,
-#      though) is in the blacklist. The migration process is quite good,
-#      except the package `linux-api-header` can't be converted and we
-#      would transfer it to new repo. manually. When the package `_utils`
-#      is removed from the blacklist, a new branch `_utils` needs to be
-#      created **manually** because this branch doesn't have any `import`
-#      phase as other real package.
-#   3. The branch `master` on the old repository should contain all changes
-#      from the other packages (with helps of `git rebase`). This is the
-#      essential key for the migration process.
-#
-convert() {
-  local _cwd="$PWD"   # current workding dir
-  local _prev=        # previous commit
-  local _is_first=1   # is that the first commit
-  local _pkg=         # the new package
-  local _count=0      # number of basedir in a commit
-  local _subject=     # subject of a commit
-  local _blacklist=" linux-g1 m17n-db m17n-db-vi "
-                      # some special packages as mentioned above
-  local _bigbang="TheSmallBang"
-                      # This is where we create new branch for new package
-                      # Using a branch name is better here.
-  local _f_tmp=       # a temporary patch file. This won't hurt!
-
-  _die "The migration was complete. This function now stops."
-
-  pushd "$_cwd"
-
-  cd "$1" \
-  || { popd; _err "Failed to switch to '$1'"; return 1; }
-
-  _pkg="$2"
-
-  git log \
-  | grep "^commit" \
-  | awk '{print $NF}' \
-  | tac \
-  | while read _commit; do
-      # save the first commit and move to the next step
-      if [[ "$_is_first" == "1" ]]; then
-        _is_first="$_commit"
-        _prev="$_commit"
-        continue
-      fi
-
-      _msg "New migration: $_prev -> $_commit"
-      _f_tmp="$_cwd/tmp/patch.$_prev.$_commit"
-
-      _count=0
-      git diff --name-only "$_prev" "$_commit" \
-      | awk -F / '{print $1}' \
-      | sort -u \
-      | while read _path; do
-          if [[ "$_count" == "1" ]]; then
-            _err "$_path: multiple path found in a single commit. Skip"
-            continue
-          fi
-
-          if [[ -n "$_pkg" && "$_pkg" != "$_path" ]]; then
-            _msg "$_path: Skip as we need only the package $_pkg"
-            continue
-          fi
-
-          echo "$_blacklist" | grep -q " $_path "
-          if [[ $? -eq 0 ]]; then
-            _msg "$_path: Package is in the blacklist. Skip"
-            continue
-          fi
-
-          if [[ "${_path:0:2}" == "p_" ]]; then
-            _msg "$_path: Package is a patch (not new package). Skip"
-            continue
-          fi
-
-          # Generate the patch file
-          git format-patch --stdout "$_prev".."$_commit" \
-            > "$_f_tmp"
-
-          _subject="$(git log -1 --pretty='format:%s' $_commit)"
-
-          pushd "$_cwd"
-
-          # There is a typo error when importing `filesystem` that
-          # the subject of commit has `Immport` not `Import` as usual.
-          echo "$_subject" | grep -qE "Import|Immport"
-          if [[ $? -eq 0 ]]; then
-            # This is an Import commit, we need to create new branch
-
-            git branch | grep -Eq "^ $_path$"
-            if [[ $? -eq 0 ]]; then
-              _err "$_path: The branch does exist. Something wrong happened"
-              popd
-              continue
-            fi
-
-            git checkout -b "$_path" "$_bigbang" \
-            || {
-              popd
-              _err "$_path: Failed to create new branch"
-              continue
-            }
-          else
-            git checkout "$_path" \
-            || {
-              popd
-              _err "$_path: Failed to switch to the branch"
-              continue
-            }
-          fi
-
-          if git apply --check "$_f_tmp" >/dev/null; then
-            git am < "$_f_tmp" \
-            || _err "$_path: Weird. Good check with a failed patch?"
-          else
-            _err "$_path: The patch won't be applied."
-          fi
-
-          popd
-
-          (( _count ++ ))
-        done
-
-      _prev="$_commit"
-    done
-
-  popd
-  git co master
-}
-
 # Get the current git branch in the working directory.
 # or check if a local branch does exist.
 #
@@ -738,7 +569,7 @@ _get_version_from_old_PKGBUILD() {
 }
 
 # Check if there is a tag that indicates time when package is imported
-# from the ABS. This first tag is important bc it helps `s-makepkg`.
+# from the ABS. This first tag is important bc it helps `_makepkg`.
 #
 # Strategy
 #
@@ -821,12 +652,12 @@ _fix_the_1st_tag_on_package_branch() {
 # 8. `PACKAGE_BASE` (so `pkgbase`) is alway defined.
 # 9. `PACKAGE_FEATURE` helps to provide package name with any special
 #    feature, without creating "official branch". We just need to
-#    create a feature branch and `s-makepkg` will use the branch name
+#    create a feature branch and `_makepkg` will use the branch name
 #    as `PACKAGE_FEATURE`, and will append the string to name of the
 #    final output package. It also helps to modify the variables
 #    `conflicts`, `provides`,... on-the-fly.
 #
-s-makepkg() {
+_makepkg() {
   _s_env || return 1
   PACKAGE_BASE="$PACKAGE_BASE" \
   PACKAGE_RELEASE="$PACKAGE_RELEASE" \
@@ -879,7 +710,7 @@ _git_bang_bang() {
 #
 # History
 #
-# `_s_env` is taken from the original implementation of the `s-makepkg`
+# `_s_env` is taken from the original implementation of the `_makepkg`
 #  function. Because the output of `_s_env` is useful and may be used
 # in different context, we move the first part to a this `_s_env`.
 #
@@ -945,8 +776,8 @@ s-get_update() {
 
 _func=""
 case "${0##*/}" in
-  "s-import-package") _func="import" ;;
-  "s-makepkg")        _func="s-makepkg" ;;
+  "s-import-package") _func="_import_packages" ;;
+  "s-makepkg")        _func="_makepkg" ;;
 esac
 
 [[ -n "$_func" ]] || (( $# )) || _die "Missing arguments"


hooks/post-receive
-- 
theslinux-buildsystem
--
Purpose: Store commits, feeds from other projects
Post: mailto:theslinux-phantom@xxxxxxxxxxxxx
Archive, Gmane: http://theslinux.org/lists/phantom/
Subscribe: mailto:theslinux-phantom-request@xxxxxxxxxxxxx?Subject=subscribe
Unsubscribe: mailto:theslinux-phantom-request@xxxxxxxxxxxxx?Subject=unsubscribe
Other information: http://theslinux.org/lists (vi) or 
http://theslinux.org/lists/en (en)
Support: mailto:theslinux-questions@xxxxxxxxxxxxx

Other related posts:

  • » theslinux-buildsystem branch _utils updated 5e1b6f8 - obsolete function :convert - git