mirror of
https://github.com/helixarch/debtap
synced 2025-04-02 18:10:05 +02:00
Merge dcfc8add71a2b82d24d177ff630673f0c1ed2841 into 0c4f92b12e7d27b994dbab0835032f7f6ff6e40b
This commit is contained in:
commit
20aff26546
60
debtap
60
debtap
@ -173,9 +173,8 @@ tar_extract_cmd() {
|
||||
|
||||
# Defining package with full path & defining and creating working directory
|
||||
package_with_full_path="`readlink -f "${@: -1}"`"
|
||||
working_directory="`pwd`/`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
|
||||
rm -rf "$working_directory" 2> /dev/null
|
||||
mkdir "$working_directory" 2> /dev/null
|
||||
working_directory=$(mktemp -d -p "`pwd`" "`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`".XXXXXXXXXX)
|
||||
trap 'rm -rf "$working_directory"' EXIT
|
||||
if [[ $(echo $?) != 0 ]]; then
|
||||
echo -e "${red}Error: Cannot create working directory, permission denied. Exiting...${NC}"
|
||||
exit 1
|
||||
@ -187,14 +186,12 @@ echo -e "${lightgreen}==>${NC} ${bold}Extracting package data...${normal}"
|
||||
control_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "control\.tar")
|
||||
control_extract=$(tar_extract_cmd "$control_tar_check")
|
||||
if [ $? != 0 ]; then
|
||||
rm -rf "$working_directory"
|
||||
exit 1
|
||||
fi
|
||||
ar p "$package_with_full_path" "$control_tar_check" | $control_extract
|
||||
|
||||
if [[ $pseudo == set ]] && [[ $(grep ^Architecture: control | grep -q i386; echo $?) != 0 ]]; then
|
||||
echo -e "${red}Error: Invalid package architecture. Removing extracted package data and exiting...${NC}"
|
||||
rm -rf "$working_directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -202,7 +199,6 @@ rm -rf $(ls * | grep -v 'control\|preinst\|postinst\|prerm\|postrm\|conffiles')
|
||||
data_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "data\.tar")
|
||||
data_extract=$(tar_extract_cmd "$data_tar_check")
|
||||
if [ $? != 0 ]; then
|
||||
rm -rf "$working_directory"
|
||||
exit 1
|
||||
fi
|
||||
ar p "$package_with_full_path" "$data_tar_check" | $data_extract
|
||||
@ -2940,59 +2936,59 @@ if [[ $(grep -q '^Recommends:\|^Suggests:' control; echo $?) == 0 ]]; then
|
||||
rm -rf *tempfile* optional-dependencies-initial-check-list final-check-list
|
||||
fi
|
||||
|
||||
# Moving report files to /tmp/debtap (if any exist)
|
||||
rm -rf /tmp/debtap 2> /dev/null
|
||||
mkdir /tmp/debtap 2> /dev/null
|
||||
# Moving report files to debtap temporary directory (if any exist)
|
||||
debtap_tmp=$(mktemp -d -p /tmp debtap.XXXXXXXXXX)
|
||||
if [[ $(echo $?) != 0 ]]; then
|
||||
echo -e "${red}Error: Cannot create /tmp/debtap, permission denied${NC}"
|
||||
echo -e "${red}Error: Cannot create a temporary directory, permission denied${NC}"
|
||||
fi
|
||||
mv *untranslated* /tmp/debtap 2> /dev/null
|
||||
mv *missing-files /tmp/debtap 2> /dev/null
|
||||
trap 'rm -rf "$working_directory" "$debtap_tmp"' EXIT
|
||||
mv *untranslated* "$debtap_tmp" 2> /dev/null
|
||||
mv *missing-files "$debtap_tmp" 2> /dev/null
|
||||
|
||||
# Report of (warning messages for) untranslated packages names and packages with missing files (if any exist)
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]]; then
|
||||
echo -e "\n${lightred}Warning: These dependencies (depend = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
echo `cat /tmp/debtap/dependencies-untranslated-names-only` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/dependencies-untranslated-names-only"` | sed s'/ /, /g'
|
||||
fi
|
||||
if [[ -e /tmp/debtap/dependencies-missing-files ]]; then
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-missing-files" ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]]; then
|
||||
echo -e "${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
|
||||
else
|
||||
echo -e "\n${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
|
||||
fi
|
||||
echo `cat /tmp/debtap/dependencies-missing-files` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/dependencies-missing-files"` | sed s'/ /, /g'
|
||||
fi
|
||||
if [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]]; then
|
||||
if [[ -e "$debtap_tmp/optional-dependencies-untranslated-names-only-1" ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]] || [[ -e "$debtap_tmp/dependencies-missing-files" ]]; then
|
||||
echo -e "${lightred}Warning: These optional dependencies (optdepend = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
else
|
||||
echo -e "\n${lightred}Warning: These optional dependencies (optdepend = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
fi
|
||||
echo `cat /tmp/debtap/optional-dependencies-untranslated-names-only-1` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/optional-dependencies-untranslated-names-only-1"` | sed s'/ /, /g'
|
||||
fi
|
||||
if [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
|
||||
if [[ -e "$debtap_tmp/replacements-untranslated-names-only" ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]] || [[ -e "$debtap_tmp/dependencies-missing-files" ]] || [[ -e "$debtap_tmp/optional-dependencies-untranslated-names-only-1" ]]; then
|
||||
echo -e "${lightred}Warning: These replacements (replaces = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
else
|
||||
echo -e "\n${lightred}Warning: These replacements (replaces = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
fi
|
||||
echo `cat /tmp/debtap/replacements-untranslated-names-only` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/replacements-untranslated-names-only"` | sed s'/ /, /g'
|
||||
fi
|
||||
if [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
|
||||
if [[ -e "$debtap_tmp/conflicts-untranslated-names-only" ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]] || [[ -e "$debtap_tmp/dependencies-missing-files" ]] || [[ -e "$debtap_tmp/optional-dependencies-untranslated-names-only-1" ]] || [[ -e "$debtap_tmp/replacements-untranslated-names-only" ]]; then
|
||||
echo -e "${lightred}Warning: These conflicts (conflict = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
else
|
||||
echo -e "\n${lightred}Warning: These conflicts (conflict = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
fi
|
||||
echo `cat /tmp/debtap/conflicts-untranslated-names-only` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/conflicts-untranslated-names-only"` | sed s'/ /, /g'
|
||||
fi
|
||||
if [[ -e /tmp/debtap/provisions-untranslated-names-only ]]; then
|
||||
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]] || [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
|
||||
if [[ -e "$debtap_tmp/provisions-untranslated-names-only" ]]; then
|
||||
if [[ -e "$debtap_tmp/dependencies-untranslated-names-only" ]] || [[ -e "$debtap_tmp/dependencies-missing-files" ]] || [[ -e "$debtap_tmp/optional-dependencies-untranslated-names-only-1" ]] || [[ -e "$debtap_tmp/replacements-untranslated-names-only" ]] || [[ -e "$debtap_tmp/conflicts-untranslated-names-only" ]]; then
|
||||
echo -e "${lightred}Warning: These provisions (provides = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
else
|
||||
echo -e "\n${lightred}Warning: These provisions (provides = fields) could not be translated into Arch Linux packages names:${NC}"
|
||||
fi
|
||||
echo `cat /tmp/debtap/provisions-untranslated-names-only` | sed s'/ /, /g'
|
||||
echo `cat "$debtap_tmp/provisions-untranslated-names-only"` | sed s'/ /, /g'
|
||||
fi
|
||||
|
||||
# Generating .INSTALL file (if necessary)
|
||||
@ -3205,8 +3201,6 @@ fi
|
||||
if [[ $pkgbuild != set ]] && [[ $Pkgbuild != set ]]; then
|
||||
# Removing leftover files
|
||||
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
|
||||
rm -rf "$working_directory"
|
||||
rm -rf /tmp/debtap
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -3393,8 +3387,6 @@ rm -rf "../$pkgname" 2> /dev/null
|
||||
mkdir "../$pkgname" 2> /dev/null
|
||||
if [[ $(echo $?) != 0 ]]; then
|
||||
echo -e "${red}Error: Cannot create PKGBUILD directory, permission denied. Removing leftover files and exiting...${NC}"
|
||||
rm -rf "$working_directory"
|
||||
rm -rf /tmp/debtap
|
||||
exit 1
|
||||
fi
|
||||
mv PKGBUILD "../$pkgname"
|
||||
@ -3409,6 +3401,4 @@ fi
|
||||
|
||||
# Removing leftover files
|
||||
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
|
||||
rm -rf "$working_directory"
|
||||
rm -rf /tmp/debtap
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user