:: Re: [devuan-dev] Patch dak to skip …
Página Principal
Delete this message
Reply to this message
Autor: Mark Hindley
Data:  
Para: devuan-dev
Assunto: Re: [devuan-dev] Patch dak to skip duplicate source uploads when importing.
On Tue, Dec 03, 2019 at 02:22:40PM +0000, Mark Hindley wrote:
> Hello,
>
> I have a patch which I hope will finally get rid of the frustration we all have
> with dak rejecting subsequent .dsc uploads of the same source version.
>
> The issue is that, even when signed with the same key, the signature in the .dsc
> file is different each time and therefor the file has a different checksum.


Having looked at this some more I think we could and should extend this approach
to binaries too. The existing check on the exit status of the dak import command
doesn't work anyway because the patch to implement it is not included in the
deployed version! And dak always finds new and interesting ways to fail...

So here is a new patch for consideration and comment.

Thanks.

Mark
1 file changed, 27 insertions(+), 24 deletions(-)
tools/add_pkg | 51 +++++++++++++++++++++++++++------------------------

modified tools/add_pkg
@@ -5,6 +5,8 @@ JENKINSPATH=/home/dak/jenkins
REMOVE=true
SUITE=experimental
COMPONENT=main
+DAKROOT="/srv/dak/ftp"
+POOLPREFIX="${DAKROOT}/pool"


 help(){
@@ -112,36 +114,37 @@ if [ -d "$BASEP" ] ; then
     fi
     cd sources
     for dsc in *.dsc ; do
-            # Check is the .dsc file is already in the pool. If it is,
-            # bailout, as dak won't accept a new version
-                DSC_POOLFILE=/$(echo $dsc | sed 's/^\(lib.\|.\)[^_]\+/\1\/&\/&/')
-                echo "Checking for $DSC_POOLFILE in the pool."
-                if [ -f /srv/dak/ftp/pool/main/${DSC_POOLFILE} ] ; then
-                        echo "${DSC_POOLFILE} already exists in dak pool. Skipping."
-                        continue
-                fi
-        echo "execute dak import -a $SUITE $COMPONENT $dsc"
-        dak import $SUITE $COMPONENT $dsc || test 3 -eq $? && dakmove $SUITE $COMPONENT $dsc || exit $?
-        O=$(grep -A 1 ^Package-List "$dsc" | tail -n 1 | awk '{print $4" "$3}')
-        source=$(grep ^Source "$dsc" | head -n 1 | awk '{print $2}')
-        echo $source $O | dak control-overrides -a -s $SUITE -t dsc
+        # Check is the file is already in the pool. If it is try to move to this suite.
+        POOLFILE=$(echo $dsc | sed 's/^\(lib.\|.\)[^_]\+/\1\/&\/&/')
+        echo "Checking for $POOLFILE in the pool."
+        if [ -f ${POOLPREFIX}/${COMPONENT}/${POOLFILE} ] ; then
+            echo "$dsc already exists in dak pool. Attempting to add it to suite $SUITE."
+            dakmove $SUITE $COMPONENT $dsc
+        else
+            echo "execute dak import -a $SUITE $COMPONENT $dsc"
+            dak import $SUITE $COMPONENT $dsc
+            O=$(grep -A 1 ^Package-List "$dsc" | tail -n 1 | awk '{print $4" "$3}')
+            source=$(grep ^Source "$dsc" | head -n 1 | awk '{print $2}')
+            echo $source $O | dak control-overrides -a -s $SUITE -t dsc
+        fi
     done
     cd ..
     for i in architecture* ; do
         cd "$i"
-        for deb in *.deb; do
-            if [ -f ${deb} ] ; then
-            echo "in $i execute dak import -a $SUITE $COMPONENT $deb" 
-            dak import -a $SUITE $COMPONENT $deb || test 3 -eq $? && dakmove $SUITE $COMPONENT $deb || exit $?
+        for deb in *.deb *.udeb ; do
+            if [ -f ${deb} ] ; then
+            # Check is the file is already in the pool. If it is try to move to this suite.
+            POOLFILE=$(dpkg-deb -f $deb source | sed 's/^\(lib.\|.\).\+$/\1\/&/')/${deb}
+            echo "Checking for $POOLFILE in the pool."
+            if [ -f ${POOLPREFIX}/${COMPONENT}/${POOLFILE} ] ; then
+                echo "$deb already exists in dak pool. Attempting to add it to suite $SUITE."
+                dakmove $SUITE $COMPONENT $deb
+            else
+                echo "in $i execute dak import -a $SUITE $COMPONENT $deb"
+                dak import -a $SUITE $COMPONENT $deb
             fi
+            fi
         done
-                for deb in *.udeb; do
-            if [ -f ${deb} ] ; then
-                        echo "in $i execute dak import -a $SUITE $COMPONENT $deb"
-                        dak import -a $SUITE $COMPONENT $deb || test 3 -eq $? && dakmove $SUITE $COMPONENT $deb || exit $?
-            fi
-                done
-
         cd ..
     done



[back]