Software package updating method, device and computing device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIONTECH SOFTWARE TECH CO LTD
- Filing Date
- 2022-04-02
- Publication Date
- 2026-05-12
AI Technical Summary
但这种方式只对packages文件生效,旧版本的deb还是会被删除,客户端在packages过期时依旧无法下载deb,而且通常情况下release文件和packages文件在客户端是同时下载的,因此这种方式实际作用并不大
[0019]The software package update method of the present invention copies the software package imported into the original repository to a new address (i.e., the target path) and modifies the address of the software package in the repository index file to point to the new address.
Smart Images

Figure CN115167888B_ABST
Abstract
Description
[0001] This application is a divisional application of invention patent application 2022103402843, filed on April 2, 2022. Technical Field
[0002] This invention relates to the field of software repository update technology, and in particular to a software package update method, apparatus and computing device. Background Technology
[0003] As the Linux desktop ecosystem becomes more complete, users' demands and requirements for software are gradually increasing, leading to a higher software update frequency, which also puts a test on the software repository for storage and retrieval software.
[0004] Debian repositories are common software repositories for Linux systems, managed using the reprepro tool. In a server-side Debian repository, each version of each software includes three parts: repository information (release), a repository index file (packages), and the package (deb). The release section records the storage addresses of packages applicable to different processor architectures, while the packages section records the storage addresses of each deb file. Figure 1 Taking a specific version of a software in the Debian repository as an example, the release records the storage addresses of packages for the amd64 architecture and packages for the i386 architecture. The amd64 architecture packages record the storage addresses of the amd64 architecture deb files, and the i386 architecture packages record the storage addresses of the i386 architecture deb files.
[0005] like Figure 2As shown, the server imports a version 1 deb file (deb_v1) of a certain software. It then records the storage address of packages in the release repository and the storage address of the deb file in the packages repository. When the client downloads and installs the software, it first downloads the release repository from the server and caches it locally. Then, it queries the storage address of packages in the release repository, downloads the packages from the server according to that address, and caches them locally. When installing the software, it queries the storage address of the deb file in the locally cached packages repository, downloads the deb file from the server according to that address, and installs it. When version 2 of the software becomes available, the software repository needs to be updated. The update process is as follows: First, deb_v2 is imported into the server's software repository. Since the reprepro tool only allows one copy of a deb file with the same architecture and package name, the reprepro tool will delete deb_v1 when deb_v2 is imported. Then, the release repository and packages repository are updated, and the updated packages repository records the storage address of deb_v2. After the software repository is updated, if the packages cached locally on the client were downloaded before the software repository was updated, that is, if the packages record the storage address of deb_v1, then since deb_v1 has been deleted, the client will not be able to download the deb file when running the packages.
[0006] To address the issue of invalid deb download addresses, the Debian repository format specification specifies adding the `Acquire-By-Hash` option to the release file. This instructs clients to prioritize retrieving packages by hash value; if that fails, they can then retrieve them from the default path. When repository management tools support this method, they will also place the packages in the hash value path. For example, the default path for the packages file is: `dists / eagle / main / binary-amd64 / Packages`. After using the `Acquire-By-Hash` option, the packages file will also be copied to the hash path: `dists / eagle / main / binary-amd64 / by-hash / MD5Sum / 4d4bd928d09a48c193ac6ec54ad4ccbe`. The process for retrieving the packages file is as follows: Figure 3As shown, after the client obtains the release file, it checks whether Acquire-By-Hash is enabled. If Acquire-By-Hash is not enabled, it downloads and caches the packages file from the default path. If Acquire-By-Hash is enabled, it downloads and caches the packages file from the hash value path recorded in the release file. If downloading the packages file from the hash value path fails, it downloads and caches the packages file from the default path. Using the Acquire-By-Hash parameter stores the packages in the directory of its own hash value. When the repository is updated, the packages file will not be overwritten, preventing mismatches between the downloaded release and packages. However, this method only applies to the packages file; older versions of the deb files will still be deleted. The client will still be unable to download deb files when the packages expire. Furthermore, the release and packages files are usually downloaded simultaneously by the client, so this method is not very effective in practice.
[0007] In summary, none of the existing software repository update technologies mentioned above can address the issue of software packages being undownloadable due to outdated client repository index files. Summary of the Invention
[0008] Therefore, the present invention provides a software package update method, apparatus and computing device in an attempt to solve or at least alleviate at least one of the problems mentioned above.
[0009] According to one aspect of the present invention, a software package update method is provided, applicable to a server, the method comprising the steps of: in response to detecting that a software package has been updated in an original repository, generating a target repository index file, the content recorded in the target repository index file being the same as the content recorded in the original repository index file in the original repository; copying the software package from its original path in the original repository to a target path in the target repository; and modifying the original path of the software package in the target repository index file to the target path to obtain an updated target repository index file, thereby completing the update of the software package.
[0010] Optionally, in the software package update method according to the present invention, the step of copying the software package from the original path in the original repository to the target path in the target repository includes: obtaining the target path of each software package in the target repository index file; and, if no file is stored in the target path, copying the software package corresponding to the target path from the original path in the original repository to the target path in the target repository.
[0011] Optionally, in the software package update method according to the present invention, the step of copying the software package from the original path in the original repository to the target path in the target repository includes: locating the software package and obtaining its original path; and copying the software package from the original path in the original repository to the target path in the target repository.
[0012] Optionally, in the software package update method according to the present invention, the target path is obtained from the original path of the corresponding software package.
[0013] Optionally, in the software package update method according to the present invention, the target path is obtained by concatenating the original path and hash value of the corresponding software package.
[0014] Optionally, in the software package update method according to the present invention, the software package is copied from the original path in the original repository to the target path in the target repository using a hard link.
[0015] According to another aspect of the present invention, a software package update apparatus is also provided, suitable for a server. The apparatus includes: an initialization unit adapted to generate a target repository index file in response to detecting that a software package has been updated in an original repository, wherein the content recorded in the target repository index file is the same as the content recorded in the original repository index file in the original repository; a file copying unit adapted to copy the software package from its original path in the original repository to a target path in the target repository; and a path modification unit adapted to modify the original path of the software package in the target repository index file to the target path, thereby obtaining an updated target repository index file and completing the update of the software package.
[0016] Optionally, in the software package update apparatus according to the present invention, the file copying unit includes: a path acquisition subunit, adapted to acquire the target path of each software package in the target repository index file; and a first copying subunit, adapted to copy the software package corresponding to the target path from the original path in the original repository to the target path in the target repository when no file is stored in the target path.
[0017] According to another aspect of the present invention, a computing device is also provided, comprising: at least one processor and a memory storing program instructions; when the program instructions are read and executed by the processor, the computing device causes the computing device to perform the software package update method described above.
[0018] According to another aspect of the present invention, a readable storage medium storing program instructions is also provided, which, when read and executed by a computing device, causes the computing device to perform the software package update method described above.
[0019] The software package update method of the present invention copies the software package imported into the original repository to a new address (i.e., the target path) and modifies the address of the software package in the repository index file to point to the new address.
[0020] According to the software package update method, apparatus and computing device of the present invention, at least one of the following beneficial effects can be achieved: since the software packages in the new address are not controlled by the repository management software, after the original repository changes, each version of the software package still exists in the target repository. Even if the client stores the old version of the repository index file, the repository index file is still valid and the corresponding version of the software package can be downloaded normally. Attached Figure Description
[0021] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.
[0022] Figure 1 The basic structure of a server-side Debian repository according to the background art of the present invention is shown;
[0023] Figure 2 The process of importing and updating deb files on the server side and downloading deb files on the client side, according to the background technology of the present invention, is illustrated.
[0024] Figure 3 A flowchart illustrating the process of obtaining packages files according to the background art of the present invention is shown;
[0025] Figure 4 A schematic diagram illustrating the usage environment of a software package update method 600 according to an embodiment of the present invention is shown.
[0026] Figure 5 A schematic diagram of the structure of a computing device 500 according to an embodiment of the present invention is shown;
[0027] Figure 6 A flowchart of a software package update method 600 according to an embodiment of the present invention is shown;
[0028] Figure 7 A flowchart of a software package update method 700 according to an embodiment of the present invention is shown;
[0029] Figure 8 A schematic diagram of the structure of a software package update apparatus 800 according to an embodiment of the present invention is shown. Detailed Implementation
[0030] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0031] To address the problem that existing software repository update technologies cannot download deb files when the client's packages file expires, this invention provides a software package update method that can download the corresponding version of the deb file when the client's packages file expires.
[0032] Figure 4 A schematic diagram illustrating the usage environment of a software package update method 600 according to an embodiment of the present invention is shown. Figure 4 As shown, existing repository management tools are used to manage the original repository on the server side. In this application embodiment, the original repository refers to the software repository in the prior art. During the package import process, the package update method 600 implements its function in the form of a script, so that the deb file imported from the original repository exists in two addresses simultaneously. This can effectively avoid the problem of the client's packages file being unable to download the deb file due to the deletion of the old version of the deb file in the original repository.
[0033] Figure 5 A schematic diagram of a computing device 500 according to an embodiment of the present invention is shown. It should be noted that... Figure 5 The computing device 500 shown is merely an example. In practice, the computing device used to implement the software package update method of the present invention can be any type of device, and its hardware configuration can be similar to... Figure 5 The computing device 500 shown is the same as, and can also be used with Figure 5 The computing device 500 shown is different. In practice, the computing device used to implement the software package update method of the present invention can... Figure 5 The hardware components of the computing device 500 shown can be added or removed; this invention does not limit the specific hardware configuration of the computing device. The software package update method of this invention updates the... Figure 5 The hardware components of the computing device 500 shown are dynamically loaded.
[0034] like Figure 5As shown, in the basic configuration 502, the computing device 500 typically includes a system memory 506 and one or more processors 504. A memory bus 508 can be used for communication between the processors 504 and the system memory 506.
[0035] Depending on the desired configuration, processor 504 can be any type of processor, including but not limited to: microprocessor (μP), microcontroller (μC), digital information processor (DSP), or any combination thereof. Processor 504 may include one or more levels of cache such as L1 cache 510 and L2 cache 512, processor core 514, and registers 516. Example processor core 514 may include an arithmetic logic unit (ALU), floating-point unit (FPU), digital signal processing core (DSP core), or any combination thereof. Example memory controller 518 may be used with processor 504, or in some implementations, memory controller 518 may be an internal part of processor 504.
[0036] Depending on the desired configuration, system memory 506 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 506 may include operating system 520, one or more applications 522, and program data 524. In some embodiments, application 522 may be arranged to execute instructions on the operating system using program data 524 by one or more processors 504.
[0037] The computing device 500 may also include an interface bus 540 that facilitates communication from various interface devices (e.g., output devices 542, peripheral interfaces 544, and communication devices 546) to the basic configuration 502 via a bus / interface controller 530. Example output devices 542 include a graphics processing unit 548 and an audio processing unit 550. They may be configured to facilitate communication with various external devices such as displays or speakers via one or more A / V ports 552. Example peripheral interfaces 544 may include a serial interface controller 554 and a parallel interface controller 556, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 558. Example communication devices 546 may include a network controller 560, which may be arranged to facilitate communication with one or more other computing devices 262 via a network communication link through one or more communication ports 564.
[0038] A network communication link can be an example of a communication medium. A communication medium can typically be embodied in a modulated data signal, such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A “modulated data signal” can be a signal whose data set, or whose modifications, can be encoded with information within the signal. As a non-limiting example, a communication medium can include wired media such as wired networks or leased lines, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term “computer-readable medium” as used herein can include both storage media and communication media.
[0039] The computing device 500 can be implemented as a server, such as a file server, database server, application server, and web server, or as a personal computer including desktop and laptop computer configurations. Of course, the computing device 500 can also be part of a small-sized portable (or mobile) electronic device. In an embodiment of the present invention, the computing device 500 is configured to execute the software package update method 600 according to the present invention. The application 522 of the computing device 500 includes multiple program instructions for executing the software package update method 600 according to the present invention, and the program data 524 can also store repository information (release), repository index (packages), software package (deb), and various cached data.
[0040] According to an embodiment of the present invention, a software package update method 600 is applicable to a server. The method 600 includes the following steps: in response to detecting that the software package has been updated in the original repository, generating a target repository index file, wherein the content recorded in the target repository index file is the same as the content recorded in the original repository index file in the original repository; copying the software package from the original path in the original repository to the target path in the target repository; and modifying the original path of the software package in the target repository index file to the target path to obtain an updated target repository index file, thereby completing the software package update.
[0041] Method 600 can be packaged into a script, and the warehouse management software manages the original warehouse in the existing way. Whenever a software package is imported into the original warehouse, the script starts running.
[0042] Figure 6 A flowchart of a software package update method 600 according to an embodiment of the present invention is shown. Method 600 is executed in a computing device (e.g., the aforementioned computing device 500). Figure 6 As shown, method 600 begins with step S610.
[0043] In step S610, in response to detecting that the software package has been updated in the original repository, a target repository index file is generated. The content recorded in the target repository index file is the same as the content recorded in the original repository index file in the original repository.
[0044] It should be noted that the original repository index file is the repository index file in the original repository in the prior art, used to record the import path of the software package. The import path of the software package is also called the original path. The repository management software generates the original path for the software package to be imported, and then imports the software package into the original path. The target repository index file can be obtained by copying the original repository index file. The two have the same content, but different filenames. The original repository index file can be copied into memory for easy modification in subsequent steps. The method 600 of this application embodiment is applicable to the server side, while the client still uses the traditional method when downloading or updating software. Therefore, in order to make the client download the software package from the target path first, the filename of the target repository index file should be the same as the filename of the repository index file in the software repository in the prior art. Accordingly, the filename of the original repository index file mentioned in method 600 should be modified so that the filename of the original repository index file is different from that of the target repository index file.
[0045] Next, in step S620, the package is copied from the original path in the original repository to the target path in the target repository.
[0046] The software package here is actually the package that was just imported into the original repository at the original path, but the copying process has not been completed before step S620. The target path can be generated in various ways, as long as it is different from the existing file package storage path. The software package copied to the target path is not in the repository management software's records. Therefore, the copied software package will be out of the repository management software's control. When importing a new version of the software package, the software package stored at the original path will be deleted, but the software package stored at the target path will not be deleted.
[0047] To avoid redundant storage and hard drive read / write operations during the copying process, hard links in the file system can be used to copy the software package from the original path to the target path. For example, the imported .deb file is placed in the following path by the repository management software reprepro:
[0048] pool / main / c / curl / curl_7.64.0-4+deb10u1_amd64.deb
[0049] Copy the .deb file to another path using a hard link:
[0050] pool / main / c / curl / curl_7.64.0-4+deb10u1_amd64_MD5sum-8b99d02cc2d9aefac2dc552fd32d345d.deb
[0051] The hard links created during the copying process share the same underlying data blocks as the packages stored in the original path.
[0052] Next, in step S630, the original path of the currently imported software package in the target repository index file is modified to the target path to obtain the updated target repository index file, thus completing the software package update.
[0053] In order for the client to download the software package from the target path based on the target repository index file, the storage path of the software package in the target repository index file needs to be modified to the target path. Specifically, the path can be modified using the script hook mechanism of the repository management software reprepro.
[0054] After updating the packages in the original repository using method 600, the old version packages stored in the target path will not be deleted. When the client downloads the packages, it will first look for the target repository index file in the existing way, and then download the packages according to the storage path of the packages recorded in the target repository index file. Even if the information recorded in the target repository index file stored by the client is the storage path of the old version packages, the download of the packages can be completed successfully.
[0055] According to one implementation of the present invention, the step of copying a software package from its original path in the original repository to its target path in the target repository includes: obtaining the target path of each software package in the target repository index file; and, if no file is stored in the target path, copying the software package corresponding to the target path from its original path in the original repository to its target path in the target repository. This method requires traversing all the target paths of all software packages in the target repository index file and determining whether these target paths are empty. When a target path is empty, the original path of the software package corresponding to that target path is found, and the software package is copied from that original path to the target path. This copying method has simple logic and is relatively easy to implement. It only checks whether a file is stored in each target path, and the data processing is not complex. Taking 1000 software packages as an example, completing all checks takes no more than one second.
[0056] According to another implementation of the present invention, the step of copying a software package from its original path in the original repository to its target path in the target repository includes: locating the software package and obtaining its original path; and copying the software package from its original path in the original repository to its target path in the target repository. This method only requires data processing on one software package, avoiding the traversal process.
[0057] According to one implementation of the present invention, the target path is obtained from the original path of the corresponding software package. This method requires pre-setting the structure of the target path. For example, the target path structure can be set to add a certain parameter to the original path. The parameter can be recorded in the original repository index file, and the target repository index file will also record these parameters. When reading the target repository index file, the corresponding parameter is added to the original path of the read software package to obtain the target path of that software package. Alternatively, the target path can be obtained when generating the target repository index file. The entire contents of the original repository index file are copied into memory, and then the corresponding parameter is added to the original path of each software package. The resulting target path is also recorded in memory, so the target path can be directly read when reading the target repository index file. To avoid conflicts with software package filenames under the original path, the parameter can also be added to the copied software package filenames.
[0058] According to one implementation of the present invention, the above parameter may be the hash value of the software package. The hash value of the software package is commonly used data in the original repository. In the prior art, the hash value of the software package is recorded in the original repository index file.
[0059] Package update method 600 is applicable to both newly created software repositories and software repositories that already contain packages. Here, "update" can mean uploading a new version of a package that already exists in the original repository, or uploading a completely new package.
[0060] Furthermore, the software packages generated by method 600 are static repository files, requiring no special server support, and can be quickly and widely applied to repository synchronization and caching; and can be used in conjunction with CDN and open source repository sources, greatly improving the reliability of the repository.
[0061] The following is a preferred implementation of method 600, such as... Figure 7As shown, method 600 is encapsulated as a hook script, and the warehouse management software uses reprepro. When the server imports a deb file, the hook script begins execution. First, it reads the Packages file to obtain the file path and hash value of a deb file. Then, it appends the hash value to the filename in the file path to obtain the new file path, i.e., the target path. It checks whether the file exists in the target path. If the file does not exist, it copies the deb file to the target path and modifies the path of the deb file in Packages to point to the target path. If the file already exists in the target path, it similarly modifies the path of the deb file in Packages to point to the target path. Then, it reads the path and hash value of the next deb file in Packages until the Packages file is completely read. Finally, it saves the Packages file, completing the update of the deb file.
[0062] Figure 7 The package update process shown can be implemented using the following code:
[0063]
[0064]
[0065]
[0066] The following example illustrates the use of... Figure 7 The process shown is the specific procedure for updating software packages in the original repository.
[0067] For example, the original repository stores three software packages A, B, and C. Each software package exists only in one path, namely the original path. The original repository index file records the original path A1 of A, the hash value HA of A, the original path B1 of B, the hash value HB of B, the original path C1 of C, and the hash value HC of C.
[0068] The goal is to upgrade software package A to A'. Using existing repository management software for package upgrade management, the original path of A' is A'1, and its hash value is HA'. A' is imported into path A'1. The original repository index file is then updated with the following: the original path A'1, the hash value HA', the original path B1, the hash value HB, the original path C1, and the hash value HC. When package A' is detected being imported, the contents of the original repository index file are copied into memory to form the target repository index file. Next, the original path and hash value of each package in the target repository index file are read sequentially. First, read the original path A'1 and hash value HA' of A', and concatenate them to obtain the target path A'2. Then, A'2 = A'1 + HA'. Check if any files are stored under path A'2. The result is that no files are stored. At this point, copy A' from the original path A'1 to the target path A'2. Then, modify the path A'1 in the target repository index file to A'2. Next, read the original path B1 and hash value HB of B, and concatenate them to obtain the target path B2. Then, B2 = B1 + HB. Check if any files are stored under path B2. The detection result shows that no files are stored. At this point, B is copied from the original path B1 to the target path B2. Then, the path B1 in the target repository index file is changed to B2. Next, the original path C1 and the hash value HC of C are read and concatenated to obtain the target path of C as C2. Then C2 = C1 + HC. The detection result shows that no files are stored in path C2. At this point, C is copied from the original path C1 to the target path C2. Then, the path C1 in the target repository index file is changed to C2. Finally, the target repository index file is saved, and the import of package A' is completed.
[0069] Next, we continue updating software package B using method 600. Following the same method, we obtain the original path B'1 and hash value HB' of the upgraded version B' of B, and import B' into the original path B'1. At this point, the contents of the original repository index file are updated to: the original path A'1 of A', the hash value HA' of A', the original path B'1 of B', the hash value HB' of B', the original path C1 of C, and the hash value HC of C. When the upgraded version B' of B is detected imported into path B'1, the contents of the original repository index file are copied into memory to form the target repository index file.
[0070] Next, the original path and hash value of each package in the target repository index file are read sequentially. First, the original path A'1 and hash value HA' of A' are read and concatenated to obtain the target path A'2. Then A'2 = A'1 + HA'. The system checks whether a file is stored under path A'2. The result is that package A' exists under this path. At this point, the package copying process is skipped, and the path A'1 of A' in the target repository index file is modified to A'2. Next, the original path B'1 and hash value HB' of B' are read and concatenated to obtain the target path B'2. Then B'2 = B'1 + HB'. The system checks whether a file is stored under path B'2. The detection result shows that no files are stored. At this point, B' is copied from the original path B'1 to the target path B'2. Then, the path B'1 in the target repository index file is changed to B'2. Next, the original path C1 of C and the hash value HC of C are read and concatenated to obtain the target path of C as C2. Then C2 = C1 + HC. The detection result shows that the package C exists in this path. At this point, the package copying process is skipped, and the path C1 of C in the target repository index file is changed to C2. Finally, the target repository index file is saved, and the import of package B' is completed.
[0071] Embodiments of the present invention also provide a software package update apparatus 800, which is capable of performing the steps of the software package update method 600 as described above. Below, in conjunction with... Figure 8 The above-mentioned software package update device 800 is described here.
[0072] like Figure 8 As shown, the software package update device 800 includes an initialization unit 810, a file copying unit 820, and a path modification unit 830.
[0073] The initialization unit 810 is adapted to generate a target repository index file in response to detecting that the software package has been updated in the original repository. The content recorded in the target repository index file is the same as the content recorded in the original repository index file in the original repository.
[0074] The file copying unit 820 is adapted to copy software packages from the original path in the original repository to the target path in the target repository.
[0075] The path modification unit 830 is adapted to modify the original path of the software package in the target repository index file to the target path, thereby obtaining the updated target repository index file and completing the software package update.
[0076] According to one implementation of the present invention, the file copying unit 820 includes a path acquisition subunit and a first copying subunit. The path acquisition subunit is adapted to acquire the target paths of each software package in the target repository index file. The first copying subunit is adapted to copy the software package corresponding to the target path from the original path in the original repository to the target path in the target repository when no file is stored at the target path.
[0077] According to another implementation of the present invention, the file copying unit 820 includes a positioning subunit and a second copying subunit. The positioning subunit is adapted to locate the currently imported software package and obtain its original path. The second copying subunit is adapted to copy the software package from its original path in the original repository to its target path in the target repository.
[0078] According to one implementation of the present invention, the target path is obtained from the original path of the corresponding software package.
[0079] According to one implementation of the present invention, the target path is obtained by concatenating the original path and hash value of the corresponding software package.
[0080] According to one implementation of the present invention, a hard link is used to copy the software package from the original path in the original repository to the target path in the target repository.
[0081] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.
[0082] When the program code is executed on a programmable computer, the computing device generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the software package update method of the present invention according to instructions in the program code stored in the memory.
[0083] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.
[0084] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing preferred embodiments of the invention.
[0085] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0086] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more aspects of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Those skilled in the art will understand that modules, units, or components of the devices in the examples disclosed herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or further divided into multiple sub-modules.
[0087] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0088] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments. Additionally, some of the embodiments described herein are described as methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the method or method elements forms means for implementing the method or method elements. Furthermore, the elements described herein in the device embodiments are examples of means for implementing the functions performed by elements for the purposes of carrying out the invention.
[0089] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.
[0090] Although the invention has been described with respect to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of explaining or limiting the subject matter of the invention.
Claims
1. A software package update method, applicable to a server, the method comprising the steps of: In response to the detection that the software package has been updated in the original repository, a target repository index file is generated, the contents of which are the same as those of the original repository index file in the original repository. The software package is located to obtain its original path; The software package is copied from its original path in the original repository to its target path in the target repository, the target path being obtained from the original path of the corresponding software package; and The original path of the software package in the target repository index file is modified to the target path to obtain the updated target repository index file, thus completing the update of the software package.
2. The software package update method as described in claim 1, wherein, The step of copying the software package from the original path in the original repository to the target path in the target repository includes: Obtain the target paths of each software package in the target repository index file; and If no files are stored at the target path, the software package corresponding to the target path will be copied from the original path in the original repository to the target path in the target repository.
3. The software package update method as described in claim 1 or 2, wherein, The target path is obtained by concatenating the original path and hash value of its corresponding software package.
4. The software package update method as described in claim 1 or 2, wherein the software package is copied from the original path in the original repository to the target path in the target repository using a hard link.
5. A software package update apparatus, suitable for a server, the apparatus comprising: An initialization unit is adapted to generate a target repository index file in response to detecting that the software package has been updated in the original repository, wherein the content recorded in the target repository index file is the same as the content recorded in the original repository index file in the original repository; A file copying unit is adapted to copy the software package from its original path in the original repository to a target path in the target repository. The file copying unit includes a positioning subunit and a second copying subunit. The positioning subunit is adapted to locate the software package and obtain its original path. The second copying subunit is adapted to copy the software package from its original path in the original repository to the target path in the target repository, where the target path is obtained from the original path of the corresponding software package. The path modification unit is adapted to modify the original path of the software package in the target repository index file to the target path, thereby obtaining an updated target repository index file and completing the update of the software package.
6. The software package update apparatus as described in claim 5, wherein, The file copying unit further includes: The path acquisition subunit is adapted to acquire the target paths of each software package in the target repository index file; and The first copying subunit is adapted to copy the software package corresponding to the target path from the original path in the original repository to the target path in the target repository when no file is stored in the target path.
7. A computing device, comprising: At least one processor and a memory storing program instructions; When the program instructions are read and executed by the processor, the computing device performs the software package update method as described in any one of claims 1-4.
8. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the software package update method as described in any one of claims 1-4.