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
|
||||
# projet pff $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() {
|
||||
|
@ -469,23 +469,25 @@ function get_vlfiles_nostrip() {
|
|||
[ -d "$pffdir/pff/$profile" ] || return
|
||||
if [ -n "$version" ]; then
|
||||
if [ -n "$rfile" ]; then
|
||||
setx rfile=add_pv "$rfile" "$version"
|
||||
find "$pffdir/pff/$profile" \
|
||||
-type f -path "$pffdir/pff/$profile/${rfile}__pv-${version}__" -o \
|
||||
-type l -path "$pffdir/pff/$profile/${rfile}__pv-${version}__"
|
||||
-type f -path "$pffdir/pff/$profile/${rfile}" -o \
|
||||
-type l -path "$pffdir/pff/$profile/${rfile}"
|
||||
else
|
||||
find "$pffdir/pff/$profile" \
|
||||
-type f -name "*__pv-${version}__" -o \
|
||||
-type l -name "*__pv-${version}__"
|
||||
-type f -name "__pv-${version}__*" -o \
|
||||
-type l -name "__pv-${version}__*"
|
||||
fi
|
||||
else
|
||||
if [ -n "$rfile" ]; then
|
||||
setx rfile=add_pv "$rfile" "*"
|
||||
find "$pffdir/pff/$profile" \
|
||||
-type f -path "$pffdir/pff/$profile/${rfile}__pv-*__" -o \
|
||||
-type l -path "$pffdir/pff/$profile/${rfile}__pv-*__"
|
||||
-type f -path "$pffdir/pff/$profile/${rfile}" -o \
|
||||
-type l -path "$pffdir/pff/$profile/${rfile}"
|
||||
else
|
||||
find "$pffdir/pff/$profile" \
|
||||
-type f -name "*__pv-*__" -o \
|
||||
-type l -name "*__pv-*__"
|
||||
-type f -name "__pv-*__*" -o \
|
||||
-type l -name "__pv-*__*"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -493,6 +495,33 @@ function get_vlfiles() {
|
|||
local pffdir="$1" rfile="$2" profile="${3:-Base}" version="$4"
|
||||
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() {
|
||||
local file="$1" pffdir="$2"
|
||||
|
@ -530,7 +559,7 @@ function sync_vlfiles() {
|
|||
fi
|
||||
local vlfile rfile prefix pfile plink tmp
|
||||
for vlfile in "$@"; do
|
||||
rfile="${vlfile%__pv-*__}"
|
||||
setx rfile=strip_pv "$vlfile"
|
||||
for profile in "${profiles[@]}"; do
|
||||
prefix="$pffdir/pff/$profile"
|
||||
flexists "$prefix/$rfile" || continue
|
||||
|
@ -1044,7 +1073,7 @@ function new_cmd() {
|
|||
else
|
||||
src="$srcdir/$i"
|
||||
fi
|
||||
vlfile="${i}__pv-${version}__"
|
||||
setx vlfile=add_pv "$i" "$version"
|
||||
dest="$pffdir/pff/Base/$vlfile"
|
||||
if flexists "$src"; then
|
||||
mkdirof "$dest"; r=$?
|
||||
|
@ -1116,7 +1145,8 @@ function patch_cmd() {
|
|||
# filtrer les fichiers de NOMERGES
|
||||
mergefiles=()
|
||||
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
|
||||
array_add mergefiles "$vlfile"
|
||||
done
|
||||
|
@ -1132,7 +1162,8 @@ function patch_cmd() {
|
|||
# filtrer les fichiers de NOMERGES
|
||||
mergefiles=()
|
||||
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
|
||||
array_add mergefiles "$vlfile"
|
||||
done
|
||||
|
@ -1153,7 +1184,8 @@ function patch_cmd() {
|
|||
git checkout -q --orphan upstream
|
||||
# rajouter les fichiers de Base dans la branche upstream
|
||||
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"
|
||||
mkdirof "$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 ^^)
|
||||
if [ "$profile" != Common ]; then
|
||||
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
|
||||
setx rfile=get_rfile "$Cfile" "$pffdir"
|
||||
mkdirof "$rfile"
|
||||
|
@ -1178,7 +1211,8 @@ function patch_cmd() {
|
|||
fi
|
||||
# rajouter les fichiers du profil
|
||||
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"
|
||||
mkdirof "$rfile"
|
||||
cp -a "$pfile" "$rfile"
|
||||
|
@ -1188,7 +1222,8 @@ function patch_cmd() {
|
|||
# rebasculer vers upstream et rajouter les fichiers de patch
|
||||
git checkout -q upstream
|
||||
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"
|
||||
cp -L "$vlfile" "$rfile"
|
||||
done
|
||||
|
@ -1250,7 +1285,8 @@ $(qvals eimportant "Sinon, tapez ${COULEUR_ROUGE}Abort${COULEUR_NORMALE} pour ar
|
|||
fi
|
||||
# récupérer les versions modifiées et supprimer les fichiers de patch
|
||||
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"
|
||||
cp -a "$rfile" "$pfile"
|
||||
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
|
||||
etitle "Finaliser intégration de la version $version"
|
||||
for vlfile in "${vlfiles[@]}"; do
|
||||
bfile="${vlfile%__pv-${version}__}"
|
||||
setx bfile=strip_pv "$vlfile" "$version"
|
||||
[ -z "$NOUPSTREAM" ] && chmod +w "$bfile"
|
||||
mv "$vlfile" "$bfile"
|
||||
[ -z "$NOUPSTREAM" ] && chmod a-w "$bfile"
|
||||
|
|
Loading…
Reference in New Issue