mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
collect-installed-pkg-changes.sh: Ddefault packages to jw-pkg list
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
39a558d3a1
commit
856dae7efa
1 changed files with 59 additions and 33 deletions
|
|
@ -18,7 +18,7 @@ fatal()
|
||||||
|
|
||||||
lp()
|
lp()
|
||||||
{
|
{
|
||||||
find . -name "$1" | grep -v "/dist/\|/include/"
|
scm.sh ls-files | grep "/$1$"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
|
|
@ -27,6 +27,63 @@ usage()
|
||||||
[ "$1" ] && exit $1
|
[ "$1" ] && exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collect_changes()
|
||||||
|
{
|
||||||
|
local projs="$*"
|
||||||
|
local proj changed_path project_path p b lp
|
||||||
|
|
||||||
|
[ "$projs" ] || {
|
||||||
|
if [ -f .git ]; then
|
||||||
|
projs=`pwd | xargs basename`
|
||||||
|
projs="$proj-run $proj-devel"
|
||||||
|
else
|
||||||
|
projs="$(jw-pkg list | sed 's/-[0-9].*//')"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for proj in $projs; do
|
||||||
|
(
|
||||||
|
changed_paths=`rpm -qV $proj | sed '
|
||||||
|
/^..5.*/ !d
|
||||||
|
s%^..5...... . /%/%
|
||||||
|
'`
|
||||||
|
[ "$changed_paths" ] || exit
|
||||||
|
project_path=$(echo $proj | sed 's/-run$\|-devel$//')
|
||||||
|
|
||||||
|
cd $project_path || {
|
||||||
|
err "Failed to change to $project_path"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Handling project $proj"
|
||||||
|
|
||||||
|
for p in $changed_paths; do
|
||||||
|
[ -r $p ] || {
|
||||||
|
err "can't read $p"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
b=`basename $p`
|
||||||
|
lp=`lp "$b"`
|
||||||
|
[ "$lp" ] || {
|
||||||
|
err "$p is not in repository"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
nl=`lp "$b" | wc -l`
|
||||||
|
[ $nl -gt 1 ] && {
|
||||||
|
log $p is more than once in repository:
|
||||||
|
lp $b
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
diff -q $lp $p >/dev/null 2>&1 && {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log copying $p $lp
|
||||||
|
cp $p $lp
|
||||||
|
done
|
||||||
|
)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# -- here we go
|
# -- here we go
|
||||||
|
|
||||||
set -- `getopt 'ht:' $*`
|
set -- `getopt 'ht:' $*`
|
||||||
|
|
@ -51,35 +108,4 @@ shift
|
||||||
cd $target || fatal "failed to change to target dir \"$target\""
|
cd $target || fatal "failed to change to target dir \"$target\""
|
||||||
}
|
}
|
||||||
|
|
||||||
proj=$1
|
collect_changes
|
||||||
[ "$proj" ] || {
|
|
||||||
proj=`pwd | xargs basename`
|
|
||||||
proj="$proj-run $proj-devel"
|
|
||||||
}
|
|
||||||
|
|
||||||
changed_paths=`rpm -qV $proj | sed '
|
|
||||||
/^..5.*/ !d
|
|
||||||
s%^..5...... . /%/%
|
|
||||||
'`
|
|
||||||
|
|
||||||
for p in $changed_paths; do
|
|
||||||
[ -r $p ] || {
|
|
||||||
fatal "can't read $p"
|
|
||||||
}
|
|
||||||
b=`basename $p`
|
|
||||||
lp=`lp "$b"`
|
|
||||||
[ "$lp" ] || {
|
|
||||||
fatal "$p is not in repository"
|
|
||||||
}
|
|
||||||
nl=`lp $b | wc -l`
|
|
||||||
[ $nl -gt 1 ] && {
|
|
||||||
log $p is more than once in repository:
|
|
||||||
lp $b
|
|
||||||
fatal exiting
|
|
||||||
}
|
|
||||||
diff -q $lp $p >/dev/null 2>&1 && {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log copying $p $lp
|
|
||||||
cp $p $lp
|
|
||||||
done
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue