From 11976a5a186eefa05f0979f4388df34be2eaf64e Mon Sep 17 00:00:00 2001 From: Afanasov Dmitry Date: Tue, 12 May 2009 14:45:01 +0400 Subject: [PATCH] recognize --component option option customize repository component passed to genbasedir (comp1, comp2 in genbasedir help). set 'hasher' as default value. --- hasher/hsh | 7 ++++++- hasher/hsh-rebuild | 9 ++++++--- hasher/hsh-sh-functions.in | 9 +++++++-- hasher/mkaptbox | 11 ++++++++--- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/hasher/hsh b/hasher/hsh index 2bda509..38cc5a2 100755 --- a/hasher/hsh +++ b/hasher/hsh @@ -73,6 +73,7 @@ Options: overriding --repo option for binary packages; --repo-src=DIR source packages destination directory, overriding --repo option for source packages; + --component=NAME repository component; --save-fakeroot save fakeroot state; --target=ARCH target architecture; --wait-lock wait for workdir and hasher-priv locks; @@ -91,7 +92,7 @@ EOF exit } -TEMP=`getopt -n $PROG -o $getopt_common_opts -l apt-config:,apt-prefix:,build-args:,cache-dir:,cleanup-only,contents-index-all:,contents-index-bin:,eager-cleanup,excludedocs,hasher-priv-dir:,initroot-only,install-langs:,lazy-cleanup,mountpoints:,no-cache,no-contents-indices,no-repackage-source,no-sisyphus-check::,no-sisyphus-check-in::,no-sisyphus-check-out::,no-stuff,nprocs:,number:,packager:,pkg-build-list:,pkg-init-list:,query-repackage,query-req-prog:,rebuild-prog:,repackage-source,repo:,repo-bin:,repo-src:,save-fakeroot,target:,wait-lock,no-wait-lock,without-stuff,with-stuff,with-qemu:,$getopt_common_longopts -- "$@"` || +TEMP=`getopt -n $PROG -o $getopt_common_opts -l apt-config:,apt-prefix:,build-args:,cache-dir:,cleanup-only,contents-index-all:,contents-index-bin:,eager-cleanup,excludedocs,hasher-priv-dir:,initroot-only,install-langs:,lazy-cleanup,mountpoints:,no-cache,no-contents-indices,no-repackage-source,no-sisyphus-check::,no-sisyphus-check-in::,no-sisyphus-check-out::,no-stuff,nprocs:,number:,packager:,pkg-build-list:,pkg-init-list:,query-repackage,query-req-prog:,rebuild-prog:,repackage-source,component:,repo:,repo-bin:,repo-src:,save-fakeroot,target:,wait-lock,no-wait-lock,without-stuff,with-stuff,with-qemu:,$getopt_common_longopts -- "$@"` || show_usage eval set -- "$TEMP" @@ -174,6 +175,8 @@ while :; do prog_rebuild="$(opt_check_read "$1" "$2")" shift ;; + --component) shift; component="$1" + ;; --repo) shift; repo="$1" ;; --repo-bin) shift; repo_bin="$1" @@ -309,6 +312,7 @@ handle_package() rm -rf aptbox mkaptbox --no-lock "$workdir" \ ${target:+--target="$target"} \ + ${component:+--component="$component"} \ ${repo:+--repo="$repo"} \ ${repo_bin:+--repo-bin="$repo_bin"} \ ${repo_src:+--repo-src="$repo_src"} \ @@ -360,6 +364,7 @@ handle_package() [ -n "$f" ] || return 0 hsh-rebuild --no-lock "$workdir" \ ${target:+--target="$target"} \ + ${component:+--component="$component"} \ ${repo:+--repo="$repo"} \ ${repo_bin:+--repo-bin="$repo_bin"} \ ${repo_src:+--repo-src="$repo_src"} \ diff --git a/hasher/hsh-rebuild b/hasher/hsh-rebuild index cd3a80c..cc269cd 100755 --- a/hasher/hsh-rebuild +++ b/hasher/hsh-rebuild @@ -50,6 +50,7 @@ Options: overriding --repo option for binary packages; --repo-src=DIR source packages destination directory, overriding --repo option for source packages; + --component=NAME repository component; --source-only do not build, stop after installing source package; --target=ARCH target architecture; --wait-lock wait for workdir and hasher-priv locks; @@ -67,7 +68,7 @@ EOF exit } -TEMP=`getopt -n $PROG -o $getopt_common_opts -l args:,excludedocs,hasher-priv-dir:,install-only,mountpoints:,nodeps,no-lock,no-sisyphus-check::,no-sisyphus-check-in::,no-sisyphus-check-out::,no-stuff,number:,query-repackage,query-req-prog:,rebuild-prog:,repo:,repo-bin:,repo-src:,save-fakeroot,source-only,target:,wait-lock,no-wait-lock,without-stuff,with-stuff,$getopt_common_longopts -- "$@"` || +TEMP=`getopt -n $PROG -o $getopt_common_opts -l args:,excludedocs,hasher-priv-dir:,install-only,mountpoints:,nodeps,no-lock,no-sisyphus-check::,no-sisyphus-check-in::,no-sisyphus-check-out::,no-stuff,number:,query-repackage,query-req-prog:,rebuild-prog:,component:,repo:,repo-bin:,repo-src:,save-fakeroot,source-only,target:,wait-lock,no-wait-lock,without-stuff,with-stuff,$getopt_common_longopts -- "$@"` || show_usage eval set -- "$TEMP" @@ -115,6 +116,8 @@ while :; do prog_rebuild="$(opt_check_read "$1" "$2")" shift ;; + --component) shift; component="$1" + ;; --repo) shift; repo="$1" ;; --repo-bin) shift; repo_bin="$1" @@ -252,8 +255,8 @@ case `find chroot/.out/ -mindepth 1 -maxdepth 1 -type f -name \*.src.rpm |LC_ALL esac make_repo -repo_bin="${repo_bin:-${repo:-$def_repo}/"${target:-$def_target}"/RPMS.hasher/}" -repo_src="${repo_src:-${repo:-$def_repo}/SRPMS.hasher/}" +repo_bin="${repo_bin:-${repo:-$def_repo}/"${target:-$def_target}"/RPMS.${component:-$def_component}/}" +repo_src="${repo_src:-${repo:-$def_repo}/SRPMS.${component:-$def_component}/}" find chroot/$subdir/ -mindepth 1 -maxdepth 1 -type f -name \*.src.rpm -print0 | xargs -r0 mv -f $verbose --target-directory="$repo_src" -- >&2 diff --git a/hasher/hsh-sh-functions.in b/hasher/hsh-sh-functions.in index ea205e2..1e1039b 100644 --- a/hasher/hsh-sh-functions.in +++ b/hasher/hsh-sh-functions.in @@ -161,6 +161,11 @@ Helpify query_repackage noinstall_pattern_list='dev[-_][0-9]* dev[-_]minimal[-_][0-9]*' Helpify pkg_noinstall_pattern_list noinstall_pattern_list +# repository component name +def_component=hasher +component= +Helpify component def_component + # repo directory. def_repo=repo repo= @@ -395,14 +400,14 @@ make_repo() if [ -n "$repo_src" -o -n "$repo_bin" ]; then mkdir -p $verbose -- ${repo_src:+"$repo_src"} ${repo_bin:+"$repo_bin"} >&2 fi - mkdir -p $verbose -- ${repo:-$def_repo}/{{SRPMS,${target:-$def_target}/RPMS}.hasher,${target:-$def_target}/base} >&2 + mkdir -p $verbose -- ${repo:-$def_repo}/{{SRPMS,${target:-$def_target}/RPMS}.${component:-$def_component},${target:-$def_target}/base} >&2 } # assumed: cwd == workdir, defined aptbox update_repo() { [ -z "$no_stuff" ] || return 0 - "$aptbox/genbasedir" --topdir=${repo:-$def_repo} --no-oldhashfile --bz2only --mapi --bloat ${target:-$def_target} hasher && + "$aptbox/genbasedir" --topdir=${repo:-$def_repo} --no-oldhashfile --bz2only --mapi --bloat ${target:-$def_target} ${component:-$def_component} && verbose 'updated hasher repository indices.' || fatal 'failed to update hasher repository indices.' } diff --git a/hasher/mkaptbox b/hasher/mkaptbox index 6be60f1..6814e33 100755 --- a/hasher/mkaptbox +++ b/hasher/mkaptbox @@ -42,6 +42,7 @@ Options: overriding --repo option for binary packages; --repo-src=DIR source packages destination directory, overriding --repo option for source packages; + --component=NAME repository component; --target=ARCH target architecture of the work repository; -u, --update run "apt-get update" after creation; --wait-lock wait for workdir lock; @@ -59,7 +60,7 @@ EOF exit } -TEMP=`getopt -n $PROG -o f,u,$getopt_common_opts -l apt-config:,apt-prefix:,force,no-lock,no-stuff,no-update,repo:,repo-bin:,repo-src:,target:,update,wait-lock,no-wait-lock,without-stuff,with-stuff,$getopt_common_longopts -- "$@"` || +TEMP=`getopt -n $PROG -o f,u,$getopt_common_opts -l apt-config:,apt-prefix:,force,no-lock,no-stuff,no-update,component:,repo:,repo-bin:,repo-src:,target:,update,wait-lock,no-wait-lock,without-stuff,with-stuff,$getopt_common_longopts -- "$@"` || show_usage eval set -- "$TEMP" @@ -81,6 +82,8 @@ while :; do ;; --no-update) update= ;; + --component) shift; component="$1" + ;; --repo) shift; repo="$1" ;; --repo-bin) shift; repo_bin="$1" @@ -132,6 +135,8 @@ lock_workdir [ -n "$repo" ] || repo="$def_repo" repo="$(readlink -ef -- "$repo")" +[ -n "$component" ] || component="$def_component" + # does aptbox exist yet? if [ -e aptbox -o -L aptbox ]; then [ -n "$force" ] || fatal "remove $aptbox first." @@ -246,7 +251,7 @@ done cat >regenbasedir <<__EOF__ #!/bin/sh -ef -"$aptbox/genbasedir" --topdir="$repo" --no-oldhashfile --bz2only --mapi --bloat ${target:-$def_target} hasher "\$@" +"$aptbox/genbasedir" --topdir="$repo" --no-oldhashfile --bz2only --mapi --bloat ${target:-$def_target} $component "\$@" "$aptbox/apt-get" ${quiet:+-qq} update __EOF__ verbose "created regenbasedir" @@ -291,7 +296,7 @@ verbose "Created APT configuration file \`$apt_config_file'." # create a new sources.list file. target_config="./etc/apt/sources.list" cat >"$target_config" <<__EOF__ -${no_stuff:+#}rpm file:$repo ${target:-$def_target} hasher +${no_stuff:+#}rpm file:$repo ${target:-$def_target} $component $(LC_ALL=C grep '^[^#]' "$sl_value") __EOF__ verbose "Created APT source list file \`$target_config'." -- 1.6.2.4