Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reproducible Build] apt-get hook incorrect logic and many deb packages versions are missing in versions file. #7502

Open
baxia-lan opened this issue Apr 30, 2021 · 1 comment
Labels

Comments

@baxia-lan
Copy link
Contributor

Description

  1. The apt-get hook script contains incorrect logic.

  2. Also as mentioned in [Reproducible Build] Installing packages during docker-sonic-vs.gz build is rejected by versions control framework #7152 (comment):
    Some debian packages installation are not reproducible (eg. python3-pip), they are installed during build but uninstalled later, thus not captured in versions-deb files. After fix the logic in apt-get script, these packages are not able to be verified when version control is enabled.

Describe the results you received:

  1. With ENABLE_VERSION_CONTROL_DEB=y, the version defined in versions file for debian packages never being used.
        if [[ "$para" != -* ]]; then # All packages in apt-get command are passed
            continue
        fi
        if [ ! -z "$INSTALL" ]; then
            if [[ "$para" == *=* ]]; then
                continue
            elif [[ "$para" == *=* ]]; then # duplicate check
                continue
            else
                package=$para
                if ! grep -q "^${package}=" $VERSION_FILE; then
                    echo "The version of the package ${package} is not specified."
                    exit 1
                fi # the version defined in VERSION_FILE is never extracted and used
            fi
        elif [[ "$para" == "install"  ]]; then
            INSTALL=y
        fi

...
$REAL_COMMAND "$@" # the version defined in VERSION_FILE is never used
  1. Besides the incorrect script, many deb packages versions are missing in versions file.

Describe the results you expected:

  1. To fix the bugs in the apt-get hook:
parameters=("$@")
if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then
    for (( i=0; i < $#; i++ ))
    do
        para=${parameters[$i]}
        if [[ "$para" == -* ]]; then
            continue
        fi
        if [ ! -z "$INSTALL" ]; then
            if [[ "$para" == *=* ]]; then
                continue
            else
                package=$para
                [ -f "$VERSION_FILE" ] && version=`grep $package $VERSION_FILE | awk -F"==" '{print$2}'`
                if [[ -z "$version" ]]; then
                    echo "Error: The version of the package ${package} is not specified." 1>&2
                    exit 1
                fi
                parameters[$i]="${package}=${version}"
            fi
        elif [[ "$para" == "install"  ]]; then
            INSTALL=y
        fi
    done
fi

$REAL_COMMAND "${parameters[@]}"
  1. Fix the logic to collect deb packages versions to include all intermediate packages versions during build.
@baxia-lan
Copy link
Contributor Author

@xumia @qiluo-msft , do you have any insight on this issue? Thank you.

@lguohan lguohan added the Build label May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants