p) packager="$OPTARG" ;;
b) builddate="$OPTARG" ;;
P) prefix="$OPTARG" ;;
+ t) tags="$OPTARG" ;;
+ c) tags="$tags +configuration" ;;
esac
done
fi
for path in $*; do
- mtime=$(zpm stat -t '%y' $path)
- uid=$(zpm stat -t '%u' $path)
- gid=$(zpm stat -t '%g' $path)
- username=$(zpm stat -t '%U' $path)
- groupname=$(zpm stat -t '%G' $path)
- mode=$(zpm stat -t '%a' $path)
+ mtime=$(zpm stat -f '%y' $path)
+ uid=$(zpm stat -f '%u' $path)
+ gid=$(zpm stat -f '%g' $path)
+ username=$(zpm stat -f '%U' $path)
+ groupname=$(zpm stat -f '%G' $path)
+ mode=$(zpm stat -f '%a' $path)
# strip off leading slashes
rpath=$(echo "$path" | sed -e 's|^/*||')
rpath="$prefix/$rpath"
fi
- if [ -f "$path" ]; then
-
- hash=$(zpm addfile $pkgfile $path)
-
-#if [ -z "$hash" ]; then continue; fi
+ filetype=$(zpm stat -f '%t' "$path")
+ hash='NULL'
+ target='NULL'
+ case "$filetype" in
+ regular)
+ filetype=d
+ hash=$(zpm addfile $pkgfile "$path")
+ hash="'$hash'"
+ filetype=r
+ ;;
+ directory)
+ filetype=d
+ ;;
+ symlink)
+ filetype=l
+ target=$(readlink $path)
+ target="'$target'"
+ ;;
+ esac
-# TODO mtime, mode
-sqlite3 $pkgfile <<EOS
-PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,hash)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname','$hash')
-;
-EOS
-elif [ -d "$path" ]; then
-sqlite3 $pkgfile <<EOS
+ sqlite3 $pkgfile <<EOS
PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname')
-;
+begin;
+insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,filetype,hash,target)
+values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname','$filetype',$hash,$target);
+commit;
EOS
-elif [ -l "$path" ]; then
- target=$(readlink $path)
-sqlite3 $pkgfile <<EOS
-PRAGMA foreign_keys = ON;
-insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,target)
-values ('$package', '$pkgver', $pkgrel, '$rpath', '$mode',$mtime, '$username','$groupname','$target')
-;
-EOS
-fi
+
#printf "%s %s%s\n" $path $rpath ${target:+" -> $target"}
printf "%s\n" $path
done