This package builds binary packages that will download the Android SDK components at install time.

In this file:
    - "component" refers to the SDK packages
    - "package" refers either to the Debian source package or the Debian binary package

The SDK components for which this source package builds Debian binary packages are:
    - build-tools (versioned packages)
    - cmdline-tools (versioned packages)
    - emulator
    - ndk (versioned packages)
    - patcher (versioned packages)
    - platforms (versioned packages)
    - platform-tools
    - sources (versioned packages)

"versioned packages" means there is a binary package for each version. They can be installed concurrently.

By defaults, SDK components marked as obsolete will be ignored. To enable them, set SKIP_OBSOLETE_PACKAGES variable to 0 in d/scripts/_components_to_package.sh.

To update this source package:
    - Get the latest upstream version
        debian/scripts/update_upstream.sh
    - Import into the repository
        gbp import-orig <path_to_orig.tar.xz>
    - refresh the patches, then run:
        git add debian/patches &&
        git commit -m "refresh patches"
    - update d/version_list*, d/control & d/tests/control with:
        debian/scripts/update_debian.sh latest
        git add debian
        git commit -m "New upstream version $(grep TIMESTAMP= debian/version_list.info | cut -d = -f 2) (debian/*)"
    - update d/changelog and set version to the timestamp in d/version_list.info
        To get the list of NEW/DELETED/UPDATED packages:
          - `git show | grep [-+]Package: | sort`
        gbp dch -N $(grep TIMESTAMP= debian/version_list.info  | cut -f2 -d=)-1
        Update the changelog manually with the NEW/DELETED/UPDATED packages
    - update d/version_list_unpacked_size.txt
        - run
            - `dpkg-buildpackage`
        - then from within a schroot as root user run
            - `DEBIAN_FRONTEND=noninteractive debian_chroot=$debian_chroot ./debian/scripts/get_unpacked_size.sh`
    - Check for updates of shlib dependencies of google-android-extras-google-auto-installer by running
        - apt install ../google-android-extras-google-auto-installer*.deb
        - dpkg-shlibdeps $(find /usr/lib/android-sdk/extras/google/auto -type f -executable -exec echo -e{} \;) -Tdebian/google-android-extras-google-auto-installer.substvars.in -l/usr/lib/android-sdk/extras/google/auto --ignore-missing-info
        - Update shlibdeps (make it less strict):
            - libc++1-* → libc++1 virtual package (same for libc++abi1). It works at least since libc++1 (3.5) shipped in stretch
            - libgcc-s1 → add libgcc1 as alternative (which is in stretch)
            - libc6 → works also with the version in stretch which is (>= 2.22), otherwise requires (>= 2.34)
            - libasound2t64 → libasound2 (so that the package can be installed also on distributions before t64 migration)

            sed -i \
            -e "s/\(libc++1[^,]*\),/libc++1,/" \
            -e "s/\(libc++abi1[^,]*\),/libc++abi1,/" \
            -e "s/\(libc6 [^,]*\),/libc6,/" \
            -e "s/\(libgcc-s1[^,]*\),/\1 | libgcc1,/" \
            -e "s/libasound2t64/libasound2/" \
            debian/google-android-extras-google-auto-installer.substvars.in

    - Commit the changes:
        - run `dh clean`
        - run `git status`

Script debian/scripts/update_upstream.sh:
    - downloads the latest XML file (repository2-1.xml) from google servers/mirrors
    - creates orig.tar.xz for it

Script debian/scripts/update_debian.sh
    - uses XSL stylesheets stored in d/scripts to create version_list.txt holding the available SDK component packages
    - permits to add manually some packages that are not listed in the XML
    - updates d/control
    - updates d/tests/control

debian/rules:
    - generates the files to build the binary packages based on the corresponding *.in files. For example $package.alternatives $package.bug-script $package.config $package.control $package.dirs $package.install $package.postinst $package.postrm $package.templates ...
        - copyright file for each binary package uses the copyright as set in the XML for that component
    - generates the *.sha1 files
    - sets the Installed-Size of the binary package
    - so that we can use "dh_installalternatives", d/rules creates the target files and removes them once dh_installalternatives updated the maintainer scripts.

licenses/*:
    - for more details see:
      https://salsa.debian.org/google-android-tools-team/android-sdk-meta/-/blob/master/debian/README.source

To build a package that contains the zip files from google, run with the list of packages, as they are output when running dpkg-buildpackage, separated by space.
    ./debian/scripts/make_zip_package.sh ndk,25.1.8937393 build-tools,33.0.0 platforms,android-33~33 platform-tools

    This replicates the package in another directory and add the field "XS-With-Zips: yes" to debian/control.in which, when present at build time will take the zip and add it to the binary package.
