scripts/dl_github_archive.py: convert to Python 3 with 2-to-3
[openwrt/openwrt.git] / scripts / ipkg-build
index 845a6ed04e63293e353aa4c6b6d8188a1184fb88..21127f33910cabb82f6b025a1865f305c88b9c10 100755 (executable)
@@ -15,8 +15,12 @@ FIND="${FIND:-$(which gfind)}"
 TAR="${TAR:-$(which tar)}"
 GZIP="$(which gzip)"
 
+# try to use fixed source epoch
+if [ -n "$SOURCE_DATE_EPOCH" ]; then
+       TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH")
+
 # look up date of last commit
-if [ -d "$TOPDIR/.git" ]; then
+elif [ -d "$TOPDIR/.git" ]; then
        GIT="$(which git)"
        TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci)
 elif [ -d "$TOPDIR/.svn" ]; then
@@ -60,8 +64,10 @@ pkg_appears_sane() {
                done
 
                rm $CONTROL/conffiles
-               mv $CONTROL/conffiles.resolved $CONTROL/conffiles
-               chmod 0644 $CONTROL/conffiles
+               if [ -f $CONTROL/conffiles.resolved ]; then
+                       mv $CONTROL/conffiles.resolved $CONTROL/conffiles
+                       chmod 0644 $CONTROL/conffiles
+               fi
        fi
 
        cd $owd