pff: changer le format des fichiers de version
This commit is contained in:
parent
7a4870f8c8
commit
da28d8b429
74
pff
74
pff
|
@ -407,7 +407,7 @@ function get_local_files() {
|
||||||
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
||||||
# projet pff $1
|
# projet pff $1
|
||||||
local pffdir="$1"
|
local pffdir="$1"
|
||||||
find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '__pv-.*__$'
|
find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '/__pv-[^/_]*__[^/]*$'
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiups() {
|
function multiups() {
|
||||||
|
@ -469,23 +469,25 @@ function get_vlfiles_nostrip() {
|
||||||
[ -d "$pffdir/pff/$profile" ] || return
|
[ -d "$pffdir/pff/$profile" ] || return
|
||||||
if [ -n "$version" ]; then
|
if [ -n "$version" ]; then
|
||||||
if [ -n "$rfile" ]; then
|
if [ -n "$rfile" ]; then
|
||||||
|
setx rfile=add_pv "$rfile" "$version"
|
||||||
find "$pffdir/pff/$profile" \
|
find "$pffdir/pff/$profile" \
|
||||||
-type f -path "$pffdir/pff/$profile/${rfile}__pv-${version}__" -o \
|
-type f -path "$pffdir/pff/$profile/${rfile}" -o \
|
||||||
-type l -path "$pffdir/pff/$profile/${rfile}__pv-${version}__"
|
-type l -path "$pffdir/pff/$profile/${rfile}"
|
||||||
else
|
else
|
||||||
find "$pffdir/pff/$profile" \
|
find "$pffdir/pff/$profile" \
|
||||||
-type f -name "*__pv-${version}__" -o \
|
-type f -name "__pv-${version}__*" -o \
|
||||||
-type l -name "*__pv-${version}__"
|
-type l -name "__pv-${version}__*"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -n "$rfile" ]; then
|
if [ -n "$rfile" ]; then
|
||||||
|
setx rfile=add_pv "$rfile" "*"
|
||||||
find "$pffdir/pff/$profile" \
|
find "$pffdir/pff/$profile" \
|
||||||
-type f -path "$pffdir/pff/$profile/${rfile}__pv-*__" -o \
|
-type f -path "$pffdir/pff/$profile/${rfile}" -o \
|
||||||
-type l -path "$pffdir/pff/$profile/${rfile}__pv-*__"
|
-type l -path "$pffdir/pff/$profile/${rfile}"
|
||||||
else
|
else
|
||||||
find "$pffdir/pff/$profile" \
|
find "$pffdir/pff/$profile" \
|
||||||
-type f -name "*__pv-*__" -o \
|
-type f -name "__pv-*__*" -o \
|
||||||
-type l -name "*__pv-*__"
|
-type l -name "__pv-*__*"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -493,6 +495,33 @@ function get_vlfiles() {
|
||||||
local pffdir="$1" rfile="$2" profile="${3:-Base}" version="$4"
|
local pffdir="$1" rfile="$2" profile="${3:-Base}" version="$4"
|
||||||
get_vlfiles_nostrip "$@" | sed "s|^$pffdir/pff/$profile/||"
|
get_vlfiles_nostrip "$@" | sed "s|^$pffdir/pff/$profile/||"
|
||||||
}
|
}
|
||||||
|
function strip_pv() {
|
||||||
|
local vlfile="$1" version="$2" vldir vlname
|
||||||
|
if [[ "$vlfile" == */* ]]; then
|
||||||
|
vldir="${vlfile%/*}/"
|
||||||
|
vlname="${vlfile##*/}"
|
||||||
|
else
|
||||||
|
vldir=
|
||||||
|
vlname="$vlfile"
|
||||||
|
fi
|
||||||
|
if [ -n "$version" ]; then
|
||||||
|
vlname="${vlname#__pv-*__}"
|
||||||
|
else
|
||||||
|
vlname="${vlname#__pv-${version}__}"
|
||||||
|
fi
|
||||||
|
echo "$vldir$vlname"
|
||||||
|
}
|
||||||
|
function add_pv() {
|
||||||
|
local vlfile="$1" version="$2" vldir vlname
|
||||||
|
if [[ "$vlfile" == */* ]]; then
|
||||||
|
vldir="${vlfile%/*}/"
|
||||||
|
vlname="${vlfile##*/}"
|
||||||
|
else
|
||||||
|
vldir=
|
||||||
|
vlname="$vlfile"
|
||||||
|
fi
|
||||||
|
echo "${vldir}__pv-${version}__${vlname}"
|
||||||
|
}
|
||||||
|
|
||||||
function is_nomerge() {
|
function is_nomerge() {
|
||||||
local file="$1" pffdir="$2"
|
local file="$1" pffdir="$2"
|
||||||
|
@ -530,7 +559,7 @@ function sync_vlfiles() {
|
||||||
fi
|
fi
|
||||||
local vlfile rfile prefix pfile plink tmp
|
local vlfile rfile prefix pfile plink tmp
|
||||||
for vlfile in "$@"; do
|
for vlfile in "$@"; do
|
||||||
rfile="${vlfile%__pv-*__}"
|
setx rfile=strip_pv "$vlfile"
|
||||||
for profile in "${profiles[@]}"; do
|
for profile in "${profiles[@]}"; do
|
||||||
prefix="$pffdir/pff/$profile"
|
prefix="$pffdir/pff/$profile"
|
||||||
flexists "$prefix/$rfile" || continue
|
flexists "$prefix/$rfile" || continue
|
||||||
|
@ -1044,7 +1073,7 @@ function new_cmd() {
|
||||||
else
|
else
|
||||||
src="$srcdir/$i"
|
src="$srcdir/$i"
|
||||||
fi
|
fi
|
||||||
vlfile="${i}__pv-${version}__"
|
setx vlfile=add_pv "$i" "$version"
|
||||||
dest="$pffdir/pff/Base/$vlfile"
|
dest="$pffdir/pff/Base/$vlfile"
|
||||||
if flexists "$src"; then
|
if flexists "$src"; then
|
||||||
mkdirof "$dest"; r=$?
|
mkdirof "$dest"; r=$?
|
||||||
|
@ -1116,7 +1145,8 @@ function patch_cmd() {
|
||||||
# filtrer les fichiers de NOMERGES
|
# filtrer les fichiers de NOMERGES
|
||||||
mergefiles=()
|
mergefiles=()
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx rfile=get_rfile "${vlfile%__pv-${version}__}" "$pffdir"
|
setx rfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx rfile=get_rfile "$rfile" "$pffdir"
|
||||||
is_nomerge "$rfile" "$pffdir" && continue
|
is_nomerge "$rfile" "$pffdir" && continue
|
||||||
array_add mergefiles "$vlfile"
|
array_add mergefiles "$vlfile"
|
||||||
done
|
done
|
||||||
|
@ -1132,7 +1162,8 @@ function patch_cmd() {
|
||||||
# filtrer les fichiers de NOMERGES
|
# filtrer les fichiers de NOMERGES
|
||||||
mergefiles=()
|
mergefiles=()
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx rfile=get_rfile "${vlfile%__pv-${version}__}" "$pffdir"
|
setx rfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx rfile=get_rfile "$rfile" "$pffdir"
|
||||||
is_nomerge "$rfile" "$pffdir" && continue
|
is_nomerge "$rfile" "$pffdir" && continue
|
||||||
array_add mergefiles "$vlfile"
|
array_add mergefiles "$vlfile"
|
||||||
done
|
done
|
||||||
|
@ -1153,7 +1184,8 @@ function patch_cmd() {
|
||||||
git checkout -q --orphan upstream
|
git checkout -q --orphan upstream
|
||||||
# rajouter les fichiers de Base dans la branche upstream
|
# rajouter les fichiers de Base dans la branche upstream
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx bfile=get_bfile "${vlfile%__pv-${version}__}" "$pffdir"
|
setx bfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx bfile=get_bfile "$bfile" "$pffdir"
|
||||||
setx rfile=get_rfile "$bfile" "$pffdir"
|
setx rfile=get_rfile "$bfile" "$pffdir"
|
||||||
mkdirof "$rfile"
|
mkdirof "$rfile"
|
||||||
cp -a "$bfile" "$rfile"
|
cp -a "$bfile" "$rfile"
|
||||||
|
@ -1166,7 +1198,8 @@ function patch_cmd() {
|
||||||
# rajouter les fichiers de Common s'ils existent (sauf si la branche c'est Common ^^)
|
# rajouter les fichiers de Common s'ils existent (sauf si la branche c'est Common ^^)
|
||||||
if [ "$profile" != Common ]; then
|
if [ "$profile" != Common ]; then
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx Cfile=get_Cfile "${vlfile%__pv-${version}__}" "$pffdir"
|
setx Cfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx Cfile=get_Cfile "$Cfile" "$pffdir"
|
||||||
if flexists "$Cfile"; then
|
if flexists "$Cfile"; then
|
||||||
setx rfile=get_rfile "$Cfile" "$pffdir"
|
setx rfile=get_rfile "$Cfile" "$pffdir"
|
||||||
mkdirof "$rfile"
|
mkdirof "$rfile"
|
||||||
|
@ -1178,7 +1211,8 @@ function patch_cmd() {
|
||||||
fi
|
fi
|
||||||
# rajouter les fichiers du profil
|
# rajouter les fichiers du profil
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx pfile=get_pfile "${vlfile%__pv-${version}__}" "$profile" "$pffdir"
|
setx pfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx pfile=get_pfile "$pfile" "$profile" "$pffdir"
|
||||||
setx rfile=get_rfile "$pfile" "$pffdir"
|
setx rfile=get_rfile "$pfile" "$pffdir"
|
||||||
mkdirof "$rfile"
|
mkdirof "$rfile"
|
||||||
cp -a "$pfile" "$rfile"
|
cp -a "$pfile" "$rfile"
|
||||||
|
@ -1188,7 +1222,8 @@ function patch_cmd() {
|
||||||
# rebasculer vers upstream et rajouter les fichiers de patch
|
# rebasculer vers upstream et rajouter les fichiers de patch
|
||||||
git checkout -q upstream
|
git checkout -q upstream
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx rfile=get_rfile "${vlfile%__pv-${version}__}" "$pffdir"
|
setx rfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx rfile=get_rfile "$rfile" "$pffdir"
|
||||||
mkdirof "$rfile"
|
mkdirof "$rfile"
|
||||||
cp -L "$vlfile" "$rfile"
|
cp -L "$vlfile" "$rfile"
|
||||||
done
|
done
|
||||||
|
@ -1250,7 +1285,8 @@ $(qvals eimportant "Sinon, tapez ${COULEUR_ROUGE}Abort${COULEUR_NORMALE} pour ar
|
||||||
fi
|
fi
|
||||||
# récupérer les versions modifiées et supprimer les fichiers de patch
|
# récupérer les versions modifiées et supprimer les fichiers de patch
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
setx pfile=get_pfile "${vlfile%__pv-${version}__}" "$profile" "$pffdir"
|
setx pfile=strip_pv "$vlfile" "$version"
|
||||||
|
setx pfile=get_pfile "$pfile" "$profile" "$pffdir"
|
||||||
setx rfile=get_rfile "$pfile" "$pffdir"
|
setx rfile=get_rfile "$pfile" "$pffdir"
|
||||||
cp -a "$rfile" "$pfile"
|
cp -a "$rfile" "$pfile"
|
||||||
rm "$vlfile"
|
rm "$vlfile"
|
||||||
|
@ -1261,7 +1297,7 @@ $(qvals eimportant "Sinon, tapez ${COULEUR_ROUGE}Abort${COULEUR_NORMALE} pour ar
|
||||||
# il faut intégrer la nouvelle version dans Base
|
# il faut intégrer la nouvelle version dans Base
|
||||||
etitle "Finaliser intégration de la version $version"
|
etitle "Finaliser intégration de la version $version"
|
||||||
for vlfile in "${vlfiles[@]}"; do
|
for vlfile in "${vlfiles[@]}"; do
|
||||||
bfile="${vlfile%__pv-${version}__}"
|
setx bfile=strip_pv "$vlfile" "$version"
|
||||||
[ -z "$NOUPSTREAM" ] && chmod +w "$bfile"
|
[ -z "$NOUPSTREAM" ] && chmod +w "$bfile"
|
||||||
mv "$vlfile" "$bfile"
|
mv "$vlfile" "$bfile"
|
||||||
[ -z "$NOUPSTREAM" ] && chmod a-w "$bfile"
|
[ -z "$NOUPSTREAM" ] && chmod a-w "$bfile"
|
||||||
|
|
Loading…
Reference in New Issue